Changeset 33716


Ignore:
Timestamp:
2019-11-22T10:43:02+13:00 (4 years ago)
Author:
davidb
Message:

Changed to also write out resource id as file, based on inputFileName

File:
1 edited

Legend:

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

    r33708 r33716  
    2222    String apiKey = null;
    2323    String inputFileName = null;
     24    String outputFileName = null;
    2425   
    2526    boolean printall=false;
     
    4748    }
    4849
     50    //outputFileName = ".virustotal-resource-id-" + inputFileName;
     51    outputFileName = inputFileName + "-VIRUSTOTAL-RESOURCEID";
     52   
    4953    try {
    5054   
     
    6064        System.exit(6);
    6165        }
    62         if (printall){
     66        if (printall) {
    6367            System.out.println("___SCAN INFORMATION___");
    6468                System.out.println("MD5 :\t" + scanInformation.getMd5());
     
    7478
    7579        }
     80        else {
     81        String resource_id = scanInformation.getResource();
     82               
     83        System.out.println(resource_id);
    7684
    77         else {
    78         System.out.println(scanInformation.getResource());
     85        PrintWriter writer = new PrintWriter(outputFileName, "UTF-8");
     86        writer.println(resource_id);
     87        writer.close();     
    7988        }
    8089       
     
    8897            System.err.println("Invalid API Key " + ex.getMessage());
    8998            System.exit(4);
     99        } catch (IOException ex) {
     100                System.err.println("IO error:" + ex.getMessage());
     101        System.exit(5);
    90102        } catch (Exception ex) {
    91103            System.err.println("Something Bad Happened! " + ex.getMessage());
    92         System.exit(5);
     104        System.exit(6);
    93105        }
    94106    }
Note: See TracChangeset for help on using the changeset viewer.