From 5a9999c5c44ef48e10385aeb1ede9185f85325bc Mon Sep 17 00:00:00 2001 From: Anna Clemens Date: Tue, 4 Jan 2022 03:30:43 -0500 Subject: [PATCH] fix: pull out masks from loop --- sig_checker.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sig_checker.py b/sig_checker.py index fc181d8..3a4a74e 100755 --- a/sig_checker.py +++ b/sig_checker.py @@ -80,15 +80,15 @@ def validate(): result_count = 0 sig_addr = text.start_ea + # Expects a byte array + fmt_sig = [int(s, 16).to_bytes(1, 'little') if s != '??' else b'\0' for s in sig.split(' ')] + fmt_sig = b''.join(fmt_sig) + + # Another byte array, 0 = "??" wildcard + sig_mask = [int(b != '??').to_bytes(1, 'little') for b in sig.split(' ')] + sig_mask = b''.join(sig_mask) + while True: - # Expects a byte array - fmt_sig = [int(s, 16).to_bytes(1, 'little') if s != '??' else b'\0' for s in sig.split(' ')] - fmt_sig = b''.join(fmt_sig) - - # Another byte array, 0 = "??" wildcard - sig_mask = [int(b != '??').to_bytes(1, 'little') for b in sig.split(' ')] - sig_mask = b''.join(sig_mask) - sig_addr = idaapi.bin_search( sig_addr, text.end_ea,