Skip to content

Instantly share code, notes, and snippets.

@bjoern-r
Created November 2, 2014 11:45
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 bjoern-r/d5ff578eb024c458f737 to your computer and use it in GitHub Desktop.
Save bjoern-r/d5ff578eb024c458f737 to your computer and use it in GitHub Desktop.
convert hex to binary in python.
#copied from http://ctfcrew.org/writeup/90
f = open('openwrt-wrtsl54gs-squashfs.hex', 'r')
w = open('openwrt-wrtsl54gs-squashfs.bin', 'wb')
lines = f.readlines()
for l in lines:
w.write(l.strip('\n').decode('hex'))
w.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment