Merging work from Michael
This commit is contained in:
parent
1971d427a2
commit
96d88a6bc9
30
Beginning.py
30
Beginning.py
|
@ -1,21 +1,15 @@
|
||||||
import struct
|
from struct import unpack
|
||||||
import binascii
|
|
||||||
|
#Is File a SOS DRIVER file?
|
||||||
SOSfile = open('SOSCFFA.DRIVER', 'rb')
|
SOSfile = open('SOSCFFA.DRIVER', 'rb')
|
||||||
try:
|
SOS = SOSfile.read(10)
|
||||||
SOS = SOSfile.read()
|
filetype, offset = unpack('< 8s H', SOS)
|
||||||
finally:
|
print "Filetype is: %s. Offset is: %04x" % (filetype, offset)
|
||||||
SOSfile.close()
|
|
||||||
|
|
||||||
# encode file as hexadecimal
|
#Seek to first driver
|
||||||
SOSHex = SOS.encode('hex_codec')
|
SOSfile.seek(offset,1)
|
||||||
|
SOS = SOSfile.read(2) # Read two bytes
|
||||||
|
marker = unpack('< H', SOS)
|
||||||
|
if marker == \x0000 :
|
||||||
|
|
||||||
#Search for 0x2205 byte pair
|
SOSfile.close()
|
||||||
print 'Searching for first bytepair...'
|
|
||||||
SOSfindbyte = SOSHex.find('2205')
|
|
||||||
print 'I found it.'
|
|
||||||
|
|
||||||
#Reorder for Little Endian
|
|
||||||
MSB = SOSHex[SOSfindbyte+2:SOSfindbyte+4]
|
|
||||||
LSB = SOSHex[SOSfindbyte:SOSfindbyte+2]
|
|
||||||
|
|
||||||
print "In File: " + LSB, MSB + "\nLittle Endian: " + MSB, LSB
|
|
||||||
|
|
Loading…
Reference in New Issue