Updated function based on some advice.

This commit is contained in:
ultramagnus_tcv 2015-09-29 20:17:26 -05:00
parent 17c9a702ff
commit 08c64e4849
1 changed files with 5 additions and 3 deletions

View File

@ -3,10 +3,12 @@ import os
def readUnpack(bytes, **options):
if options.get("type") == 't':
print 'DEBUG: In t'
SOS = SOSfile.read(bytes)
return unpack('< 8s', SOS)
return unpack('< %ss' % bytes, SOS)
if options.get("type") == 'b':
print 'DEBUG: In b'
SOS = SOSfile.read(bytes)
offset_unpacked = unpack ('< H', SOS)
return int('.'.join(str(x) for x in offset_unpacked))
@ -17,15 +19,15 @@ print("\033c");
#Is File a SOS DRIVER file?
SOSfile = open('SOSCFFA.DRIVER', 'rb')
#SOS = SOSfile.read(8)
#filetype = unpack('< 8s', SOS)
filetype = readUnpack(8, type = 't')
if 'SOS DRVR' in filetype:
print "This is a proper SOS file."
print "Filetype is: %s." % (filetype)
else:
print "Filetype is: %s." % (filetype)
print "This is not a proper SOS file"
exit()
### At this point, we need the first offset to tell us where to jump to