Fixed Captive Portal bugs & minor dialog fix.

This commit is contained in:
Matias Barcenas 2017-09-02 19:47:03 -05:00
parent ee3ff61a65
commit e7470e3130
2 changed files with 61 additions and 30 deletions

View File

@ -22,8 +22,10 @@ function captive_portal_unset_interface() {
then fluxion_unset_ap_service then fluxion_unset_ap_service
fi fi
# Remove any previously created fluxion AP interfaces. if [[ "$WIAccessPoint" = "FX${WIMonitor:2}AP" ]]; then
iw dev "$WIAccessPoint" del &> $FLUXIONOutputDevice # Remove any previously created fluxion AP interfaces.
iw dev "$WIAccessPoint" del &> $FLUXIONOutputDevice
fi
WIAccessPoint="" WIAccessPoint=""
} }
@ -39,29 +41,40 @@ function captive_portal_set_interface() {
# List of all valid network interfaces. # List of all valid network interfaces.
interface_list_real interface_list_real
local ifAlternate=("$FLUXIONGeneralRepeatOption") local ifAlternate=("$FLUXIONGeneralRepeatOption" "$FLUXIONGeneralBackOption")
local ifAlternateInfo=("") local ifAlternateInfo=("" "")
local ifAlternateState=("") local ifAlternateState=("" "")
local ifAlternateColor=("$CClr") local ifAlternateColor=("$CClr" "$CClr")
interface_prompt "$FLUXIONVLine $CaptivePortalInterfaceQuery" InterfaceListWireless[@] \ interface_prompt "$FLUXIONVLine $CaptivePortalInterfaceQuery" InterfaceListReal[@] \
ifAlternate[@] ifAlternateInfo[@] ifAlternateState[@] ifAlternateColor[@] ifAlternate[@] ifAlternateInfo[@] ifAlternateState[@] ifAlternateColor[@]
# If the monitor interface is also the AP interface, case "$InterfacePromptIfSelected" in
# there's no need to reserve it again, just add it. "$FLUXIONGeneralBackOption")
if [ "$InterfacePromptIfSelected" == "$WIMonitor" ]; then captive_portal_unset_interface; fluxion_unset_attack; return 1;;
if ! captive_portal_run_interface "$InterfacePromptIfSelected"
then return 1
fi
WIAccessPoint="$CaptivePortalRunInterface" # If the monitor interface is also the AP interface,
else # there's no need to reserve it again, just add it.
if ! fluxion_run_interface "$InterfacePrompt" "$WIMonitor")
then return 2 if ! captive_portal_run_interface "$InterfacePromptIfSelected"
fi then return 1
fi
WIAccessPoint="$FluxionRunInterface" WIAccessPoint="$CaptivePortalRunInterface";;
fi *)
# We'll only attempt to run wireless interfaces for now.
# The conditional below is a temporary fix for ethernet interfaces.
# TODO: Fix fluxion_run_interface to accept non-wireless interfaces.
if interface_is_wireless "$InterfacePromptIfSelected"; then
if ! fluxion_run_interface "$InterfacePromptIfSelected"
then return 2
fi
WIAccessPoint="$FluxionRunInterface"
else
WIAccessPoint="$InterfacePromptIfSelected"
fi;;
esac
# Set an AP service if the interface selected is wireless. # Set an AP service if the interface selected is wireless.
if interface_is_wireless "$WIAccessPoint"; then if interface_is_wireless "$WIAccessPoint"; then
@ -132,7 +145,7 @@ function captive_portal_set_auth() {
echo -e "$FLUXIONVLine $CaptivePortalVerificationMethodQuery" echo -e "$FLUXIONVLine $CaptivePortalVerificationMethodQuery"
echo echo
view_target_ap_info fluxion_show_ap_info "$APTargetSSID" "$APTargetEncryption" "$APTargetChannel" "$APTargetMAC" "$APTargetMaker"
local choices=("${CaptivePortalAuthenticationMethods[@]}" "$FLUXIONGeneralBackOption") local choices=("${CaptivePortalAuthenticationMethods[@]}" "$FLUXIONGeneralBackOption")
io_query_format_fields "" "\t$CRed[$CYel%d$CRed]$CClr %b %b\n" choices[@] \ io_query_format_fields "" "\t$CRed[$CYel%d$CRed]$CClr %b %b\n" choices[@] \
@ -248,7 +261,7 @@ function captive_portal_set_site() {
echo echo
view_target_ap_info fluxion_show_ap_info "$APTargetSSID" "$APTargetEncryption" "$APTargetChannel" "$APTargetMAC" "$APTargetMaker"
io_query_format_fields "" "$queryFieldOptionsFormat\n" \ io_query_format_fields "" "$queryFieldOptionsFormat\n" \
sitesIdentifier[@] sitesLanguage[@] sitesIdentifier[@] sitesLanguage[@]
@ -284,15 +297,17 @@ function captive_portal_unset_attack() {
sandbox_remove_workfile "$FLUXIONWorkspacePath/captive_portal" sandbox_remove_workfile "$FLUXIONWorkspacePath/captive_portal"
# Only reset the AP if one has been defined. # Only reset the AP if one has been defined.
if [ $(type -t ap_reset) ]; then if [ "$APRogueService" -a "`type -t ap_reset`" ]
ap_reset then ap_reset
fi fi
} }
# Create different settings required for the script # Create different settings required for the script
function captive_portal_set_attack() { function captive_portal_set_attack() {
# AP Service: Prepare service for an attack. # AP Service: Prepare service for an attack.
ap_prep if [ "$APRogueService" ]
then ap_prep
fi
# Add the PHP authenticator scripts, used to verify # Add the PHP authenticator scripts, used to verify
# password attempts from users using the web interface. # password attempts from users using the web interface.
@ -835,15 +850,31 @@ function captive_portal_set_routes() {
function captive_portal_stop_interface() { function captive_portal_stop_interface() {
captive_portal_unset_routes captive_portal_unset_routes
if [ "$APRogueService" ] && interface_is_wireless "$WIAccessPoint"; then if [ "$APRogueService" ]
ap_stop then ap_stop
fi fi
} }
function captive_portal_start_interface() { function captive_portal_start_interface() {
if [ "$APRogueService" ] && interface_is_wireless "$WIAccessPoint"; then if [ "$APRogueService" ]; then
echo -e "$FLUXIONVLine $CaptivePortalStaringAPServiceNotice" echo -e "$FLUXIONVLine $CaptivePortalStaringAPServiceNotice"
ap_start ap_start
else
fluxion_header
echo -e "$FLUXIONVLine Configuration for external access point device:"
echo
fluxion_show_ap_info "$APRogueSSID" "OPEN" "$APTargetChannel" "$APRogueMAC" "$APTargetMaker"
echo -e "$FLUXIONVLine IPv4 Address: ${VIGWAddress%.*}.2/24"
echo -e "$FLUXIONVLine IPv6 Address: Disabled"
echo -e "$FLUXIONVLine DHCP Server: $VIGWAddress"
echo -e "$FLUXIONVLine DNS Server: $VIGWAddress"
echo
echo -e "$FLUXIONVLine ${CYel}Assure external AP device is available & configured before continuing!${CClr}"
read -n1 -p "Press any key to continue... " bullshit
fi fi
echo -e "$FLUXIONVLine $CaptivePortalStaringAPRoutesNotice" echo -e "$FLUXIONVLine $CaptivePortalStaringAPRoutesNotice"

View File

@ -60,7 +60,7 @@ FLUXIONSelectAnotherAttackOption="Select another attack"
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
FLUXIONGeneralBackOption="${CRed}Back" FLUXIONGeneralBackOption="${CRed}Back"
FLUXIONGeneralExitOption="${CRed}Exit" FLUXIONGeneralExitOption="${CRed}Exit"
FLUXIONGeneralRepeatOption="${CRed}Repeat operation" FLUXIONGeneralRepeatOption="${CRed}Repeat"
FLUXIONGeneralNotFoundError="Not Found" FLUXIONGeneralNotFoundError="Not Found"
FLUXIONGeneralXTermFailureError="${CRed}Failed to start xterm session (possible misconfiguration)." FLUXIONGeneralXTermFailureError="${CRed}Failed to start xterm session (possible misconfiguration)."
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>