#!/bin/bash

cd /home
export WLANDEV=`ls -1 /sys/class/net | grep ^wl`
if [[ ! -z $WLANDEV ]]
then
	ARCHIVNAME=`date +'%Y%m%d%H%M'`
	ip link set $WLANDEV down
	iw dev $WLANDEV set type monitor
	ip link set $WLANDEV up
	hcxdumptool --gpio_button=4 --gpio_statusled=17 -i $WLANDEV -o $ARCHIVNAME.pcapng --poweroff --filterlist=blacklistown --filtermode=1 --give_up_ap_attacks=100000 --give_up_deauthentications=100000
#	hcxdumptool --gpio_button=4 --gpio_statusled=17 -i $WLANDEV -o $ARCHIVNAME.pcapng --poweroff --filterlist=blacklistown --filtermode=1 --disable_ap_attacks --disable_deauthentications -t 120
fi
hcxpioff --gpio_button=4 --gpio_statusled=17 &
systemctl start dhcpcd@eth0.service
systemctl start sshd.service
