-
Notifications
You must be signed in to change notification settings - Fork 35
/
wpa_sycophant.sh
executable file
·66 lines (53 loc) · 1.31 KB
/
wpa_sycophant.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
#!/bin/bash
if (( $EUID != 0 )); then
echo "SYCOPHANT : Please run as root"
exit
fi
# configfile="./wpa_sycophant_example.conf"
# interface="wlp0s20f0u6"
supplicant="./wpa_supplicant/wpa_supplicant"
# supplicant_location=''
configfile=''
interface=''
print_usage(){
printf "Usage: sudo ./wpa_sycophant_new.sh -c wpa_sycophant_example.conf -i wlan0\n"
}
while getopts 'c:i:h' flag; do
case "${flag}" in
i) interface="${OPTARG}" ;;
c) configfile="${OPTARG}" ;;
h) print_usage
exit 1 ;;
*) print_usage
exit 1 ;;
esac
done
clean_up(){
rm /tmp/SYCOPHANT_P1ID
rm /tmp/SYCOPHANT_P2ID
rm /tmp/CHALLENGE
rm /tmp/CHALLENGE_LOCK
rm /tmp/RESPONSE
rm /tmp/RESPONSE_LOCK
rm /tmp/SYCOPHANT_STATE
return
}
exit_time(){
printf "\n"
printf "SYCOPHANT : Cleaning Up State\n"
clean_up &>/dev/null
printf "SYCOPHANT : Stopping dhcpcd\n"
dhclient -x -r $interface
printf "SYCOPHANT : Exiting\n"
kill 0
}
# ERR is triggered if rm file doesnt exist.
# trap "exit" INT TERM ERR
trap "exit" INT TERM
trap "exit_time" EXIT
clean_up &>/dev/null
printf "SYCOPHANT : RUNNING \"$supplicant -i $interface -c $configfile\"\n"
$supplicant -i $interface -c $configfile &
printf "SYCOPHANT : RUNNING \"dhclient $interface\"\n"
dhclient $interface
wait