Created
September 20, 2016 19:57
-
-
Save kdkanishka/4efd4379f8e31240b11a918574332326 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
VirusTotalConfig.getConfigInstance().setVirusTotalAPIKey(ApiDetails.API_KEY); | |
VirustotalPublicV2 virusTotalRef = new VirustotalPublicV2Impl(); | |
String urls[] = {"www.cslworld.com", "www.pagero.com"}; | |
FileScanReport[] reports = virusTotalRef.getUrlScanReport(urls, false); | |
for (FileScanReport report : reports) { | |
if(report.getResponseCode()==0){ | |
System.out.println("Verbose Msg :\t" + report.getVerboseMessage()); | |
continue; | |
} | |
System.out.println("MD5 :\t" + report.getMd5()); | |
System.out.println("Perma link :\t" + report.getPermalink()); | |
System.out.println("Resource :\t" + report.getResource()); | |
System.out.println("Scan Date :\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("Verbose Msg :\t" + report.getVerboseMessage()); | |
System.out.println("Response Code :\t" + report.getResponseCode()); | |
System.out.println("Positives :\t" + report.getPositives()); | |
System.out.println("Total :\t" + report.getTotal()); | |
Map<String, VirusScanInfo> scans = report.getScans(); | |
for (String key : scans.keySet()) { | |
VirusScanInfo virusInfo = scans.get(key); | |
System.out.println("Scanner : " + key); | |
System.out.println("\t\t Result : " + 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 Key not found! " + ex.getMessage()); | |
} catch (UnsupportedEncodingException ex) { | |
System.err.println("Unsupported Encoding Format!" + ex.getMessage()); | |
} catch (UnauthorizedAccessException ex) { | |
System.err.println("Invalid API Key " + ex.getMessage()); | |
} catch (Exception ex) { | |
System.err.println("Something Bad Happened! " + ex.getMessage()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment