Skip to content

Instantly share code, notes, and snippets.

@Bobbias
Created May 4, 2012 07:19
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 Bobbias/2592829 to your computer and use it in GitHub Desktop.
Save Bobbias/2592829 to your computer and use it in GitHub Desktop.
For converting hex text to bin data for 0x10c ARG
import string
from bitstring import BitStream, BitArray
in_file = open("dump.log", "r")
out_file = open("dump.bin", "w")
text = in_file.read()
in_file.close()
split_text = text.splitlines()
for line in split_text:
blocks = line.split(' ')
for block in blocks:
b = BitArray(hex=block)
out_file.write(b.tobytes())
raw_input()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment