-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwifiCap.sh
More file actions
45 lines (27 loc) · 759 Bytes
/
wifiCap.sh
File metadata and controls
45 lines (27 loc) · 759 Bytes
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
#!/bin/bash
if [ $(id -u) -ne 0 ]; then
echo "Please run as root! Exiting..."
exit 1
fi
wlaninterface=wlan0
m=mon
i=$wlaninterface$m
currDate=$(date +%m_%d_%Y)
recon=/captures/scouted_$currDate
pcapfile=/captures/capFile_$currDate
recontime=120s
capturetime=3600s
#rm $recon*.csv &> /dev/inull
#rm $pcapfile*.cap &> /dev/null
airmon-ng check kill &
airmon-ng start $wlaninterface$m &
airodump-ng --encrypt OPN --output-format csv -w $recon $i &> /dev/null &
sleep $recontime
#kill the most recent background command
kill $!
#extract channel
ch=$(grep -a 'OPN' $recon*.csv | head -1 | cut -d',' -f4)
airodump-ng --encrypt OPN --output-format pcap --channel $ch -w pcapfile $i &> /dev/null &
sleep $capturetime
kill $!
shutdown -P now