-
Notifications
You must be signed in to change notification settings - Fork 4
/
run-at-boot
executable file
·66 lines (66 loc) · 2.29 KB
/
run-at-boot
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
#!/usr/bin/env bash
export HERE=$(cd $(dirname "$0") ; pwd)
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/bin:$HERE
export HOME=/root
export ME=$(basename "$0")
WIFITE=/usr/src/wifite/wifite.py
# On some backlight, backlight is on when 0 is sent...
BL_ON=0
BL_OFF=1
source /etc/airberry.conf
function Log() {
echo "[$(date "+%Y/%m/%d %H:%M")] ""$@"
curl -s -L http://127.0.0.1:$ETCD_PORT/v2/keys/$ETCD_DIR/status -XPUT -d value="$ME:info:$@" >/dev/null
}
Log 'Starting'
Log 'Backlight off'
$HERE/lcd.py backlight off
Log 'Displaying logo'
$HERE/airberry_logo.py ; sleep 3
if ! /etc/init.d/etcd status >/dev/null 2>&1
then
/etc/init.d/etcd start
fi
if ! ifconfig -a $IFACE >/dev/null
then
if ! ifconfig -a ${IFACE}mon
then
Log "$IFACE not found"
$HERE/lcd.py text 0 0 "No wireless, nothing to crack"
(sleep 10 ; [ -n "$(hostname -I)" ] && $HERE/lcd.py text 0 0 $(hostname -I)) &
exit 1
else
Log "Deactivating ${IFACE}mon"
airmon-ng stop ${IFACE}mon
fi
fi
echo $$ > /var/run/$ME.pid
Log 'Launching check-fs-space' ; nohup $HERE/check-fs-space.sh /tmp > /dev/null &
Log 'Launching airberryd' ; nohup $HERE/airberryd.py > /var/log/airberryd.log &
Log 'Cleaning "from_reboot" dir of etcd' ; curl -s http://127.0.0.1:$ETCD_PORT/v2/keys/cracked/from_reboot?recursive=true -XDELETE >/dev/null
#airmon-ng start wlan0
# Sort according to essid
touch $HOME/cracked.csv
sort -u -t ',' -k 3 $HOME/cracked.csv $HERE/cracked.csv > /tmp/c
mv /tmp/c $HERE/cracked.csv
rm -f $HOME/cracked.csv
while true
do
Log 'Looping...'
# If cracked.csv is not here, swicth off light, as I'm probably debbuging something...
[ ! -e $HERE/cracked.csv ] && $HERE/lcd.py backlight $BL_OFF
#$HERE/lcd.py cls
#$HERE/lcd.py text 0 2 'Wifite'
cd $HOME # As wifite save cracked.csv in the dir it was run from
Log "Launching wifite"
$WIFITE --wep -1 --all --scan-time 60 --power 15 --etcd $ETCD_DIR >>/var/log/wifite.out
Log "Cleaning dirs"
ps -C airodump-ng -O cmd | grep tmp | awk '{print $12}' | while read d ; do [ -z "$d" ] && continue ;dir="$(dirname $d)"; Log "> $dir" ; rm -rf "$dir" ; done
for cmd in airodump-ng aireplay-ng
do
Log "Killing stall processes"
pkill "$cmd"
done
airmon-ng stop ${IFACE}mon
# Log "Launching broadcast-keys"; $HERE/broadcast-keys $DISPLAY >> /tmp/wifite.out
done