private static void bySeverity(string ozasmtFile, IO2Assessment o2Assessment, int severity, string scanType) { O2Cmd.log.write("\n> Filtering by {0} \n", scanType); var filteredO2Findings = from IO2Finding finding in o2Assessment.o2Findings where finding.severity == severity select finding; OzasmtLinqUtils.saveFindings(filteredO2Findings, ozasmtFile, scanType); }
private static void byConfidence(string ozasmtFile, IO2Assessment o2Assessment, int confidence, string scanType) { O2Cmd.log.write("\n> Filtering by {0} \n", scanType); var filteredO2Findings = from IO2Finding finding in o2Assessment.o2Findings where finding.confidence == confidence select finding; OzasmtLinqUtils.saveFindings(filteredO2Findings, ozasmtFile, scanType); }
// function consumed from Ozasmt.UniqueFindings function public static void removeDuplicateTypeIIsFromAssessment(IO2Assessment o2Assessment) { O2Cmd.log.write("\n Removing duplicate Type II findings"); var findingsByActionObjectFileAndLineNumber = groupFindingsByActionObjectIdFileNameAndLineNumber(o2Assessment.o2Findings); var findingsToRemove = getFindingsToRemove(findingsByActionObjectFileAndLineNumber); removeFindingsFromAssessment(o2Assessment, findingsToRemove); OzasmtLinqUtils.saveFindings(findingsToRemove, "", "duplicateFindings"); //new O2Assessment(findingsToRemove).save(new O2AssessmentSave_OunceV6(),ozasmtToSaveDuplicatedFindings); O2Cmd.log.write(""); }
// function used in the Removing Duplicate Type IIs.pdf document public static void removeTypeIIs(string ozasmtToProcess) { O2Cmd.log.write("This function will remove duplicate Type IIs"); var o2Assessment = OzasmtLinqUtils.getO2Assessment(ozasmtToProcess); O2Cmd.log.write("There are {0} findings in the ozasmt file loaded", o2Assessment.o2Findings.Count); var findingsByActionObjectFileAndLineNumber = groupFindingsByActionObjectIdFileNameAndLineNumber(o2Assessment.o2Findings); //listFindingsMappings(findingsByActionObjectFileAndLineNumber); var findingsToRemove = getFindingsToRemove(findingsByActionObjectFileAndLineNumber); removeFindingsFromAssessment(o2Assessment, findingsToRemove); saveAssessment(o2Assessment); saveFindingsAsNewAssessment(findingsToRemove); }
public static void oneFilePerConfidence(string ozasmtFile) { IO2Assessment o2Assessment = OzasmtLinqUtils.getO2Assessment(ozasmtFile); if (o2Assessment == null) { return; } O2Cmd.log.write("--> Executing Filter: Create one assessment file per Vulnerability Type (Vulnerability, Type I and Type II"); byConfidence(ozasmtFile, o2Assessment, 1, "Only Vulnerabilities"); byConfidence(ozasmtFile, o2Assessment, 2, "Only Type I"); byConfidence(ozasmtFile, o2Assessment, 3, "Only TYpe II"); }
public static void onlyVulnerabilities(string ozasmtFile) { IO2Assessment o2Assessment = OzasmtLinqUtils.getO2Assessment(ozasmtFile); if (o2Assessment == null) { return; } O2Cmd.log.write("#) Executing Filter: : Create assessment with only Findings with Vulnerabilities"); var filteredO2Findings = from IO2Finding finding in o2Assessment.o2Findings where finding.confidence == 1 select finding; OzasmtLinqUtils.saveFindings(filteredO2Findings, ozasmtFile, "Only Vulnerabilities"); }
public static void oneFilePerSeverity(string ozasmtFile) { IO2Assessment o2Assessment = OzasmtLinqUtils.getO2Assessment(ozasmtFile); if (o2Assessment == null) { return; } O2Cmd.log.write("--> Executing Filter: Create one assessment file per Severity Type (High, Medium, Low, Info"); bySeverity(ozasmtFile, o2Assessment, 0, "Only High"); bySeverity(ozasmtFile, o2Assessment, 1, "Only Medium"); bySeverity(ozasmtFile, o2Assessment, 2, "Only Low"); bySeverity(ozasmtFile, o2Assessment, 3, "Only Info"); }
public static void onlyHighs(string ozasmtFile) { OzasmtLinqUtils.applyFilterToAssessmentFileAndSaveResult(ozasmtFile, onlyHighs, "Only Highs"); }
public static void allFindings(string ozasmtFile) { OzasmtLinqUtils.applyFilterToAssessmentFileAndSaveResult(ozasmtFile, allFindings, "All Findings"); }
public static void noTraces(string ozasmtFile) { OzasmtLinqUtils.applyFilterToAssessmentFileAndSaveResult(ozasmtFile, noTraces, "No Traces"); }
/*public static void uniqueTraces(string ozasmtFile) * { * uniqueTraces(ozasmtFile, ""); * }*/ public static void uniqueTraces(string ozasmtFile)//, string uniqueNameFilter) { OzasmtLinqUtils.applyFilterToAssessmentFileAndSaveResult(ozasmtFile, uniqueTraces, "Unique Traces", true); }