Skip to content

Instantly share code, notes, and snippets.

@snydergd
Created September 26, 2018 21:17
Show Gist options
  • Save snydergd/233ae0759ace1500e84a9ff6f23d1494 to your computer and use it in GitHub Desktop.
Save snydergd/233ae0759ace1500e84a9ff6f23d1494 to your computer and use it in GitHub Desktop.
Python hex dump snippet
#!/bin/env python
import sys
import string
while True:
b = sys.stdin.read(16)
if not b:
break
print "".join(map(lambda x: "%02x " % x, map(ord, b))) + " " + "".join(map(lambda x: x if x in string.printable else chr(0xA7), b)).replace('\t',' ')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment