Created
October 8, 2014 01:38
-
-
Save TylerOderkirk/b0c7dcf9d0dac0e434d1 to your computer and use it in GitHub Desktop.
Firmware dissector for OBi100 VoIP Telephone Adapter
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, binascii, struct | |
def main(argv=None): | |
for offset in [0x200, 0x10100, 0x20100, 0x30100, 0x40100, 0x50100, 0x60100, 0x70100, 0x80100, 0x90100]: | |
f=open(sys.argv[1], 'rb') | |
extract_httpd_resource_files(offset,f) | |
for offset in [0x95a15, 0xdd485]: | |
f=open(sys.argv[1], 'rb') | |
extract_unknown_resource_files(offset,f) | |
def extract_unknown_resource_files(offset, f): | |
f.read(offset) | |
print hex(f.tell()), "==", f.tell() | |
while '\xFF\xFF\xFF\xFF\x00' == f.read(5): | |
f.read(1) # usually 00, saw an 01 | |
rec_len, = struct.unpack('>H', f.read(2)) | |
print "rec_len:", rec_len | |
record_content = f.read(rec_len) | |
fout=open("unk_res_out/%08d.bin" % f.tell(), 'wb') | |
fout.write(record_content) | |
fout.close() | |
print "-----didn't find FF FF FF FF 00 at", hex(f.tell()-5) | |
# for i in *.bin; do python ~/src/bin2bmp.py --width 16 "${i}"; convert "${i}".jpg -scale 500% "${i}".png; done | |
def extract_httpd_resource_files(offset, f): | |
f.read(offset) | |
print hex(f.tell()) | |
while '\xf3' == f.read(1): | |
filename_len, = struct.unpack('>b', f.read(1)) | |
print "filename_len:", filename_len | |
file_len, = struct.unpack('>H', f.read(2)) | |
print " file_len:", file_len | |
filename = str(f.read(filename_len)) | |
print " filename:", filename | |
file_content=f.read(file_len) | |
fout=open("httpd_res_out/" + filename, 'wb') | |
fout.write(file_content) | |
fout.close() | |
print "-----didn't find 0xF3 at", hex(f.tell()-1) | |
if __name__ == '__main__': | |
sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You get any further looking into that Obi fw?