Ignore:
Timestamp:
2019-11-20T11:30:47+13:00 (4 years ago)
Author:
davidb
Message:

Changed code so api key can be in separate file, and passed in on the command-line to the Java code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/malware-checker/trunk/java/src/main/java/org/greenstone/virustotal/GetFileScanReport.java

    r33664 r33708  
    1818public class GetFileScanReport {
    1919   
     20    public static void printUsage() {
     21    System.err.println("Usage: GetFileScanReport api-key resource-id");
     22    System.exit(1);
     23    }
    2024
    2125    public static void main(String[] args) {
    2226        try {
    23             VirusTotalConfig.getConfigInstance().setVirusTotalAPIKey("09311639ef4193fc22faa35d493a5bf12dc44844a55f03812e40bd1a16fd7b6f");
     27        String apiKey = null;
     28        String resourceID = null;
     29       
     30        if (args.length==2) {
     31        apiKey = args[0];
     32        resourceID = args[1];
     33        }
     34        else {
     35        printUsage();
     36        }
     37       
     38            VirusTotalConfig.getConfigInstance().setVirusTotalAPIKey(apiKey);
    2439            VirustotalPublicV2 virusTotalRef = new VirustotalPublicV2Impl();
    2540   
    26         String resourceID = null;
    27         resourceID = args[0];
    2841            FileScanReport report = virusTotalRef.getScanReport(resourceID);
    2942
Note: See TracChangeset for help on using the changeset viewer.