From 08c64e484920966adada7b6cbaf222449f9d4d7b Mon Sep 17 00:00:00 2001 From: ultramagnus_tcv Date: Tue, 29 Sep 2015 20:17:26 -0500 Subject: [PATCH] Updated function based on some advice. --- 3Slurp.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/3Slurp.py b/3Slurp.py index bded13f..39bc967 100644 --- a/3Slurp.py +++ b/3Slurp.py @@ -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