-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpassive.sh
86 lines (71 loc) · 3.59 KB
/
passive.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
arpd=$1
interface=$2
mode=$3
#echo $arpd; echo $interface ; echo $mode
if [ " $mode " = ' -d ' ] || [ " $mode " = " --defence " ]; then
output=`arp gateway -i $interface`
carpd=${output%C*} # delete the part after the C
carpd=${carpd##*r} # delete the part before the ether
arpd=${arpd//[ ]/}
carpd=${carpd//[ ]/}
if [ " $arpd " != " $carpd " ]; then
echo "gateway changed from " $arpd " to " $carpd " at time " $(date +"%T")
echo $carpd "is spoofing!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! "
echo "network connection going down "
ifconfig $interface down
vendor=${carpd//[:]/}
vendor=${vendor:0:6}
while read line
do macid=${line:0:6}
vendor="${vendor^^}"
if [ " $macid " = " $vendor " ]
then
echo "MAC Vendor of the attacker is " ${line:(+6)}
macvendor=${line:(+6)}
fi
done < mac-vendors.txt
echo "gateway changed from" $arpd " to" $carpd " at time " $(date +"%T") " on " $(date +"%D") "The attacker's MAC vendor is " $macvendor >> /usr/shARP/log.txt
espeak 'network is being spoofed by '$carpd', connection, going down. Contact your network administrator.'
fi
elif [ " $mode " = ' -o ' ] || [ " $mode " = " --offence " ] ; then
output=`sudo arp gateway -i $interface`
carpd=${output%C*} # delete the part after the C
carpd=${carpd##*r} # delete the part before the ether
arpd=${arpd//[ ]/}
carpd=${carpd//[ ]/}
if [ " $arpd " != " $carpd " ]; then
echo "gateway changed from " $arpd " to " $carpd " at time " $(date +"%T")
echo $carpd "is spoofing!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! "
echo "network connection going down "
ifconfig $interface down
vendor=${carpd//[:]/}
vendor=${vendor:0:6}
while read line
do macid=${line:0:6}
vendor="${vendor^^}"
if [ " $macid " = " $vendor " ]
then
echo "MAC Vendor of the attacker is " ${line:(+6)}
macvendor=${line:(+6)}
fi
done < mac-vendors.txt
echo "gateway changed from" $arpd " to" $carpd " at time " $(date +"%T") " on " $(date +"%D") "The attacker's MAC vendor is " $macvendor >> /usr/shARP/log.txt
#espeak 'network is being spoofed by '$carpd', connection, going down. Starting DOS attack ..........'
hash aircrack-ng >> /usr/shARP/hash1.txt
hash airmon-ng >> /usr/shARP/hash2.txt
r1hash=$(cat /usr/shARP/hash1.txt)
r2hash=$(cat /usr/shARP/hash2.txt)
if [ " $r2hash " = "bash: hash: airmon-ng: not found" ] || [ " $r1hash " = "bash: hash: aircrack-ng: not found" ] ;then
sudo apt-get install aircrack-ng
echo "airmon-ng and aircrack-ng are starting"
fi
sudo airmon-ng start $interface
sudo airmon-ng check kill
sudo airmon-ng start $interface'mon' $channel
while true
do sudo aireplay-ng -0 1000 -a $arpd -c $carpd $interface'mon'
done
exit
fi ;
else echo "not available"
fi