def test_npm_audit_parser_without_file_has_no_findings(self): parser = NpmAuditParser(None, Test()) self.assertEqual(0, len(parser.items))
def import_parser_factory(file, test, scan_type=None): if scan_type is None: scan_type = test.test_type.name if scan_type == "Burp Scan": parser = BurpXmlParser(file, test) elif scan_type == "Nessus Scan": filename = file.name.lower() if filename.endswith("csv"): parser = NessusCSVParser(file, test) elif filename.endswith("xml") or filename.endswith("nessus"): parser = NessusXMLParser(file, test) elif scan_type == "Clair Scan": parser = ClairParser(file, test) elif scan_type == "Nmap Scan": parser = NmapXMLParser(file, test) elif scan_type == "Nikto Scan": parser = NiktoXMLParser(file, test) elif scan_type == "Nexpose Scan": parser = NexposeFullXmlParser(file, test) elif scan_type == "Veracode Scan": parser = VeracodeXMLParser(file, test) elif scan_type == "Checkmarx Scan": parser = CheckmarxXMLParser(file, test) elif scan_type == "Contrast Scan": parser = ContrastCSVParser(file, test) elif scan_type == "Crashtest Security Scan": parser = CrashtestSecurityXmlParser(file, test) elif scan_type == "Bandit Scan": parser = BanditParser(file, test) elif scan_type == "ZAP Scan": parser = ZapXmlParser(file, test) elif scan_type == "AppSpider Scan": parser = AppSpiderXMLParser(file, test) elif scan_type == "Arachni Scan": parser = ArachniJSONParser(file, test) elif scan_type == 'VCG Scan': parser = VCGParser(file, test) elif scan_type == 'Dependency Check Scan': parser = DependencyCheckParser(file, test) elif scan_type == 'Retire.js Scan': parser = RetireJsParser(file, test) elif scan_type == 'Node Security Platform Scan': parser = NspParser(file, test) elif scan_type == 'NPM Audit Scan': parser = NpmAuditParser(file, test) elif scan_type == 'Generic Findings Import': parser = GenericFindingUploadCsvParser(file, test) elif scan_type == 'Qualys Scan': parser = QualysParser(file, test) elif scan_type == 'Qualys Webapp Scan': parser = QualysWebAppParser(file, test) elif scan_type == "OpenVAS CSV": parser = OpenVASUploadCsvParser(file, test) elif scan_type == 'Snyk Scan': parser = SnykParser(file, test) elif scan_type == 'SKF Scan': parser = SKFCsvParser(file, test) elif scan_type == 'SSL Labs Scan': parser = SSLlabsParser(file, test) elif scan_type == 'Trufflehog Scan': parser = TruffleHogJSONParser(file, test) elif scan_type == 'Clair Klar Scan': parser = ClairKlarParser(file, test) elif scan_type == 'Gosec Scanner': parser = GosecScannerParser(file, test) elif scan_type == 'Trustwave Scan (CSV)': parser = TrustwaveUploadCsvParser(file, test) elif scan_type == 'Netsparker Scan': parser = NetsparkerParser(file, test) elif scan_type == 'PHP Security Audit v2': parser = PhpSecurityAuditV2(file, test) elif scan_type == 'Acunetix Scan': parser = AcunetixScannerParser(file, test) elif scan_type == 'Fortify Scan': parser = FortifyXMLParser(file, test) elif scan_type == 'SonarQube Scan': parser = SonarQubeHtmlParser(file, test) elif scan_type == 'MobSF Scan': parser = MobSFParser(file, test) elif scan_type == 'AWS Scout2 Scan': parser = AWSScout2Parser(file, test) elif scan_type == 'AWS Prowler Scan': parser = AWSProwlerParser(file, test) elif scan_type == 'Brakeman Scan': parser = BrakemanScanParser(file, test) elif scan_type == 'SpotBugs Scan': parser = SpotbugsXMLParser(file, test) elif scan_type == 'Safety Scan': parser = SafetyParser(file, test) else: raise ValueError('Unknown Test Type') return parser
def test_npm_audit_parser_with_many_vuln_has_many_findings(self): testfile = open("dojo/unittests/scans/npm_audit_sample/many_vuln.json") parser = NpmAuditParser(testfile, Test()) testfile.close() self.assertEqual(5, len(parser.items))