if args.capture != '': sys.stdout = open(args.capture, "w") sys.stderr = sys.stdout # Convert command line options into options for the lifter. lifting_options = { "locals": args.locals, "solver": "pharos", "entry": "main", "cgc": False, "nongoal": args.nongoal } # Decompile using Radare2. start = time.time() decompile_info = decompiler.decompile_binary(args.file, lifting_options.get("entry")) print("Decompiling took %7.5f seconds." % (time.time() - start)) # Lift into LLVM. start = time.time() module = lifter.lift_binary(decompile_info, args.file, lifting_options) print("Lifting took %7.5f seconds." % (time.time() - start)) # Verify? start = time.time() verifier.verify(module) print("Verifying took %7.5f seconds." % (time.time() - start)) # Create a temporary file to hold the LLVM results. if args.llvm_file != '': llvm_file = args.llvm_file
goal = "nongoal" file_list = list(check_non_goal.keys()) check = check_non_goal else: goal = "goal" file_list = list(check_goal.keys()) check = check_goal if not os.path.exists("tests/results"): os.mkdir("tests/results", mode=0o777) for file in file_list: try: print("Decompiling " + file + "...", end="") filename = file_path + file decompile_info = decompiler.decompile_binary( filename, lifting_options.get("entry")) print("Done.") print("Lifting " + file + "...", end="") module = lifter.lift_binary(decompile_info, file, lifting_options) print("Done.") print("Verifying " + file + "...", end="") verifier.verify(module) print("Done.") print("Compiling " + file + "...", end="") verifier.compile_ir(module) print("Done.") if file in check: solve = "chc" run1 = "; RUN: %sea pf --bv-chc --inline -O0 \"%s\" 2>&1 | OutputCheck %s --comment=\\;\n" run2 = "; RUN: %sea pf --bv-chc --inline -O1 \"%s\" 2>&1 | OutputCheck %s --comment=\\;\n" run3 = "; RUN: %sea pf --bv-chc --inline -O2 \"%s\" 2>&1 | OutputCheck %s --comment=\\;\n"