Metascan File Upload i Java ved Sawan K.

Virustotal er en gratis tjeneste som analyserer mistenkelige filer og webadresser og muliggjør rask påvisning av virus, ormer, trojanere, og alle typer malware.

Dette er prosjektet er et Virustotal offentlig API versjon 2.0 implementering i Java Skann en gitt fil

public void scanFile () {. try { VirusTotalConfig.getConfigInstance () setVirusTotalAPIKey ("apikey");. VirustotalPublicV2 virusTotalRef = new VirustotalPublicV2Impl ();

ScanInfo scanInformation = virusTotalRef.scanFile (new File ("/Users /kdesilva /Desktop /eicar.com.txt"));

System.out.println ("___ SCAN INFORMASJON ___"); System.out.println ("MD5: \\ t" + scanInformation.getMd5 ()); System.out.println ("Perma Link: \\ t" + scanInformation.getPermalink ()); System.out.println ("Resource: \\ t" + scanInformation.getResource ()); System.out.println ("Scan Dato: \\ t" + scanInformation.getScanDate ()); System.out.println ("Scan Id: \\ t" + scanInformation.getScanId ()); System.out.println ("SHA1: \\ t" + scanInformation.getSha1 ()); System.out.println ("SHA256: \\ t" + scanInformation.getSha256 ()); System.out.println ("Utførlig Msg: \\ t" + scanInformation.getVerboseMessage ()); System.out.println ("Response Kode: \\ t" + scanInformation.getResponseCode ()); System.out.println ("ferdig."); } Catch (APIKeyNotFoundException ex) { System.err.println ("API-nøkkel finnes ikke!" + Ex.getMessage ()); } Catch (UnsupportedEncodingException ex) { System.err.println ("Unsupported Encoding Format!" + Ex.getMessage ()); } Catch (UnauthorizedAccessException ex) { System.err.println ("Ugyldig API Key" + ex.getMessage ()); } Catch (Exception ex) { System.err.println ("Noe dårlig skjedde!" + Ex.getMessage ()); } } Hent fil Scan Rapporter

public void getFileScanReport () { try { VirusTotalConfig.getConfigInstance () setVirusTotalAPIKey ("apikey");. VirustotalPublicV2 virusTotalRef = new VirustotalPublicV2Impl ();

String ressurs = "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f"; FileScanReport rapport = virusTotalRef.getScanReport (ressurs);

System.out.println ("MD5: \\ t" + report.getMd5 ()); System.out.println ("Perma link: \\ t" + report.getPermalink ()); System.out.println ("Resourve: \\ t" + report.getResource ()); System.out.println ("Scan Dato: \\ t" + report.getScanDate ()); System.out.println ("Scan Id: \\ t" + report.getScanId ()); System.out.println ("SHA1: \\ t" + report.getSha1 ()); System.out.println ("SHA256: \\ t" + report.getSha256 ()); System.out.println ("Utførlig Msg: \\ t" + report.getVerboseMessage ()); System.out.println ("Response Kode: \\ t" + report.getResponseCode ()); System.out.println ("positive: \\ t" + report.getPositives ()); System.out.println ("Total: \\ t" + report.getTotal ());

HashMap < String, VirusScanInfo > skanner = report.getScans (); for (String key: scans.keySet ()) { VirusScanInfo virusInfo = scans.get (key); System.out.println ("Scanner:" + nøkkel); System.out.println ("\\ t \\ t resut:" + virusInfo.getResult ()); System.out.println ("\\ t \\ t Update:" + virusInfo.getUpdate ()); System.out.println ("\\ t \\ t Version:" + virusInfo.getVersion ()); }

} Catch (APIKeyNotFoundException ex) { System.err.println ("API-nøkkel finnes ikke!" + Ex.getMessage ()); } Catch (UnsupportedEncodingException ex) { System.err.println ("Unsupported Encoding Format!" + Ex.getMessage ()); } Catch (UnauthorizedAccessException ex) { System.err.println ("Ugyldig API Key" + ex.getMessage ()); } Catch (Exception ex) { System.err.println ("Noe dårlig skjedde!" + Ex.getMessage ()); } }

For hele artikkelen kan du sjekke: Hvordan Skann Lastet opp File bruker Virustotal Java Library