SearchBin icon indicating copy to clipboard operation
SearchBin copied to clipboard

Output match content when pattern contains wildcards.

Open BobCu opened this issue 5 years ago • 1 comments

I want to iteratively build patterns, and having to use a second tool (a hex editor/viewer) to see what was found shouldn't be needed.

Here's a code snippet that worked for me:

# Print matched offset.
find_offset = offset + match
if len(pattern) > 1:		# Also print match string when pattern contains wildcards
	mstr = ' '.join("%02x" % ord(x) for x in buffer[match:match+len_pattern])
	STDOUT.write("Match (%s) at offset: %14d %12X in  %s\n" % ( mstr, find_offset, find_offset, fh_name ))
else:
	STDOUT.write("Match at offset: %14d %12X in  %s\n" % ( find_offset, find_offset, fh_name ))

Yes, I should do a branch and a pull request, but we can't work on public repos without permission (due to IP concerns).

BobCu avatar Oct 25 '18 15:10 BobCu

Apologies for the late reply. I will review it. Thank you for your contribution. :)

Sepero avatar Mar 19 '19 10:03 Sepero