-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiskid-md5deep.sh
58 lines (56 loc) · 1.83 KB
/
diskid-md5deep.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#! /bin/bash
#script to id filesystem type for raw disk images using disktype, mount accordingly (currently only hfs and vfat) and then run md5deep to create dfxml and .csv reports
#make cwd a variable
CWD=$(pwd)
echo $CWD
#LOGFILE=script.log
#iterate for every .img file
##for FILE in *.img
for FILE in $(find ./ -name '*.img');
do
#make variable SYSTEM based on a grep of disktype's output
SYSTEM=$(disktype "$FILE" | grep "file system")
printf "File: %s , System: %s\n" "$FILE" "$SYSTEM" #>> $LOGFILE
#if SYSTEM contains FAT
if [[ $SYSTEM == "FAT"* ]]
then
#uses fiwalk to create DFXML of image
fiwalk -f -X "$CWD"/$FILE"-FAT-dfxml.xml" "$FILE"
#mounts the image in order to run md5deep, note the mount command
sudo mount -t vfat -o loop,ro,noexec $FILE /mnt/diskid/
#just verify it mounted
echo $?
#cd to mount directory
cd /mnt/diskid
#use md5deep to create .csv for use by archivists and appraisers
md5deep -r -l -t ./* > "$CWD"/$FILE"-FAT-manifest.csv"
#cd back to cwd and unmount
cd "$CWD"
sudo umount /mnt/diskid
#if SYSTEM contains HFS
elif [[ $SYSTEM == "HFS"* ]]
then
#mount the image according to forensicwiki mounting suggestions
sudo mount -t hfs -o loop,ro,noexec $FILE /mnt/diskid/
#just verify it mounted
echo $?
#cd to mount directory
cd /mnt/diskid
#use md5deep to create DFXML and .csv files
md5deep -r -l -d ./* > "$CWD"/$FILE"-HFS-dfxml.xml"
md5deep -r -l -t ./* > "$CWD"/$FILE"-HFS-manifest.csv"
#cd back to cwd and unmount
cd "$CWD"
sudo umount /mnt/diskid
elif [[ $SYSTEM == "ISO"* ]]
then
fiwalk -f -X "$CWD"/$FILE"-ISO-dfxml.xml" "$FILE"
fi
done
for FILE in $(find ./ -name '*.iso')
do
SYSTEM=$(disktype "$FILE" | grep "file system")
#uses fiwalk to create DFXML of image
fiwalk -f -X "$CWD"/$FILE"-ISO-dfxml.xml" "$FILE"
printf "File: %s , System: %s\n\n" "$FILE" "$SYSTEM" #>> $LOGFILE
done