From 5876569de81e4e909bde053c9e05ec563c196b5c Mon Sep 17 00:00:00 2001 From: Matias Barcenas Date: Sun, 20 Aug 2017 16:54:06 -0500 Subject: [PATCH] Fixed a bug affecting interface driver reloading. The interface setup procedure wasn't waiting for the interface to be ready. --- fluxion.sh | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/fluxion.sh b/fluxion.sh index 8e6c66a..9a4f7ac 100755 --- a/fluxion.sh +++ b/fluxion.sh @@ -527,8 +527,8 @@ function set_interface() { wiSelectedState="${IOQueryFormatFields[2]}" fi - if [ "$wiSelected" = "$FLUXIONGeneralRepeatOption" ]; then - unset_interface; return 1 + if [ "$wiSelected" = "$FLUXIONGeneralRepeatOption" ] + then unset_interface; return 1 fi if [ ! "$FLUXIONDropNet" -a "$wiSelectedState" = "-" ]; then @@ -540,38 +540,44 @@ function set_interface() { if [ $FLUXIONDropNet ]; then # Get selected interface's driver details/info-descriptor. echo -e "$FLUXIONVLine $FLUXIONGatheringWIInfoNotice" - interface_driver "$wiSelected" - WIDriver="$InterfaceDriver" + + if ! interface_driver "$wiSelected" + then echo -e "$FLUXIONVLine$CRed Unable to determine interface driver!"; sleep 3; return 1 + fi + + local wiDriver="$InterfaceDriver" # I'm not really sure about this conditional here. # FLUXION 2 had the conditional so I kept it there. - if [ ! "$(echo $WIDriver | egrep 'rt2800|rt73')" ]; then - rmmod -f $WIDriver &> $FLUXIONOutputDevice 2>&1 + if [ ! "$(echo $wiDriver | egrep 'rt2800|rt73')" ] + then rmmod -f $wiDriver &> $FLUXIONOutputDevice 2>&1 fi # Get list of potentially troublesome programs. echo -e "$FLUXIONVLine $FLUXIONFindingConflictingProcessesNotice" # This shit has to go reeeeeal soon (airmon-ng)... - ConflictPrograms=($(airmon-ng check | awk 'NR>6{print $2}')) + local conflictPrograms=($(airmon-ng check | awk 'NR>6{print $2}')) # Kill potentially troublesome programs. echo -e "$FLUXIONVLine $FLUXIONKillingConflictingProcessesNotice" - for program in "${ConflictPrograms[@]}"; do - killall "$program" &> $FLUXIONOutputDevice + for program in "${conflictPrograms[@]}" + do killall "$program" &> $FLUXIONOutputDevice done - sleep 0.5 - # I'm not really sure about this conditional here. # FLUXION 2 had the conditional so I kept it there. - if [ ! "$(echo $WIDriver | egrep 'rt2800|rt73')" ]; then - modprobe "$WIDriver" &> $FLUXIONOutputDevice 2>&1 - sleep 0.5 - fi + if [ ! "$(echo $wiDriver | egrep 'rt2800|rt73')" ] + then modprobe "$wiDriver" &> $FLUXIONOutputDevice 2>&1 + fi + + echo -e "$FLUXIONVLine Waiting for interface \"$wiSelected\"..." + while ! interface_physical "$wiSelected" + do sleep 1 + done fi - + if ! run_interface "$wiSelected" - then return 1 + then return 1 fi }