add pytsk to list partitions

This commit is contained in:
Frank Xu
2023-03-20 11:31:01 -04:00
parent 3c35e2dd5a
commit d644daadf6
2 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import sys
import pytsk3
# Get the name of the disk image from command line argument
image_filename = sys.argv[1]
# Create an Img_Info object to represent the image file
disk_image = pytsk3.Img_Info(image_filename)
# Create a Volume_Info object to access the partitions
volume_info = pytsk3.Volume_Info(disk_image)
# Loop through each partition and print its attributes
for partition in volume_info:
print("Partition:", partition.addr)
print("Description:", partition.desc)
print("Start sector:", partition.start)
print("Length:", partition.len)
print()

Binary file not shown.