Fixed a bug affecting interface setup & startup.
The bug was caused by a local variable being use as global. Rewrote the interface-start section to use physical device.
This commit is contained in:
parent
d03f65617c
commit
7fd3c9e1e6
74
fluxion.sh
74
fluxion.sh
|
@ -485,53 +485,53 @@ function set_interface() {
|
||||||
# These will be stored in our array right below.
|
# These will be stored in our array right below.
|
||||||
interface_list_wireless
|
interface_list_wireless
|
||||||
|
|
||||||
local WIAvailable=("${InterfaceListWireless[@]}")
|
local wiAvailable=("${InterfaceListWireless[@]}")
|
||||||
local WIAvailableInfo=()
|
local wiAvailableInfo=()
|
||||||
local WIAvailableColor=()
|
local wiAvailableColor=()
|
||||||
|
|
||||||
local wiCandidate
|
local wiCandidate
|
||||||
for wiCandidate in "${WIAvailable[@]}"; do
|
for wiCandidate in "${wiAvailable[@]}"; do
|
||||||
interface_chipset "$wiCandidate"
|
interface_chipset "$wiCandidate"
|
||||||
WIAvailableInfo+=("$InterfaceChipset")
|
wiAvailableInfo+=("$InterfaceChipset")
|
||||||
|
|
||||||
interface_state "$wiCandidate"
|
interface_state "$wiCandidate"
|
||||||
|
|
||||||
if [ "$InterfaceState" = "up" ]
|
if [ "$InterfaceState" = "up" ]
|
||||||
then WIAvailableColor+=("$CPrp"); WIAvailableState+=("-")
|
then wiAvailableColor+=("$CPrp"); wiAvailableState+=("-")
|
||||||
else WIAvailableColor+=("$CClr"); WIAvailableState+=("+")
|
else wiAvailableColor+=("$CClr"); wiAvailableState+=("+")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# We'll add an extra option here, the back command.
|
# We'll add an extra option here, the back command.
|
||||||
# Color must be incresed since it's the first array,
|
# Color must be incresed since it's the first array,
|
||||||
# and the io function checks only the first's size.
|
# and the io function checks only the first's size.
|
||||||
WIAvailableColor+=("$CClr") # (Increases record count)
|
wiAvailableColor+=("$CClr") # (Increases record count)
|
||||||
WIAvailable+=("$FLUXIONGeneralRepeatOption")
|
wiAvailable+=("$FLUXIONGeneralRepeatOption")
|
||||||
WIAvailableState+=("x")
|
wiAvailableState+=("x")
|
||||||
|
|
||||||
local WISelected
|
local wiSelected
|
||||||
local WISelectedState
|
local wiSelectedState
|
||||||
if [ ${#WIAvailable[@]} -ge 1 -a ${WIAvailableState[0]} = "+" -a \
|
if [ ${#wiAvailable[@]} -ge 1 -a ${wiAvailableState[0]} = "+" -a \
|
||||||
${#WIAvailable[@]} -eq 1 -o "$FLUXIONAuto" ]; then
|
${#wiAvailable[@]} -eq 1 -o "$FLUXIONAuto" ]; then
|
||||||
WISelected="${WIAvailable[0]}"
|
wiSelected="${wiAvailable[0]}"
|
||||||
WISelectedState="+" # It passed the condition, it must be +
|
wiSelectedState="+" # It passed the condition, it must be +
|
||||||
else
|
else
|
||||||
format_apply_autosize "$CRed[$CYel%1d$CRed]%b %-8b [%1s] %-*.*s\n"
|
format_apply_autosize "$CRed[$CYel%1d$CRed]%b %-8b [%1s] %-*.*s\n"
|
||||||
io_query_format_fields "$FLUXIONVLine $FLUXIONInterfaceQuery" \
|
io_query_format_fields "$FLUXIONVLine $FLUXIONInterfaceQuery" \
|
||||||
"$FormatApplyAutosize" \
|
"$FormatApplyAutosize" \
|
||||||
WIAvailableColor[@] WIAvailable[@] WIAvailableState[@] WIAvailableInfo[@]
|
wiAvailableColor[@] wiAvailable[@] wiAvailableState[@] wiAvailableInfo[@]
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
WISelected="${IOQueryFormatFields[1]}"
|
wiSelected="${IOQueryFormatFields[1]}"
|
||||||
WISelectedState="${IOQueryFormatFields[2]}"
|
wiSelectedState="${IOQueryFormatFields[2]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$WISelected" = "$FLUXIONGeneralRepeatOption" ]; then
|
if [ "$wiSelected" = "$FLUXIONGeneralRepeatOption" ]; then
|
||||||
unset_interface; return 1
|
unset_interface; return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! "$FLUXIONDropNet" -a "$WISelectedState" = "-" ]; then
|
if [ ! "$FLUXIONDropNet" -a "$wiSelectedState" = "-" ]; then
|
||||||
echo -e "$FLUXIONVLine $FLUXIONSelectedBusyWIError"
|
echo -e "$FLUXIONVLine $FLUXIONSelectedBusyWIError"
|
||||||
echo -e "$FLUXIONVLine $FLUXIONSelectedBusyWITip"
|
echo -e "$FLUXIONVLine $FLUXIONSelectedBusyWITip"
|
||||||
sleep 7; unset_interface; return 1;
|
sleep 7; unset_interface; return 1;
|
||||||
|
@ -540,7 +540,7 @@ function set_interface() {
|
||||||
if [ $FLUXIONDropNet ]; then
|
if [ $FLUXIONDropNet ]; then
|
||||||
# Get selected interface's driver details/info-descriptor.
|
# Get selected interface's driver details/info-descriptor.
|
||||||
echo -e "$FLUXIONVLine $FLUXIONGatheringWIInfoNotice"
|
echo -e "$FLUXIONVLine $FLUXIONGatheringWIInfoNotice"
|
||||||
interface_driver "$WISelected"
|
interface_driver "$wiSelected"
|
||||||
WIDriver="$InterfaceDriver"
|
WIDriver="$InterfaceDriver"
|
||||||
|
|
||||||
# I'm not really sure about this conditional here.
|
# I'm not really sure about this conditional here.
|
||||||
|
@ -570,38 +570,50 @@ function set_interface() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
run_interface
|
if ! run_interface "$wiSelected"
|
||||||
if [ $? -ne 0 ]; then return 1; fi
|
then return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_interface() {
|
function run_interface() {
|
||||||
|
if [ ! "$1" ]; then return 1; fi
|
||||||
|
|
||||||
|
local wiSelected="$1"
|
||||||
|
|
||||||
|
# Find interface's physical device.
|
||||||
|
if ! interface_physical "$wiSelected"
|
||||||
|
then echo -e "$FLUXIONVLine ${CRed}Unable to determine interface's physical device!"; sleep 5; return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local wiDevice="$InterfacePhysical"
|
||||||
|
|
||||||
# Activate wireless interface monitor mode and save identifier.
|
# Activate wireless interface monitor mode and save identifier.
|
||||||
echo -e "$FLUXIONVLine $FLUXIONStartingWIMonitorNotice"
|
echo -e "$FLUXIONVLine $FLUXIONStartingWIMonitorNotice"
|
||||||
if [ "$FLUXIONAirmonNG" ]; then
|
if [ "$FLUXIONAirmonNG" ]; then
|
||||||
# TODO: Need to check weather switching to monitor mode below failed.
|
# TODO: Need to check weather switching to monitor mode below failed.
|
||||||
WIMonitor=$(airmon-ng start $WISelected | awk -F'\[phy[0-9]+\]|\)' '$0~/monitor .* enabled/{print $3}' 2> /dev/null)
|
WIMonitor=$(airmon-ng start $wiSelected | awk -F'\[phy[0-9]+\]|\)' '$0~/monitor .* enabled/{print $3}' 2> /dev/null)
|
||||||
else
|
else
|
||||||
if interface_set_mode "$WISelected" "monitor"
|
if interface_set_mode "$wiSelected" "monitor"
|
||||||
then WIMonitor=$WISelected
|
then WIMonitor=$wiSelected
|
||||||
else WIMonitor=""
|
else WIMonitor=""
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$WIMonitor" ]
|
if [ "$WIMonitor" ]
|
||||||
then echo -e "$FLUXIONVLine ${CGrn}Interface monitor mode switch succeeded."; sleep 3
|
then echo -e "$FLUXIONVLine ${CGrn}Interface monitor mode switch succeeded."; sleep 3
|
||||||
else echo -e "$FLUXIONVLine ${CRed}Interface monitor mode switch failed!"; sleep 3; return 1
|
else echo -e "$FLUXIONVLine ${CRed}Interface monitor mode switch failed!"; sleep 3; return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create an identifier for the access point, AP virtual interface.
|
# Create an identifier for the access point, AP virtual interface.
|
||||||
# The identifier will follow this structure: wl[identifier]FLXap
|
# The identifier will follow this structure: wl[identifier]FLXap
|
||||||
WIAccessPoint="${WISelected}FLXap"
|
WIAccessPoint="${wiSelected}FLXap"
|
||||||
|
|
||||||
# Create the new virtual interface with the generated identifier.
|
# Create the new virtual interface with the generated identifier.
|
||||||
echo -e "$FLUXIONVLine $FLUXIONStartingWIAccessPointNotice"
|
echo -e "$FLUXIONVLine $FLUXIONStartingWIAccessPointNotice"
|
||||||
if [ `iw dev $WIMonitor interface add $WIAccessPoint type monitor` ]; then
|
if ! iw phy $wiDevice interface add $WIAccessPoint type monitor 2> $FLUXIONOutputDevice; then
|
||||||
echo -e "$FLUXIONCannotStartWIAccessPointError"
|
echo -e "$FLUXIONCannotStartWIAccessPointError"
|
||||||
sleep 5
|
sleep 5
|
||||||
return 1
|
return 3
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue