- 4th Jul 2024
- 18:01 pm
In this assignment, you will develop, on your own, a Python script that would be applicable to digital investigation or forensics. The script has the following requirements: This must be a new script that has relevance to digital investigation or forensics. The script must include: Your Name Date Version of the script The purpose of the script How the script could be used within digital investigations A Multiline Comment at the beginning of the script that includes: Detailed comments throughout the script. Variables that are all descriptive and use camelCase. ONLY the use of Python Standard Libraries - no 3rd party libraries are allowed. If your script requires sample data files to process you must include them with your submission for easy testing. Any special instructions for successful execution of the script.
Developing a Python Script for Digital Forensics and Investigation - Get Assignment Solution
Please note that this is a sample solution created by our Python programmers for the Developing a Python Script for Digital Forensics and Investigation assignment. These solutions are for research and reference only.
- Visit our Python Assignment Sample Solution page to download the complete solution, including code, report, and screenshots.
- Connect with our Python Tutors for online tutoring to help you understand and complete this assignment.
- Check out the partial solution for this assignment in the blog post below.
Free Assignment Solution - Developing a Python Script for Digital Forensics and Investigation
program toterate over the directory and store all the metadata of iamge files into a csv file
'''
#import all the necessary modules
from exif import Image
import sys
import os
import imghdr
#specify the image file type
imageType = ['rgb','gif','pbm','pgm','ppm','tiff','rast','xbm','jpeg','bmp','png']
#get the path of directory from user
path = input("Enter the directory path that contains image files : ")
#check path is ofirectory or not
if os.path.isdir(path):
fileList = os.listdir(path)#get all the files in the directory
file = open("data.csv","w")#open the file in writing mode
file.write("File Name,Make,Model,Orignal Date/Time,Latitude,Longitude\n")#write the header to the file
file.close()
#iterate over the file list
for i in fileList:
imageFile = path + '/' + i
if imghdr.what(imageFile) in imageType:#check file is of type image or not
try:
with open(imageFile,'rb') as file:#open the file and read it's meta data
img = Image(imageFile)
#write all the metadata to the file
file = open("data.csv","a")#open the file in writing mode
file.write(i)
file.write(",")
file.write(img.get("make"))
file.write(",")
file.write(img.get("model"))
file.write(",")
file.write(img.get("datetime_original"))
file.write(",")
file.write(str(img.get("gps_latitude")[0]) + " degrees, " + str(img.get("gps_latitude")[1]) + " minutes, " + str(img.get("gps_latitude")[2]) + " seconds")
file.write(",")
file.write(str(img.get("gps_longitude")[0]) + " degrees, " + str(img.get("gps_longitude")[1]) + " minutes, " + str(img.get("gps_longitude")[2]) + " seconds")
file.write("\n")
file.close()
print("File Processed : " + i)
except Exception as ex:
print("Excepti : " ,ex)
file.close()#close the file
else:
print("Path not a directory")
'''
if len(sys.argv) > 1:
try:
fileName = sys.argv[1]
print("Source File: " + fileName)
print("Make: " + img.get("make"))
print("Model: " + img.get("model"))
print("Orignal Date/Time: " + img.get("datetime_original"))
print("Latitude: " + str(img.get("gps_latitude")[0]) + " degrees, " + str(img.get("gps_latitude")[1]) + " minutes, " + str(img.get("gps_latitude")[2]) + " seconds")
print("Longitude: " + str(img.get("gps_longitude")[0]) + " degrees, " + str(img.get("gps_longitude")[1]) + " minutes, " + str(img.get("gps_longitude")[2]) + " seconds")
except Exception as ex:
print("Error! - File Not Found!")
print(ex)
else:
print("Error! - No Image File Specified")
'''
Get the best Developing a Python Script for Digital Forensics and Investigation assignment and tutoring services from our experts now!
About The Author - Aman Shah
Aman Shah is a seasoned software developer with a keen interest in digital forensics and cybersecurity. With years of experience in Python programming, Aman specializes in creating tools and scripts that aid in digital investigations. His work focuses on developing efficient, reliable, and easy-to-use software solutions to address the challenges faced by forensic investigators.