Created
August 1, 2016 15:02
-
-
Save brunomgalmeida/8a8f8c9cd838974a292d3736fd0efe2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import os | |
def nextSetting(f): | |
keySize = ord(f.read(1)) | |
key = f.read(keySize) | |
valueSize = ord(f.read(1)) + (ord(f.read(1))*256) | |
value= f.read(valueSize) | |
#sys.stdout.write ('(k=%3d,v=%4d,pos=%6s) %s = %s\n' % (keySize, valueSize, hex(f.tell()), key, value)) | |
sys.stdout.write ('%s = %s\n' % (key, value)) | |
with open ('dd-wrt-nvrambak.bin', 'rb') as f: | |
print f.read(8) # file format/title | |
while f.tell() < os.fstat(f.fileno()).st_size: | |
nextSetting(f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment