Skip to content

Instantly share code, notes, and snippets.

@DanaEpp
Last active May 10, 2021 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanaEpp/bf46466a0759d6708843d1cb8b2f4fdd to your computer and use it in GitHub Desktop.
Save DanaEpp/bf46466a0759d6708843d1cb8b2f4fdd to your computer and use it in GitHub Desktop.
Quick script to generate badchars array during exploit development
#!/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")
@DanaEpp
Copy link
Author

DanaEpp commented May 10, 2021

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