Created
September 26, 2018 21:17
-
-
Save snydergd/233ae0759ace1500e84a9ff6f23d1494 to your computer and use it in GitHub Desktop.
Python hex dump snippet
This file contains 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
#!/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