-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinux_forensic_acquisition.sh
75 lines (57 loc) · 1.34 KB
/
linux_forensic_acquisition.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# Output file for the acquisition
output_file="forensics_acquisition_$(hostname)_$(date +"%Y_%m_%d_%H:%M").txt"
# Redirect the following information to the output file
{
echo "1. Processes:"
ps aux
echo
echo "2. Network Connections:"
netstat -anp
echo
echo "3. Network Interfaces:"
ip a
echo
echo "4. ARP Cache:"
arp -a
echo
echo "5. DNS Cache (resolv.conf):"
cat /etc/resolv.conf
echo
echo "6. Logged-in Users:"
who
echo
echo "7. User Account Information:"
cat /etc/passwd
echo
echo "8. Logged-in Sessions:"
w
echo
echo "9. Open Files and Processes:"
lsof
echo
echo "10. Kernel Information:"
uname -a
echo
echo "11. Environment Variables:"
env
echo
echo "12. System Configuration:"
lshw
lsblk
lsusb
echo
echo "13. Recent Commands History:"
history
echo
echo "14. Firewall Rules:"
iptables -L -n
echo
} > "$output_file"
echo "SHA256: " > "$output_file hashes".txt
sha256sum $output_file >> "$output_file hashes".txt
echo "SHA1:" >> "$output_file hashes".txt
sha1sum $output_file >> "$output_file hashes".txt
echo "MD5:" >> "$output_file hashes".txt
md5sum $output_file >> "$output_file hashes".txt
echo "Forensics acquisition completed. Output saved to $output_file."