Fixed bug caused by assumption of custom portal.

The contents of the generic portal were trying to be copied from the custom
portals' directory, rather than from generic/assets.
This commit is contained in:
Matias Barcenas 2018-03-13 20:50:28 -05:00
parent 546774f4c5
commit 6792fedc39
1 changed files with 30 additions and 16 deletions

View File

@ -407,31 +407,35 @@ captive_portal_set_connectivity() {
} }
captive_portal_unset_user_interface() { captive_portal_unset_user_interface() {
if [ -z "$CaptivePortalUserInterface" -o \ if [ -z "$CaptivePortalUserInterface" ]; then return 1; fi
! -d "$FLUXIONPath/attacks/Captive Portal/sites/$CaptivePortalUserInterface.portal" ]; then return 1; fi
CaptivePortalUserInterface="" CaptivePortalUserInterface=""
} }
captive_portal_set_user_interface() { captive_portal_set_user_interface() {
if [ "$CaptivePortalUserInterface" != "" -a \ local -r attackPath="$FLUXIONPath/attacks/Captive Portal"
-d "$FLUXIONPath/attacks/Captive Portal/sites/$CaptivePortalUserInterface.portal" ]; then return 0; fi
# Skip setting UI if one is selected and is a custom or a generic portal.
if [ "$CaptivePortalUserInterface" != "" ] && [ \
-d "$attackPath/sites/$CaptivePortalUserInterface.portal" -o \
-f "$attackPath/generic/languages/$CaptivePortalUserInterface.lang" ]; then
return 0
fi
captive_portal_unset_user_interface captive_portal_unset_user_interface
local sites=() local sites=()
# Attempt adding only if the directory exists. # Attempt adding generic portals only if the directory exists.
if [ -d attacks/Captive\ Portal/generic/languages ]; then if [ -d attacks/Captive\ Portal/generic/languages ]; then
# Retrieve all generic sites available. # Normalize the names of the generic portals for presentation.
for site in attacks/Captive\ Portal/generic/languages/*.lang; do for site in attacks/Captive\ Portal/generic/languages/*.lang; do
sites+=("${CaptivePortalGenericInterfaceOption}_$(basename "${site%.lang}")") sites+=("${CaptivePortalGenericInterfaceOption}_$(basename "${site%.lang}")")
done done
fi fi
# Attempt adding only if the directory exists. # Attempt adding custom portals only if the directory exists.
if [ -d attacks/Captive\ Portal/sites ]; then if [ -d attacks/Captive\ Portal/sites ]; then
# Retrieve all available portal sites and # Retrieve available portal sites and strip the .portal extension.
# store them without the .portal extension.
for site in attacks/Captive\ Portal/sites/*.portal; do for site in attacks/Captive\ Portal/sites/*.portal; do
sites+=("$(basename "${site%.portal}")") sites+=("$(basename "${site%.portal}")")
done done
@ -459,19 +463,20 @@ captive_portal_set_user_interface() {
local site="${IOQueryFormatFields[0]}" local site="${IOQueryFormatFields[0]}"
local siteLanguage="${IOQueryFormatFields[1]}" local siteLanguage="${IOQueryFormatFields[1]}"
local sitePath="${site}_${siteLanguage}" local siteIdentifier="${site}_${siteLanguage}"
case "$site" in case "$site" in
"$CaptivePortalGenericInterfaceOption") "$CaptivePortalGenericInterfaceOption")
source "$FLUXIONPath/attacks/Captive Portal/generic/languages/$siteLanguage.lang" CaptivePortalUserInterface=$siteLanguage
captive_portal_generic # source "$FLUXIONPath/attacks/Captive Portal/generic/languages/$siteLanguage.lang"
# captive_portal_generic
;; ;;
"$FLUXIONGeneralBackOption") "$FLUXIONGeneralBackOption")
captive_portal_unset_user_interface captive_portal_unset_user_interface
return 1 return 1
;; ;;
*) *)
CaptivePortalUserInterface=$sitePath CaptivePortalUserInterface=$siteIdentifier
;; ;;
esac esac
} }
@ -543,9 +548,18 @@ captive_portal_unset_attack() {
# Create different settings required for the script # Create different settings required for the script
captive_portal_set_attack() { captive_portal_set_attack() {
# Load and set the captive portal user interface. local -r attackPath="$FLUXIONPath/attacks/Captive Portal"
cp -r "$FLUXIONPath/attacks/Captive Portal/sites/$CaptivePortalUserInterface.portal" \ # Load and set the captive portal user interface to the workspace.
# Check whether it's a custom, generic, or invalid portal.
if [ -d "$attackPath/sites/$CaptivePortalUserInterface.portal" ]; then
cp -r "$attackPath/sites/$CaptivePortalUserInterface.portal" \
"$FLUXIONWorkspacePath/captive_portal" "$FLUXIONWorkspacePath/captive_portal"
elif [ -f "$attackPath/generic/languages/$CaptivePortalUserInterface.lang" ]; then
source "$attackPath/generic/languages/$CaptivePortalUserInterface.lang"
captive_portal_generic
else
return 1
fi
find "$FLUXIONWorkspacePath/captive_portal/" -type f -exec \ find "$FLUXIONWorkspacePath/captive_portal/" -type f -exec \
sed -i -e 's/$APTargetSSID/'"${FluxionTargetSSID//\//\\\/}"'/g; s/$APTargetMAC/'"${FluxionTargetMAC//\//\\\/}"'/g; s/$APTargetChannel/'"${FluxionTargetChannel//\//\\\/}"'/g' {} \; sed -i -e 's/$APTargetSSID/'"${FluxionTargetSSID//\//\\\/}"'/g; s/$APTargetMAC/'"${FluxionTargetMAC//\//\\\/}"'/g; s/$APTargetChannel/'"${FluxionTargetChannel//\//\\\/}"'/g' {} \;