Cleaned up code.

This commit is contained in:
ultramagnus_tcv 2015-09-15 16:25:05 -05:00
parent 14c15797f0
commit d0fc9c3f30
1 changed files with 3 additions and 20 deletions

View File

@ -1,15 +1,10 @@
from struct import unpack
import os
def tup2int(tup):
return int('.' . join(str(x) for x in tup))
def tup2int():
SOS = SOSfile.read(2)
def readUnpackAndint(bytes):
SOS = SOSfile.read(bytes)
offset_unpacked = unpack ('< H', SOS)
offset = int('.'.join(str(x) for x in offset_unpacked))
print 'DEBUG: Inside function. Offset is:', hex(offset)
return offset
return int('.'.join(str(x) for x in offset_unpacked))
#Clear SCREEN
print("\033c");
@ -26,10 +21,6 @@ if 'SOS DRVR' in filetype:
else:
print "This is not a proper SOS file"
def readUnpackAndint(bytes):
SOS = SOSfile.read(bytes)
offset_unpacked = unpack ('< H', SOS)
return int('.'.join(str(x) for x in offset_unpacked))
### At this point, we need the first offset to tell us where to jump to
### find the first actual driver.
@ -38,14 +29,6 @@ def readUnpackAndint(bytes):
offset = readUnpackAndint(2)
print "The first offset value is", hex(offset)
### Now we have the offset needed to jump to the first driver. Let's seek
### to that driver using the offset. This is our first jump.
SOSfile.seek(offset,1)
print "This is our new position in the file: ", hex(SOSfile.tell())
offset = readUnpackAndint(2)
print 'New offset is: ' , hex(offset)
### I will establish an indefinite loop that will come around until we
### encounter FF which indicates the last driver. For now, I am manually
### looping to check logic.