Skip to content

Instantly share code, notes, and snippets.

@marinbek
Created September 26, 2018 14:28
Show Gist options
  • Save marinbek/6c4919f6ccb53f170494bbee5b125b92 to your computer and use it in GitHub Desktop.
Save marinbek/6c4919f6ccb53f170494bbee5b125b92 to your computer and use it in GitHub Desktop.
Save a string of HEXs into a bin file and curl it away
import binascii
data = '4b4344'
with open('bla.bin', 'wb') as fout:
for hex in [data[i:i+2] for i in range(0, len(data), 2)]:
fout.write(binascii.unhexlify(hex))
# now send it with curl -X POST --data-binary @bla.bin http://foo.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment