diff --git a/attacks/Captive Portal/attack.sh b/attacks/Captive Portal/attack.sh index 662d392..bb3cd02 100644 --- a/attacks/Captive Portal/attack.sh +++ b/attacks/Captive Portal/attack.sh @@ -153,13 +153,16 @@ function captive_portal_set_site() { local sitesIdentifier=("${sites[@]/_*/}" "$FLUXIONGeneralBackOption") local sitesLanguage=("${sites[@]/*_/}") + format_center_dynamic "$CRed[$CYel%02d$CRed]$CClr %-44b $CBlu%10s$CClr" + local queryFieldOptionsFormat=$FormatCenterDynamic + fluxion_header view_target_ap_info io_query_format_fields "$FLUXIONVLine $CaptivePortalInterfaceQuery" \ - "$CRed[$CYel%02d$CRed]$CClr %-38b $CBlu[%10s]$CClr\n" \ - sitesIdentifier[@] sitesLanguage[@] + "$queryFieldOptionsFormat\n" \ + sitesIdentifier[@] sitesLanguage[@] echo diff --git a/fluxion.sh b/fluxion.sh index 72dd045..58f318f 100755 --- a/fluxion.sh +++ b/fluxion.sh @@ -249,12 +249,12 @@ fi ####################################### < Start > ###################################### if [ ! $FLUXIONDebug ]; then FLUXIONBanner=() - format_center " ⌠▓▒▓▒ ⌠▓╗ ⌠█┐ ┌█ ┌▓\ /▓┐ ⌠▓╖ ⌠◙▒▓▒◙ ⌠█\ ☒┐"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenter"; - format_center " ║▒_ │▒║ │▒║ ║▒ \▒\/▒/ │☢╫ │▒┌╤┐▒ ║▓▒\ ▓║"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenter"; - format_center " ≡◙◙ ║◙║ ║◙║ ║◙ ◙◙ ║¤▒ ║▓║☯║▓ ♜◙\✪\◙♜"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenter"; - format_center " ║▒ │▒║__ │▒└_┘▒ /▒/\▒\ │☢╫ │▒└╧┘▒ ║█ \▒█║"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenter"; - format_center " ⌡▓ ⌡◘▒▓▒ ⌡◘▒▓▒◘ └▓/ \▓┘ ⌡▓╝ ⌡◙▒▓▒◙ ⌡▓ \▓┘"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenter"; - format_center "¯¯¯ ¯¯¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯ ¯¯¯ ¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenter"; + format_center_static " ⌠▓▒▓▒ ⌠▓╗ ⌠█┐ ┌█ ┌▓\ /▓┐ ⌠▓╖ ⌠◙▒▓▒◙ ⌠█\ ☒┐"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterStatic"; + format_center_static " ║▒_ │▒║ │▒║ ║▒ \▒\/▒/ │☢╫ │▒┌╤┐▒ ║▓▒\ ▓║"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterStatic"; + format_center_static " ≡◙◙ ║◙║ ║◙║ ║◙ ◙◙ ║¤▒ ║▓║☯║▓ ♜◙\✪\◙♜"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterStatic"; + format_center_static " ║▒ │▒║__ │▒└_┘▒ /▒/\▒\ │☢╫ │▒└╧┘▒ ║█ \▒█║"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterStatic"; + format_center_static " ⌡▓ ⌡◘▒▓▒ ⌡◘▒▓▒◘ └▓/ \▓┘ ⌡▓╝ ⌡◙▒▓▒◙ ⌡▓ \▓┘"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterStatic"; + format_center_static "¯¯¯ ¯¯¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯ ¯¯¯ ¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterStatic"; clear; echo -e "$CRed" for line in "${FLUXIONBanner[@]}"; do @@ -264,10 +264,10 @@ if [ ! $FLUXIONDebug ]; then echo sleep 0.1 - format_center "${CGrn}Site: ${CRed}https://github.com/FluxionNetwork/fluxion$CClr"; echo -e "$FormatCenter" + format_center_static "${CGrn}Site: ${CRed}https://github.com/FluxionNetwork/fluxion$CClr"; echo -e "$FormatCenterStatic" sleep 0.1 - format_center "${CRed}FLUXION $CWht$FLUXIONVersion (rev. $CGrn$FLUXIONRevision$CWht)$CYel by$CWht ghost"; echo -e "$FormatCenter" + format_center_static "${CRed}FLUXION $CWht$FLUXIONVersion (rev. $CGrn$FLUXIONRevision$CWht)$CYel by$CWht ghost"; echo -e "$FormatCenterStatic" sleep 0.1 FLUXIONVNotice="Online Version" @@ -331,13 +331,13 @@ function check_dependencies() { local toolIdentifier=$(printf "%-44s" "$CLITool" | sed 's/ /./g') local toolState=$(! hash $CLITool 2>/dev/null && echo "$CRed Missing!$CClr" || echo ".....$CGrn OK.$CClr") CLIToolsMissing=$([[ "$toolState" = *"Missing"* ]] && echo true) - format_center "$FLUXIONVLine $toolIdentifier$toolState" - echo -e "$FormatCenter" + format_center_static "$FLUXIONVLine $toolIdentifier$toolState" + echo -e "$FormatCenterStatic" done if [ "$CLIToolsMissing" ]; then echo - format_center "${CRed}Stopping due to a lack of dependencies!"; echo -e "$FormatCenter" + format_center_static "${CRed}Stopping due to a lack of dependencies!"; echo -e "$FormatCenterStatic" echo exit 1 fi @@ -742,7 +742,7 @@ function set_target_ap() { fi done - local headerTitle=$(format_center "WIFI LIST"; echo -n "$FormatCenter\n\n") + local headerTitle=$(format_center_static "WIFI LIST"; echo -n "$FormatCenterStatic\n\n") format_autosize "$CRed[$CYel * $CRed]$CClr %-*s %4s %3s %3s %2s %8s %18s\n" local headerFields=$(printf "$FormatAutosize" "ESSID" "QLTY" "PWR" "STA" "CH" "SECURITY" "BSSID") diff --git a/lib/FormatUtils.sh b/lib/FormatUtils.sh index 377a656..b77fcf1 100644 --- a/lib/FormatUtils.sh +++ b/lib/FormatUtils.sh @@ -53,17 +53,22 @@ format_autosize() { # Note that this does not yet support multiple lines (multip local __format_autosize__dynamics_count=$(echo "${FormatListSpecifiers[@]}" | grep -oP '%[\+-]?\.?\*[bqdiouxXfeEgGcsnaA]' | wc -l) local __format_autosize__availableLength=$(( $(tput cols) - $FormatCalculateLength )) local __format_autosize__dynamicsLength=$(( $__format_autosize__availableLength / $__format_autosize__dynamics_count )) - FormatAutosize="$1" - FormatAutosize=$(echo "$FormatAutosize" | sed -r 's/%\*s/%'"$__format_autosize__dynamicsLength"'s/g') - FormatAutosize=$(echo "$FormatAutosize" | sed -r 's/%\.\*s/%.'"$__format_autosize__dynamicsLength"'s/g') - FormatAutosize=$(echo "$FormatAutosize" | sed -r 's/%-\*s/%-'"$__format_autosize__dynamicsLength"'s/g') - FormatAutosize=$(echo "$FormatAutosize" | sed -r 's/%-\.\*s/%-.'"$__format_autosize__dynamicsLength"'s/g') + FormatAutosize=$(echo "$1" | sed -r 's/%\*s/%'"$__format_autosize__dynamicsLength"'s/g' | \ + sed -r 's/%\.\*s/%.'"$__format_autosize__dynamicsLength"'s/g' | \ + sed -r 's/%-\*s/%-'"$__format_autosize__dynamicsLength"'s/g' | \ + sed -r 's/%-\.\*s/%-.'"$__format_autosize__dynamicsLength"'s/g') } -format_center() { +format_center_static() { format_strip_invisibles "$1" - local __format_center__text_length=${#FormatStripInvisibles} - format_autosize "%*s%${__format_center__text_length}s%*s" - FormatCenter=$(printf "$FormatAutosize" "" "$1" "") - #FormatCenter=$(echo "$FormatCenter" | cut -d X -f 1)"$1"$(echo "$FormatCenter" | cut -d X -f 2) + local __format_center_static__text_length=${#FormatStripInvisibles} + format_autosize "%*s%${__format_center_static__text_length}s%*s" + FormatCenterStatic=$(printf "$FormatAutosize" "" "$1" "") +} + +format_center_dynamic() { + format_calculate_length "$1" + format_autosize "%*s%${FormatCalculateLength}s%*s" + # Temporary, I'll find a better solution later (too tired). + FormatCenterDynamic=$(printf "`echo "$FormatAutosize" | sed -r 's/%[0-9]+s/%s/2'`" "" "$1" "") }