From e2261e88efa9c718388bfee3e3b04bb55cff0274 Mon Sep 17 00:00:00 2001 From: V3in <93438059+V3innn@users.noreply.github.com> Date: Fri, 23 Feb 2024 01:33:32 +0200 Subject: [PATCH 1/2] Update pattern.py Just to be able to work efficient for both x32 bit architectures and x64 ! Nice work! --- pattern.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pattern.py b/pattern.py index aadca7d..e6bfb29 100644 --- a/pattern.py +++ b/pattern.py @@ -2,15 +2,17 @@ import sys import logging -p = cyclic(20000,n=8) -if len(sys.argv) < 2: - logging.error('usage: python3 pattern.py 0xdeadbeef') +if len(sys.argv) < 3: + logging.error('usage: python3 pattern.py
') exit() address = sys.argv[1] +n = int(sys.argv[2]) + +p = cyclic(20000, n=n) + if '0x' in address: address = address[2:] my_string = bytes.fromhex(address).decode('utf-8') my_string = my_string[::-1] print(f'padding is : {p.index(my_string.encode())}') - From 88b5fefc2f03382cce04ce06914100f85ff17661 Mon Sep 17 00:00:00 2001 From: V3in <93438059+V3innn@users.noreply.github.com> Date: Fri, 23 Feb 2024 01:44:05 +0200 Subject: [PATCH 2/2] Update pattern.py --- pattern.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pattern.py b/pattern.py index e6bfb29..5267c2b 100644 --- a/pattern.py +++ b/pattern.py @@ -2,12 +2,12 @@ import sys import logging -if len(sys.argv) < 3: - logging.error('usage: python3 pattern.py
') +if len(sys.argv) < 2: + logging.error('usage: python3 pattern.py 0xdeadbeef [n=8]') exit() address = sys.argv[1] -n = int(sys.argv[2]) +n = int(sys.argv[2]) if len(sys.argv) > 2 else 8 # Default to n=8 if not provided p = cyclic(20000, n=n)