Skip to content

Instantly share code, notes, and snippets.

@fser
Last active August 29, 2015 14:00
Show Gist options
  • Save fser/11408696 to your computer and use it in GitHub Desktop.
Save fser/11408696 to your computer and use it in GitHub Desktop.
can be used to extract ogg from https://github.com/usrbinnc/netcat-cpi-kernel-module's headers files
#!/usr/bin/env python
from binascii import unhexlify
import sys
l = len(sys.argv) - 1
inf = ''
outf = ''
if l == 0:
print "need to provide a file"
sys.exit(1)
elif l == 1:
inf = sys.argv[1]
outf = inf.replace('.h', '.ogg')
elif l == 2:
inf,outf = sys.argv[1],sys.argv[2]
f=file(inf).read().replace('0x','').replace('\n', '').replace(',', '')
f2 = open(outf, 'w')
f2.write(unhexlify(f))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment