diff --git a/Driv3rs.py b/Driv3rs.py index fed9a65..825268f 100644 --- a/Driv3rs.py +++ b/Driv3rs.py @@ -2,7 +2,7 @@ from struct import unpack; import argparse import hashlib import os.path - + parser = argparse.ArgumentParser( prog='Driv3rs.py', formatter_class=argparse.RawDescriptionHelpFormatter, @@ -12,6 +12,7 @@ parser = argparse.ArgumentParser( * imaged Apple /// disks. By Mike Whalen, Michael Sternberg * * and Paul Hagstrom. Please submit pull requests to Github. * * https://github.com/thecompu/Driv3rs * +* Special Thanks to Rob Justice for Bug Fixes and Suggestions * **************************************************************** ''') group = parser.add_mutually_exclusive_group() @@ -210,7 +211,7 @@ for i in range(0,len(drivers_list)): # and the CFFA3000 and populated a dictionary. This dictionary # will get more k/v pairs as time goes on. mfg = readUnpack(2, type = 'b') - drivers_list[i]['mfg']=mfg + drivers_list[i]['mfg']=mfg # version bytes are integer values stored across two bytes. # a nibble corresponds to a major version number, one of two minor @@ -263,16 +264,28 @@ for i in range(0,len(drivers_list)): # generally we enter each major drive DIB and look at the link field. # if the link field is not 0000, we know there are other DIBs. # we can open up a new loop to run through the interior DIBs until -# we encount a 0000 in a link field, then we stop. +# we encounter a 0000 in a link field, then we stop. for i in range(0,len(drivers_list)): total_devs = 0 SOSfile.seek(drivers_list[i]['dib_start'],0) + sub_sub = "" + drivers_list[i]['subdrivers'] = sub_sub #initialize subdrivers dict k/v sub_loop = True while sub_loop: total_devs = total_devs + 1 - sub_link = readUnpack(2, type = 'b') #link to next DIB + sub_link = readUnpack(2, type = 'b') #link to next DIB if sub_link != 0x0000: SOSfile.seek(drivers_list[i]['dib_start'] + sub_link,0) #link is from DIB start + SOSfile.seek(4,1) #skip over dib Entry pointer + subname_len = readUnpack(1, type = '1') + subname = readUnpack(subname_len, type = 't') + sub_temp = drivers_list[i]['subdrivers'] + if sub_temp != "" and sub_link != 0x0000: + sub_temp = sub_temp + ' ' + '|' + ' ' + subname + drivers_list[i]['subdrivers'] = sub_temp + else: + drivers_list[i]['subdrivers'] = subname + SOSfile.seek(drivers_list[i]['dib_start'] + sub_link,0) else: sub_loop = False drivers_list[i]['num_devices'] = total_devs @@ -287,7 +300,7 @@ exists = os.path.exists(output_csv) if exists == False: csvout = open(output_csv, 'w') csvout.write('SOS_DRIVER_FILE,comment_start,comment_len,comment_txt,' + \ - 'dib_start,link_ptr,entry,name_len,name,flag,slot_num,num_devices,unit,' +\ + 'dib_start,link_ptr,entry,name_len,majorname,flag,slot_num,num_devices,subnames,unit,' +\ 'dev_type,block_num,mfg,version,dcb_length,driver_md5,code_md5\n') else: csvout = open(output_csv, 'a') @@ -295,7 +308,7 @@ else: for i in range(0,len(drivers_list)): csvout.write(disk_img + ',') #comment start hex or decimal - if args.rawhex: + if args.rawhex: csvout.write(hex(drivers_list[i]['comment_start']) + ',') else: csvout.write(str(drivers_list[i]['comment_start']) + ',') @@ -307,7 +320,7 @@ for i in range(0,len(drivers_list)): csvout.write(str(drivers_list[i]['comment_len']) + ',') #comment - csvout.write('"' + drivers_list[i]['comment_txt'] + '"' + ',') + csvout.write('"' + drivers_list[i]['comment_txt'] + '"' + ',') #dib_start hex or decimal if args.rawhex: @@ -340,7 +353,7 @@ for i in range(0,len(drivers_list)): if args.rawhex: csvout.write(hex(drivers_list[i]['flag']) + ',') elif args.rawdec: - csvout.write(str(drivers_list[i]['flag']) + ',') + csvout.write(str(drivers_list[i]['flag']) + ',') else: if drivers_list[i]['flag'] == 192: csvout.write('"' + 'ACTIVE, Load on Boundary' + '"' ',') @@ -361,6 +374,9 @@ for i in range(0,len(drivers_list)): else: csvout.write(str(drivers_list[i]['num_devices']) + ',') +#sub_driver names ascii only + csvout.write(drivers_list[i]['subdrivers'] + ',' ) + #unit hex or decimal if args.rawhex: csvout.write(hex(drivers_list[i]['unit']) + ',') diff --git a/EXAMPLE.OUTPUT.csv b/EXAMPLE.OUTPUT.csv index f1e50b8..86ceacc 100644 --- a/EXAMPLE.OUTPUT.csv +++ b/EXAMPLE.OUTPUT.csv @@ -1,6 +1,9 @@ -SOS_DRIVER_FILE,comment_start,comment_len,comment_txt,dib_start,link_ptr,entry,name_len,name,flag,slot_num,num_devices,unit,dev_type,block_num,mfg,version,dcb_length,driver_md5,code_md5 -EXAMPLE.SOS.DRIVER,1324,0,"None",1328,1086,959,6,.FMTD1,"ACTIVE, Load on Boundary",0,4,0,"Character Device, Write-Only, Formatter",280,Apple Computer,1.10,0,b2a1c11d43f86c8857d243008a40f93f,4d61c0816eaf51db819de7007c83c2df -EXAMPLE.SOS.DRIVER,2708,0,"None",2712,0,267,10,.SILENTYPE,INACTIVE,0,1,0,"Character Device, Write-Only, Silentype",0,Apple Computer,1.04,17,ca6db71e02668bbdad801ec1c3a17fce,3c7a572346944991f88ed502669e249d -EXAMPLE.SOS.DRIVER,7538,0,"None",7542,0,192,8,.PRINTER,ACTIVE,0,1,0,"Character Device, Write-Only, RS232 Printer",0,Apple Computer,1.10,5,cdccaf496ea198eb3aef21b36156c028,719171eb8eb663fb1d21a0809bc44ceb -EXAMPLE.SOS.DRIVER,8444,0,"None",8448,0,266,8,.CONSOLE,ACTIVE,0,1,0,"Character Device, Read-Write, System Console",0,Apple Computer,1.12,0,501be146123c9ae217bca5dba60b9610,9e539ef09c806b44768d4641f3f18922 -EXAMPLE.SOS.DRIVER,13550,78,"Apple /// CFFA3000 (Compact Flash For Apple 3000) Driver by David Schmidt 2011",13632,34,306,11,.CFFA3000D1,ACTIVE,1,8,0,"Block Device, CFFA3000",0,David Schmidt,1.00,0,0f3d973b201027cc64a32dba15d6dc16,c5d1b3a23a2dca59644a58d7441d65f8 +SOS_DRIVER_FILE,comment_start,comment_len,comment_txt,dib_start,link_ptr,entry,name_len,majorname,flag,slot_num,num_devices,subnames,unit,dev_type,block_num,mfg,version,dcb_length,driver_md5,code_md5 +SELECTOR.SOS.DRIVER,1324,57,"Graphics Driver -- Copyright Apple Computer, Inc. 1980-83",1385,0,542,7,.GRAFIX,ACTIVE,0,1,,0,"Character Device, Read-Write, Graphics Screen",0,Apple Computer,1.30,150,b994e229d4bed57e1fa8f74ee0c2b4e8,08940bacf47311e4a57dbc18601f3fbd +SELECTOR.SOS.DRIVER,6836,52,"Audio Driver -- Copyright Apple Computer, Inc. 1980",6892,0,90,6,.AUDIO,ACTIVE,0,1,,0,"Character Device, Write-Only, Sound Port",0,Apple Computer,1.00,0,851f6d79a088d6707615112a721176ad,6a49cbf2e41b0a1ea7caceb378abc968 +SELECTOR.SOS.DRIVER,7554,67,"Disk /// Formatter Driver -- Copyright Apple Computer, Inc. 1980-83",7625,1024,882,6,.FMTD1,"ACTIVE, Load on Boundary",0,4,.FMTD2 | .FMTD3 | .FMTD4,0,"Character Device, Write-Only, Formatter",280,Apple Computer,1.30,0,43d94d124fb815c2bb8c3ad56a7a82f5,ba59588e74343ea5a03667709f944313 +SELECTOR.SOS.DRIVER,8920,76,"Built-in Serial Port RS-232 Driver -- Copyright Apple Computer, Inc. 1981-83",9000,0,626,6,.RS232,ACTIVE,0,1,,0,"Character Device, Read-Write, Onboard RS232",0,Apple Computer,1.30,12,ddc18277ca38785e89e2ccb35b3d4a9e,a3c461333bf93af12cfbb87242d060c0 +SELECTOR.SOS.DRIVER,11291,68,"Parallel Printer Driver -- Copyright (C) 1983 by Apple Computer Inc.",11363,0,311,11,.PARPRINTER,ACTIVE,1,1,,0,"Character Device, Write-Only, Parallel Printer",0,Apple Computer,1.30,5,fdf9f348f02e99b31c150c85997ff3f3,9ef431eedad20c3b9199b375b8ca1289 +SELECTOR.SOS.DRIVER,12435,57,"Silentype driver - Copyright Apple Computer, Inc. 1980-83",12496,0,267,10,.SILENTYPE,ACTIVE,0,1,,0,"Character Device, Write-Only, Silentype",0,Apple Computer,1.04,17,49e5b29e7624c6ba24c4d58205a8e811,7fd8f61392c5f7b9a94328e719051aca +SELECTOR.SOS.DRIVER,17322,78,"Apple /// CFFA3000 (Compact Flash For Apple 3000) Driver by David Schmidt 2011",17404,34,306,8,.PROFILE,ACTIVE,1,8,.CFFA3000D2 | .CFFA3000D3 | .CFFA3000D4 | .CFFA3000D5 | .CFFA3000D6 | .CFFA3000D7 | .CFFA3000D8,0,"Block Device, CFFA3000",0,David Schmidt,1.00,0,f1ea73cf74321e96f30dfb8cbbbaa608,c5d1b3a23a2dca59644a58d7441d65f8 +SELECTOR.SOS.DRIVER,19256,56,"Console Driver -- Copyright Apple Computer, Inc. 1980-83",19316,4003,4125,8,.CONSOLE,ACTIVE,4,2,.MOUSE,0,"Character Device, Read-Write, System Console",0,Apple Computer,1.31,0,932a431aa85d5b203900e0550c2e7fa0,04ef7b41bef10aa53969da421f89e9b3 diff --git a/EXAMPLE.SOS.DRIVER b/EXAMPLE.SOS.DRIVER index 18579a6..b7cc472 100644 Binary files a/EXAMPLE.SOS.DRIVER and b/EXAMPLE.SOS.DRIVER differ