Last active
May 10, 2021 02:00
-
-
Save DanaEpp/bf46466a0759d6708843d1cb8b2f4fdd to your computer and use it in GitHub Desktop.
Quick script to generate badchars array during exploit development
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
sys.stdout.write("badchars = (\n\tb\"") | |
pos = 0 | |
for x in range(0,256): | |
sys.stdout.write( "\\x" + '{0:02x}'.format(x)) | |
if pos == 15: | |
pos = 0 | |
if x < 255: | |
sys.stdout.write("\"\n\tb\"") | |
else: | |
pos += 1 | |
sys.stdout.write("\")\n") |
That first line should probably be:
#!/usr/bin/env python3
Both /bin and /usr/bin will work on most 'nix environments. I've updated to /usr/bin so there isn't confusion for those that don't know both are valid.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That first line should probably be: