def test_rules3(self): parsed_snippet = json.loads(file_get_contents(os.getcwd() + "/tests/slice10/slice10.json")) parsed_rules = json.loads(file_get_contents(os.getcwd() + "/tests/slice10/rules3.json")) output = open(os.getcwd() + "/tests/slice10/slice10_rules3.out", "r") vulnerabilities = Vulnerability.build_vulnerabilities(parsed_rules) s = Searcher(parsed_snippet['body'], vulnerabilities) self.assertEqual(s.get_vulnerabilities_str(), output.read(), "Should be equal") output.close()
def main(argv): parsed_snippet = json.loads(file_get_contents(argv[0])) parsed_rules = json.loads(file_get_contents(argv[1])) vulnerabilities = Vulnerability.build_vulnerabilities(parsed_rules) s = Searcher(parsed_snippet['body'], vulnerabilities) f = open("output.json", "w+") f.write(s.get_vulnerabilities_str())