Ejemplo n.º 1
0
        static bool Extract()
        {
            Dictionary <string, object> extract_options = new Dictionary <string, object>();

            foreach (PropertyInfo prop in ExtractOptions.GetType().GetProperties())
            {
                extract_options.Add(prop.Name, prop.GetValue(ExtractOptions));
            }
            ExtractStage ES = new ExtractStage(Log.Logger, ExtractOptions.Extractor, extract_options);

            return(ES.Extractor != null && ES.Extractor.Initialised);
        }
Ejemplo n.º 2
0
 static bool Extract()
 {
     ExtractOutputFile = new FileInfo(ExtractOptions.OutputFile + (ExtractOptions.CompressOutputFile ? ".json.gz" : ".json"));
     if (ExtractOutputFile.Exists)
     {
         if (!(ExtractOptions.OverwriteOutputFile || ExtractOptions.AppendToOutputFile))
         {
             L.Error("The JSON output file {0} exists. Use the --overwrite flag to overwrite an existing file or --append to append extracted records to the existing file.", ExtractOutputFile.FullName);
             Exit(ExitResult.OUTPUT_FILE_EXISTS);
         }
         else if (ExtractOptions.OverwriteOutputFile)
         {
             L.Information("Existing file {0} will be overwritten.", ExtractOutputFile.FullName);
         }
         else
         {
             L.Information("Existing file {0} will be appended to.", ExtractOutputFile.FullName);
         }
     }
     else
     {
         L.Information("Using JSON output file {0}.", ExtractOutputFile.FullName);
     }
     try
     {
         List <string> parameters = ExtractOptions.ExtractParameters.ToList();
         ExtractStage  e          = new ExtractStage(ExtractOptions.Extractor, ExtractOutputFile, ExtractOptions.OverwriteOutputFile, ExtractOptions.AppendToOutputFile,
                                                     ExtractOptions.CompressOutputFile, ExtractOptions.Authentication, L, parameters);
         return(e.Run(ExtractOptions.VulnerabilitiesLimit, null));
     }
     catch (Exception e)
     {
         L.Error(e, "Exception thrown during extract stage.");
         return(false);
     }
 }