@@ -250,7 +250,9 @@ def write_to_spreadsheet(disk_result, spreadsheet_path):
250250
251251# parse arguments
252252parser = argparse .ArgumentParser ()
253+ parser .add_argument ("-e" , "--exportall" , help = "Export all (not only allocated) with tsk_recover" , action = "store_true" )
253254parser .add_argument ("-k" , "--keepfiles" , help = "Retain exported logical files from each disk" , action = "store_true" )
255+ parser .add_argument ("-r" , "--resforks" , help = "Export AppleDouble resource forks from HFS-formatted disks" , action = "store_true" )
254256parser .add_argument ("source" , help = "Path to folder containing disk images" )
255257parser .add_argument ("destination" , help = "Output destination" )
256258args = parser .parse_args ()
@@ -341,10 +343,17 @@ def write_to_spreadsheet(disk_result, spreadsheet_path):
341343 disk_files_dir = os .path .join (files_dir , file )
342344 if not os .path .exists (disk_files_dir ):
343345 os .makedirs (disk_files_dir )
344- try :
345- subprocess .check_output (['tsk_recover' , '-a' , diskimage , disk_files_dir ])
346- except subprocess .CalledProcessError as e :
347- print ('ERROR: tsk_recover could not carve allocated files from disk. STDERR: %s' % (e .output ))
346+ # carve allocated or all files depending on option selected
347+ if args .exportall == True :
348+ try :
349+ subprocess .check_output (['tsk_recover' , '-e' , diskimage , disk_files_dir ])
350+ except subprocess .CalledProcessError as e :
351+ print ('ERROR: tsk_recover could not carve all files from disk. STDERR: %s' % (e .output ))
352+ else :
353+ try :
354+ subprocess .check_output (['tsk_recover' , '-a' , diskimage , disk_files_dir ])
355+ except subprocess .CalledProcessError as e :
356+ print ('ERROR: tsk_recover could not carve allocated files from disk. STDERR: %s' % (e .output ))
348357
349358 # rewrite last modified dates of carved files based on values in DFXML
350359 for (event , obj ) in Objects .iterparse (fiwalk_file ):
@@ -419,10 +428,17 @@ def write_to_spreadsheet(disk_result, spreadsheet_path):
419428 disk_files_dir = os .path .join (files_dir , file )
420429 if not os .path .exists (disk_files_dir ):
421430 os .makedirs (disk_files_dir )
422- try :
423- subprocess .check_output (['bash' , '/usr/share/hfsexplorer/bin/unhfs' , '-v' , '-o' , disk_files_dir , diskimage ])
424- except subprocess .CalledProcessError as e :
425- print ('ERROR: HFS Explorer could not carve the following files from image: %s' % (e .output ))
431+ # carve with or without resource forks depending on option selected
432+ if args .resforks == True :
433+ try :
434+ subprocess .check_output (['bash' , '/usr/share/hfsexplorer/bin/unhfs' , '-v' , '-resforks' , 'APPLEDOUBLE' , '-o' , disk_files_dir , diskimage ])
435+ except subprocess .CalledProcessError as e :
436+ print ('ERROR: HFS Explorer could not carve the following files from image: %s' % (e .output ))
437+ else :
438+ try :
439+ subprocess .check_output (['bash' , '/usr/share/hfsexplorer/bin/unhfs' , '-v' , '-o' , disk_files_dir , diskimage ])
440+ except subprocess .CalledProcessError as e :
441+ print ('ERROR: HFS Explorer could not carve the following files from image: %s' % (e .output ))
426442
427443
428444 elif 'udf' in disk_fs .lower ():
0 commit comments