Nov-24-2018, 06:01 PM
# 1. Add pytsk3 module import pytsk3 # 33. Add datetime import datetime # 2. Prompt the user to input the name of the image file image_filename = raw_input ('Please input the name of the image file to process> ') # 3. Create an Img_Info object to represent the image file disk_image = pytsk3.Img_Info(image_filename) # 4. Display a helpful message print 'Loaded %s image file' % (image_filename) # 5. Add code here to display the size of the image file and. # calculate and display the total number of sectors in the image file print 'The image file is %d bytes in size' % (disk_image.get_size()) # 6. Create a Volume_Info object to represent the partition table in the image file partition_table = pytsk3.Volume_Info(disk_image) print 'Number of partitions in partition table is %d' % (partition_table.info.part_count) # 14. Add code here to display the partition table type in use # 7. Display partition details in a table print 'Partition number\tDesc\t\t\t\tStart Sector\tNumber of sectors' print '-----------------------------------------------------------------------' # 8. A counter variable to count the number of partitions both real and virtual # Will display this value in the table partition_count = 1 # 9. List variable to store the start sectors for the partitions partition_offsets = [] # 10. Loop to process the partitions in the partition table total_sectors = 0 for partition in partition_table: # 11. Display formatted partition table entry data print '{0:<24}{1:<32}{2:<16}{3:<16}' .format(partition_count, partition.desc, partition.start, partition.len) print 'Partition type %s, start LBA %d, number of sectors %d' %(partition.desc, partition.start, partition.len) # 12. Add the current partition's start (sector) to list partition_offsets.append(partition.start) total_sectors = total_sectors + total_sectors.len # 13. Update the partition count partition_count += 1 # 15. Prompt the user to input the number of a partition to examine part_num = input('Which partition do you want to display details of>') # 16. Create a file system object for the partition number input file_system = pytsk3.FS_Info(disk_image, partition_offsets[part_num - 1] *512) # 17. Display some details about the file system print 'File system is %s' % (file_system.info.ftype) print 'Block size is %d' % (file_system.info.block_size) # 18. Add code below to display more details about the file system # Need to create a string of the hexadecimal values of the volume id # 19. Display a table of files from the file system print 'File number\tName\t\t\tType' print '----------------------------------------------------' # 20. Open the root directory root_dir = file_system.open_dir(inode = file_system.info.root_inum) # 21. Create a counter variable for the files so we can display a number # with the file so it can be selected later file_count = 1 # 22. Loop to display the files for file_obj in root_dir: # 23. Assume the object is a file file_type_str = 'File' # 24. Check there is a meta object before determining whether object is a file or directory if file_obj.info.meta.type == pytsk3.TSK_FS_META_TYPE_DIR: file_type_str = 'Dir' else: file_type_str = 'Unknown' # 25. Display formatted data about the file or directory print '{0:<16}{1:<64}{2:<8}' .format(file_# 1. Add pytsk3 module # 26. Update the count file_count += 1 # 27. Get the number of the file to display details about file_num = input('Input the number of the file to display details of> ') # 28. Now find the file object by counting through file system objects until reach # the number input count = 1 # 29. Stores the found file system object file_obj = None # 30. Loop through file system objects in directory for file in root_dir: # 31. Store the current file system object file_obj = file # If the current object count is the same as the file number input # then stop the loop if count == file_num: break # Update the count count += 1 # 32. Display details about the file print 'Name is %s' % (file_obj.info.name.name) print 'Size is %d bytes' %(file_obj.info.meta.size) print 'Created on %d' % (file_obj.info.meta.crtime) count, file_obj.info.name.name, file_type_str) ` <code>i keep getting this error
Output: File "/home/apdf/VMSharedFolderDesktop/Pytsk3Ex2.py", line 100
file_count += 1
^
SyntaxError: invalid syntax
apdf@apdf-VM:~/VMSharedFolderDesktop$