fluxion/lib/ap/airbase-ng.sh

58 lines
1.4 KiB
Bash
Raw Normal View History

#!/bin/bash
# ================================================================
# Configuration Section
# ================================================================
VIGW="at0"
VIAP=$WIAccessPoint
# airbase-ng uses a monitor-mode virtual interface
# and creates a separate interface, atX, for dhcpd.
VIAPAddress="$VIGWNetwork.2"
# APServiceConfigDirectory=$FLUXIONWorkspacePath
# ================================================================
#if [ "$APServiceVersion" ]; then return 0; fi
#readonly APServiceVersion="1.0"
function ap_stop() {
2017-12-31 09:02:12 -07:00
if [ "$APServicePID" ]; then kill $APServicePID &>$FLUXIONOutputDevice
fi
2017-12-31 09:02:12 -07:00
APServicePID=""
}
function ap_reset() {
2017-12-31 09:02:12 -07:00
ap_stop
}
function ap_route() {
2017-12-31 09:02:12 -07:00
ifconfig $VIAP $VIAPAddress netmask 255.255.255.0
sysctl net.ipv6.conf.at0.disable_ipv6=1 &>$FLUXIONOutputDevice
}
function ap_prep() {
2017-12-31 09:02:12 -07:00
ap_stop
2017-12-31 09:02:12 -07:00
# Spoof virtual interface MAC address.
# This is done by airbase-ng automatically.
}
function ap_start() {
2017-12-31 09:02:12 -07:00
ap_stop
2017-12-31 09:02:12 -07:00
xterm $FLUXIONHoldXterm $TOP -bg "#000000" -fg "#FFFFFF" -title "FLUXION AP Service [airbase-ng]" -e airbase-ng -P -e $APTargetSSID -c $APTargetChannel -a $APRogueMAC $VIAP &
local parentPID=$!
2017-12-31 09:02:12 -07:00
# Wait till airebase-ng has started and created the extra virtual interface.
while [ ! "$APServicePID" ]; do
sleep 1
APServicePID=$(pgrep -P $parentPID)
done
2017-12-31 09:02:12 -07:00
ap_route
}
# FLUXSCRIPT END