def main(): global function_timeout global use_ghidra parser = argparse.ArgumentParser() parser.add_argument("FILE", help="File or folder to analyze") parser.add_argument("-L", "--LD_PATH", default="", help="Path to libraries to load") parser.add_argument("-D", "--DUMP_PATH", default="Vulnerable_Functions", help="Pickle name to dump JSON") parser.add_argument("-e", "--elastic", default=False, help="Use elastic search database", action="store_true") parser.add_argument("--delete_index", default=False, help="Delete elastic index", action="store_true") parser.add_argument("--use_radare2", dest="use_ghidra", default=True, action="store_false", help="Use radare2 instead of ghidra for analysis") parser.add_argument( "--function_timeout", "-ft", default=function_timeout, type=int, help="Default analysis timeout per function : {}".format( function_timeout)) args = parser.parse_args() global use_elastic global es use_elastic = args.elastic es = eh.get_es() if use_elastic: eh.build_index(es, eh.vulnerability_index, args.delete_index) eh.build_index(es, eh.function_index, args.delete_index) function_timeout = args.function_timeout use_ghidra = args.use_ghidra file_vulnerabilities = process_file_or_folder(args.FILE, args.LD_PATH) dump_results(file_vulnerabilities, args.DUMP_PATH)
def main(): parser = argparse.ArgumentParser() parser.add_argument("FILE", help="File or folder to analyze") parser.add_argument("-L", "--LD_PATH", default="", help="Path to libraries to load") parser.add_argument("-D", "--DUMP_PATH", default="Vulnerable_Pickle", help="Pickle name to dump JSON") parser.add_argument("-e", "--elastic", default=False, help="Use elastic search database", action="store_true") parser.add_argument("--delete_index", default=False, help="Delete elastic index", action="store_true") args = parser.parse_args() global use_elastic global es use_elastic = args.elastic es = eh.get_es() if use_elastic: eh.build_index(es, eh.vulnerability_index, args.delete_index) eh.build_index(es, eh.function_index, args.delete_index) global fh if use_ghidra: from firmware_slap import ghidra_handler fh = ghidra_handler else: from firmware_slap import function_handler fh = function_handler file_vulnerabilities = process_file_or_folder(args.FILE, args.LD_PATH) with open(args.DUMP_PATH, 'wb') as f: pickle.dump(file_vulnerabilities, f, -1)
def main(): parser = argparse.ArgumentParser() parser.add_argument("FILE", help="File or folder to analyze") parser.add_argument("-L", "--LD_PATH", default="", help="Path to libraries to load") parser.add_argument("-D", "--DUMP_PATH", default="Vulnerable_Functions", help="Pickle name to dump JSON") parser.add_argument("-e", "--elastic", default=False, help="Use elastic search database", action="store_true") parser.add_argument("--delete_index", default=False, help="Delete elastic index", action="store_true") args = parser.parse_args() global use_elastic global es use_elastic = args.elastic es = eh.get_es() if use_elastic: eh.build_index(es, eh.vulnerability_index, args.delete_index) eh.build_index(es, eh.function_index, args.delete_index) file_vulnerabilities = process_file_or_folder(args.FILE, args.LD_PATH) dump_results(file_vulnerabilities, args.DUMP_PATH)