diff --git a/minor_patch_diff.py b/minor_patch_diff.py index 8fd874b..9c7d22c 100644 --- a/minor_patch_diff.py +++ b/minor_patch_diff.py @@ -216,9 +216,7 @@ def minor_patch_diff(old_exe, new_exe): opcodes_found = find_opcode_matches(old_opcodes_db, new_opcodes_db) opcodes_object = [] - for k, v in enumerate(opcodes_found): - old, new = v - + for (old, new) in opcodes_found: opcodes_object.append( { "old": [hex(o) for o in old], diff --git a/utils.py b/utils.py index 3f21cab..564b3cb 100644 --- a/utils.py +++ b/utils.py @@ -26,10 +26,15 @@ def sync_r2_output(r2): Read stuff from the process pipe until it stops being stupid. """ + + def set_blocking(fileno, blocking): + if hasattr(os, "set_blocking"): + os.set_blocking(fileno, blocking) + time.sleep(1) - os.set_blocking(r2.process.stdout.fileno(), False) + set_blocking(r2.process.stdout.fileno(), False) p = r2.process.stdout.read(1) - os.set_blocking(r2.process.stdout.fileno(), True) + set_blocking(r2.process.stdout.fileno(), True) output = r2.cmd(f"?vi 123").strip() if output != "123": raise Exception("R2 state never got synced")