Skip to content

Instantly share code, notes, and snippets.

@magnusstubman
Created September 28, 2020 08:55
Show Gist options
  • Save magnusstubman/83e357ae3af21510782598a55d55eb5e to your computer and use it in GitHub Desktop.
Save magnusstubman/83e357ae3af21510782598a55d55eb5e to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
import sys
import fileinput
h = bytes(sys.stdin.buffer.read()).hex()
n = 2
output = ''
for e in [h[i:i+n] for i in range(0, len(h), n)]:
output = output + "\\x" + e
print(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment