-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathcaparser.sh
executable file
·87 lines (69 loc) · 1.94 KB
/
caparser.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
76
77
78
79
80
81
82
83
84
85
86
87
## Caparser: Find plaintext sensitive data in ur netwerk traffics.
## By Daniel Miessler
## Version 1 sucks a lot. Sorry.
# Cleanup
rm hosts.txt
rm hostnames.txt
rm uniquehosts.txt
rm pcap_strings.txt
rm totalhits.txt
#rm malwarecheck.txt
# Get the hosts list
tshark -r diphone.pcap -q -z conv,ip | awk '{print $3}' | grep "^[0-9]" | sort | uniq | awk '{print $1}' >> hosts.txt
# Create a seperate pcap for each host
for host in `cat hosts.txt`
do
tcpdump -r diphone.pcap -w $host.pcap host $host > /dev/null 2>&1
#strings $host.pcap > $host-strings.txt
done
NOC=`wc -l hosts.txt | awk '{print $1}'`
# Get unique hostnames
sort hosts.txt | uniq > uniquehosts.txt
#for host in `cat uniquehosts.txt`
#do
# /Users/daniel/Development/vtscan/vtcheck -u $host >> malwarecheck.txt
#done
for host in `cat uniquehosts.txt`
do
dig -x $host +short >> hostnames.txt
done
NOH=`wc -l hostnames.txt | awk '{print $1}'`
# Get strings from the SecLists project
curl -O https://raw.githubusercontent.com/danielmiessler/SecLists/master/Pattern_Matching/pcap_strings.txt
# Output based on hits
for string in `cat pcap_strings.txt`
do
echo ""
echo "There are `tshark -r diphone.pcap | grep -i $string | wc -l | awk '{print $1}'` instances of $string"
tshark -r diphone.pcap | grep -i $string | wc -l | awk '{print $1}' >> totalhits.txt
echo ""
echo "------- SEARCHING FOR $string ----------"
tshark -r diphone.pcap | grep -i $string
echo "------- END $string ----------"
echo ""
done
# Output
echo "Scanning pcap…"
sleep 3
echo ""
echo "============================"
echo "========== OUTPUT =========="
echo "============================"
echo ""
echo "You made $NOC connections to $NOH hosts."
echo ""
sleep 2
echo ""
echo "*** HOST LIST ***"
echo ""
sleep 1
echo "Printing hostnames…"
sleep 1
cat hostnames.txt
echo ""
sleep 2
echo "Printing hits…"
sleep 1
echo "Total instances of sensitive string hits:"
echo ""
cat totalhits.txt