From 262c54f12ecc379c154675b75828ebfa6b4f6fc8 Mon Sep 17 00:00:00 2001 From: michelerenzullo <76132686+michelerenzullo@users.noreply.github.com> Date: Thu, 17 Dec 2020 13:51:06 +0100 Subject: [PATCH 1/2] Update searchbin.py added option to see the matched pattern when you use wildcard "??" --- searchbin.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/searchbin.py b/searchbin.py index be96f0b..62e2c36 100755 --- a/searchbin.py +++ b/searchbin.py @@ -313,7 +313,7 @@ def _debug_search(pattern, fh_name, fh_read): buffer += fh_read(read_size) match = regex.search(buffer) else: - STDOUT.write("Match at offset: %14d %12X in %s\n" % ( + STDOUT.write("Match at offset: %14d decimal %12X hex in %s\n" % ( offset+match.start(), offset+match.start(), fh_name)) match = regex.search(buffer, match.start()+1) @@ -374,8 +374,11 @@ def _search_loop(start, end, bsize, pattern, max_matches, # Print matched offset. find_offset = offset + match - STDOUT.write("Match at offset: %14d %12X in %s\n" % ( - find_offset, find_offset, fh_name)) + if bytes(".", 'utf-8') in pattern: # see the matched pattern when you use wildcard ?? ("?" -> ".") + mstr = ' '.join(format(x, "02X") for x in buffer[match:match+len_pattern]) + STDOUT.write("Match (%s) at offset: %14d decimal %12X hex in %s\n" % ( mstr, find_offset, find_offset, fh_name )) + else: + STDOUT.write("Match at offset: %14d decimal %12X hex in %s\n" % ( find_offset, find_offset, fh_name)) if max_matches: max_matches -= 1 From d6ed249467afa42e609e47ba9e77d97291ff9e07 Mon Sep 17 00:00:00 2001 From: michelerenzullo <76132686+michelerenzullo@users.noreply.github.com> Date: Thu, 17 Dec 2020 13:55:52 +0100 Subject: [PATCH 2/2] Update README update features list --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 7283708..b8c493a 100644 --- a/README +++ b/README @@ -105,6 +105,7 @@ Features: +Requires Python 2.7 or Python 3 +Less code +Search in files of unlimited size ++See the matched pattern when you use wildcard "??" keywords: hex hexidecimal binary like grep search seek find fast Please report bugs & feature requests to sepero 111 @ gmx . com