mirror of
https://github.com/thecompu/Driv3rs.git
synced 2025-04-01 04:30:39 +00:00
Added driver counter and dictionaries for hold values.
This commit is contained in:
parent
d0fc9c3f30
commit
308ffd970c
17
3Slurp.py
17
3Slurp.py
@ -28,15 +28,22 @@ else:
|
||||
# Read immediate two bytes after SOS DRVR to establish first offset value.
|
||||
offset = readUnpackAndint(2)
|
||||
print "The first offset value is", hex(offset)
|
||||
drivers = 0 ## This is to keep a running total of drivers.
|
||||
drivers_dict = dict() ## Intialize a dictionary to hold the drivers.
|
||||
|
||||
### 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.
|
||||
### Begin an indefinite loop that will come around until we
|
||||
### encounter FF which indicates the last driver.
|
||||
|
||||
while offset != 65535 :
|
||||
SOSfile.seek(offset,1)
|
||||
print "This is our new position in the file: ", hex(SOSfile.tell())
|
||||
## print "DEBUG: This is our new position in the file: ", hex(SOSfile.tell())
|
||||
offset = readUnpackAndint(2)
|
||||
print 'New offset is: ' , hex(offset)
|
||||
if offset == 0 : ## Check to see if we're at the beginning of a new driver.
|
||||
drivers = drivers + 1 ## And add to count of found drivers.
|
||||
offset = readUnpackAndint(2)
|
||||
drivers_dict ['Driver_'+str(drivers)] = dict([('Offset', hex(offset))])
|
||||
## print 'DEBUG: New offset is: ' , hex(offset)
|
||||
|
||||
SOSfile.close()
|
||||
print 'Total drivers encountered: ', drivers
|
||||
print drivers_dict
|
||||
|
30
Readme.md
30
Readme.md
@ -73,4 +73,32 @@ After reading little pieces about functions throughout the week and playing with
|
||||
|
||||
The function is called inside a while loop that indefinitely executes until the encountered two-byte value is FFFF.
|
||||
|
||||
It's working... more or less.
|
||||
It's working... more or less.
|
||||
|
||||
9/26/2015
|
||||
|
||||
Life sucks. Fucking anxiety. Fucking depression.
|
||||
|
||||
Anyway, I cleaned up a lot of the code and I also implemented a counter for the number of drivers encountered.
|
||||
|
||||
Later, I implemented creating nested dictionaries based upon how many drivers were encountered. I don't know if this type of creation will work as I go back through the drivers to get information on the drivers themselves, but I think it's a good start.
|
||||
|
||||
Current sample run:
|
||||
|
||||
IN: python 3Slurp.py
|
||||
OUT: This is a proper SOS file.
|
||||
Filetype is: SOS DRVR.
|
||||
The first offset value is 0x522
|
||||
Total drivers encountered: 4
|
||||
{'Driver_3': {'Offset': '0x2ea'}, 'Driver_2': {'Offset': '0xeac'}, 'Driver_1': {'Offset': '0x4a4'}, 'Driver_4': {'Offset': '0xf86'}}
|
||||
|
||||
I'll want to wind up with something like this (formatted for easier reading)
|
||||
|
||||
{
|
||||
'Driver_1' :
|
||||
{
|
||||
'Offset' : '0x4a4',
|
||||
'Name' : 'CONSOLE',
|
||||
etc...
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user