Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output match content when pattern contains wildcards. #5

Open
BobCu opened this issue Oct 25, 2018 · 1 comment
Open

Output match content when pattern contains wildcards. #5

BobCu opened this issue Oct 25, 2018 · 1 comment

Comments

@BobCu
Copy link

BobCu commented Oct 25, 2018

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).

@Sepero
Copy link
Owner

Sepero commented Mar 19, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants