Fixed issue with airmon-ng interface allocator.

The issue was caused by improper grep selection.
Fixed a future bug with deallocation, caused by improper sequencing.
This commit is contained in:
Matias Barcenas 2018-05-03 16:55:06 -05:00
parent 22a8feb58d
commit 53087e6907
1 changed files with 15 additions and 15 deletions

View File

@ -753,23 +753,23 @@ fluxion_deallocate_interface() { # Release interfaces
)"$CClr" )"$CClr"
if interface_is_wireless $oldIdentifier; then if interface_is_wireless $oldIdentifier; then
# Attempt deactivating monitor mode on the interface.
if ! interface_set_mode $oldIdentifier managed; then
return 3
fi
fi
# If interface was allocated by airmon-ng, deallocate with it. # If interface was allocated by airmon-ng, deallocate with it.
if [[ "$oldIdentifier" == *"mon"* ]]; then if [[ "$oldIdentifier" == *"mon"* ]]; then
if ! airmon-ng stop $oldIdentifier &> $FLUXIONOutputDevice; then if ! airmon-ng stop $oldIdentifier &> $FLUXIONOutputDevice; then
return 4 return 4
fi fi
else else
# Attempt deactivating monitor mode on the interface.
if ! interface_set_mode $oldIdentifier managed; then
return 3
fi
# Attempt to restore the original interface identifier. # Attempt to restore the original interface identifier.
if ! interface_reidentify $oldIdentifier $newIdentifier; then if ! interface_reidentify $oldIdentifier $newIdentifier; then
return 5 return 5
fi fi
fi fi
fi
# Once successfully renamed, remove from allocation table. # Once successfully renamed, remove from allocation table.
unset FluxionInterfaces[$oldIdentifier] unset FluxionInterfaces[$oldIdentifier]
@ -896,7 +896,7 @@ fluxion_allocate_interface() { # Reserve interfaces
local -r newIdentifier=$( local -r newIdentifier=$(
airmon-ng start $identifier | airmon-ng start $identifier |
grep "monitor .* enabled" | grep "monitor .* enabled" |
grep -oP "wl.*mon|mon[0-9]+" grep -oP "wl[a-zA-Z0-9]+mon|mon[0-9]+"
) )
else else
# Attempt activating monitor mode on the interface. # Attempt activating monitor mode on the interface.