Upgraded AP services for Fluxion V4.
This commit is contained in:
parent
c66d11feb3
commit
eadfceeae7
|
@ -3,55 +3,87 @@
|
|||
# ================================================================
|
||||
# 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
|
||||
#APServiceConfigDirectory=$FLUXIONWorkspacePath
|
||||
# ================================================================
|
||||
|
||||
#if [ "$APServiceVersion" ]; then return 0; fi
|
||||
#readonly APServiceVersion="1.0"
|
||||
|
||||
function ap_stop() {
|
||||
if [ "$APServicePID" ]; then kill $APServicePID &>$FLUXIONOutputDevice
|
||||
function ap_service_stop() {
|
||||
if [ "$APServicePID" ]; then
|
||||
kill $APServicePID &> $FLUXIONOutputDevice
|
||||
fi
|
||||
|
||||
APServicePID=""
|
||||
}
|
||||
|
||||
function ap_reset() {
|
||||
ap_stop
|
||||
function ap_service_reset() {
|
||||
ap_service_stop
|
||||
|
||||
APServiceAccessInterface=""
|
||||
|
||||
APServiceChannel=""
|
||||
APServiceMAC=""
|
||||
APServiceSSID=""
|
||||
APServiceInterfaceAddress=""
|
||||
APServiceInterface=""
|
||||
}
|
||||
|
||||
function ap_route() {
|
||||
ifconfig $VIAP $VIAPAddress netmask 255.255.255.0
|
||||
sysctl net.ipv6.conf.at0.disable_ipv6=1 &>$FLUXIONOutputDevice
|
||||
function ap_service_route() {
|
||||
local networkSubnet=${APServiceInterfaceAddress%.*}
|
||||
local networkAddress=$(( ( ${APServiceInterfaceAddress##*.} + 1 ) % 255 ))
|
||||
|
||||
if [ $hostID -eq 0 ]; then
|
||||
let hostID++
|
||||
fi
|
||||
|
||||
# TODO: Dynamically get the airbase-ng tap interface & use below.
|
||||
# WARNING: Notice the interface below is STATIC, it'll break eventually!
|
||||
if ! ifconfig "at0" $networkSubnet.$networkAddress \
|
||||
netmask 255.255.255.0; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! sysctl net.ipv6.conf.at0.disable_ipv6=1 &> $FLUXIONOutputDevice; then
|
||||
return 2
|
||||
fi
|
||||
}
|
||||
|
||||
function ap_prep() {
|
||||
ap_stop
|
||||
function ap_service_prep() {
|
||||
if [ ${#@} -lt 5 ]; then return 1; fi
|
||||
|
||||
APServiceInterface=$1
|
||||
APServiceInterfaceAddress=$2
|
||||
APServiceSSID=$3
|
||||
APServiceMAC=$4
|
||||
APServiceChannel=$5
|
||||
|
||||
ap_service_stop
|
||||
|
||||
# Spoof virtual interface MAC address.
|
||||
# This is done by airbase-ng automatically.
|
||||
|
||||
# airbase-ng uses a monitor-mode virtual interface
|
||||
# and creates a separate interface, atX, for dhcpd.
|
||||
APServiceAccessInterface="at0"
|
||||
}
|
||||
|
||||
function ap_start() {
|
||||
ap_stop
|
||||
function ap_service_start() {
|
||||
ap_service_stop
|
||||
|
||||
xterm $FLUXIONHoldXterm $TOP -bg "#000000" -fg "#FFFFFF" -title "FLUXION AP Service [airbase-ng]" -e airbase-ng -P -e $APTargetSSID -c $APTargetChannel -a $APRogueMAC $VIAP &
|
||||
xterm $FLUXIONHoldXterm $TOP -bg "#000000" -fg "#FFFFFF" \
|
||||
-title "FLUXION AP Service [airbase-ng]" -e \
|
||||
airbase-ng -P -e $APServiceSSID -c $APServiceChannel \
|
||||
-a $APServiceMAC $APServiceInterface &
|
||||
local parentPID=$!
|
||||
|
||||
# Wait till airebase-ng has started and created the extra virtual interface.
|
||||
# Wait till airebase-ng starts and creates the extra virtual interface.
|
||||
while [ ! "$APServicePID" ]; do
|
||||
sleep 1
|
||||
APServicePID=$(pgrep -P $parentPID)
|
||||
done
|
||||
|
||||
ap_route
|
||||
ap_service_route
|
||||
}
|
||||
|
||||
# FLUXSCRIPT END
|
||||
|
|
|
@ -3,69 +3,87 @@
|
|||
# ================================================================
|
||||
# Configuration Section
|
||||
# ================================================================
|
||||
VIGW=$WIAccessPoint
|
||||
VIAP=$WIAccessPoint
|
||||
|
||||
# HostAPD sets the virtual interface mode
|
||||
# to master, which is supported by dhcpd.
|
||||
VIAPAddress=$VIGWAddress
|
||||
|
||||
APServiceConfigDirectory=$FLUXIONWorkspacePath
|
||||
# ================================================================
|
||||
|
||||
#if [ "$APServiceVersion" ]; then return 0; fi
|
||||
#readonly APServiceVersion="1.0"
|
||||
|
||||
function ap_stop() {
|
||||
if [ "$APServicePID" ]; then kill $APServicePID &>$FLUXIONOutputDevice
|
||||
function ap_service_stop() {
|
||||
if [ "$APServicePID" ]; then
|
||||
kill $APServicePID &> $FLUXIONOutputDevice
|
||||
fi
|
||||
|
||||
APServicePID=""
|
||||
}
|
||||
|
||||
function ap_reset() {
|
||||
ap_stop
|
||||
function ap_service_reset() {
|
||||
ap_service_stop
|
||||
|
||||
# Reset MAC address to original.
|
||||
ifconfig $VIAP down
|
||||
ifconfig $APServiceInterface down
|
||||
sleep 0.5
|
||||
|
||||
macchanger -p $VIAP &>$FLUXIONOutputDevice
|
||||
macchanger -p $APServiceInterface &> $FLUXIONOutputDevice
|
||||
sleep 0.5
|
||||
|
||||
ifconfig $VIAP up
|
||||
ifconfig $APServiceInterface up
|
||||
sleep 0.5
|
||||
|
||||
APServiceAccessInterface=""
|
||||
|
||||
APServiceChannel=""
|
||||
APServiceMAC=""
|
||||
APServiceSSID=""
|
||||
APServiceInterfaceAddress=""
|
||||
APServiceInterface=""
|
||||
|
||||
}
|
||||
|
||||
function ap_route() {
|
||||
echo "APService: No custom routes for hostapd" >$FLUXIONOutputDevice
|
||||
function ap_service_route() {
|
||||
echo "APService: No custom routes for hostapd" > $FLUXIONOutputDevice
|
||||
}
|
||||
|
||||
function ap_prep() {
|
||||
ap_stop
|
||||
function ap_service_prep() {
|
||||
if [ ${#@} -lt 5 ]; then return 1; fi
|
||||
|
||||
APServiceInterface=$1
|
||||
APServiceInterfaceAddress=$2
|
||||
APServiceSSID=$3
|
||||
APServiceMAC=$4
|
||||
APServiceChannel=$5
|
||||
|
||||
ap_service_stop
|
||||
|
||||
# Prepare the hostapd config file.
|
||||
echo "\
|
||||
interface=$VIAP
|
||||
interface=$APServiceInterface
|
||||
driver=nl80211
|
||||
ssid=$APTargetSSID
|
||||
channel=$APTargetChannel" >"$APServiceConfigDirectory/$APRogueMAC-hostapd.conf"
|
||||
ssid=$APServiceSSID
|
||||
channel=$APServiceChannel" \
|
||||
> "$APServiceConfigDirectory/$APServiceMAC-hostapd.conf"
|
||||
|
||||
# Spoof virtual interface MAC address.
|
||||
ifconfig $VIAP down
|
||||
ifconfig $APServiceInterface down
|
||||
sleep 0.5
|
||||
|
||||
macchanger --mac=$APRogueMAC $VIAP &>$FLUXIONOutputDevice
|
||||
macchanger --mac=$APServiceMAC $APServiceInterface &> $FLUXIONOutputDevice
|
||||
sleep 0.5
|
||||
|
||||
ifconfig $VIAP up
|
||||
ifconfig $APServiceInterface up
|
||||
sleep 0.5
|
||||
|
||||
# HostAPD sets the virtual interface mode
|
||||
# to master, which is supported by dhcpd.
|
||||
APServiceAccessInterface=$APServiceInterface
|
||||
}
|
||||
|
||||
function ap_start() {
|
||||
ap_stop
|
||||
function ap_service_start() {
|
||||
ap_service_stop
|
||||
|
||||
xterm $FLUXIONHoldXterm $TOP -bg "#000000" -fg "#FFFFFF" -title "FLUXION AP Service [hostapd]" -e hostapd "$APServiceConfigDirectory/$APRogueMAC-hostapd.conf" &
|
||||
xterm $FLUXIONHoldXterm $TOP -bg "#000000" -fg "#FFFFFF" \
|
||||
-title "FLUXION AP Service [hostapd]" -e \
|
||||
hostapd "$APServiceConfigDirectory/$APServiceMAC-hostapd.conf" &
|
||||
local parentPID=$!
|
||||
|
||||
# Wait till hostapd has started and its virtual interface is ready.
|
||||
|
@ -74,7 +92,7 @@ function ap_start() {
|
|||
APServicePID=$(pgrep -P $parentPID)
|
||||
done
|
||||
|
||||
ap_route
|
||||
ap_service_route
|
||||
}
|
||||
|
||||
# FLUXSCRIPT END
|
||||
|
|
Loading…
Reference in New Issue