From ec094539b4e1fa5fd22e1ef83392f143f0835a6c Mon Sep 17 00:00:00 2001 From: Erik Dubois Date: Wed, 31 Jan 2018 13:53:13 +0100 Subject: [PATCH] Change preference file --- fluxion | 117 ++++++++++++++++++++++--------------------- preferences/.gitkeep | 0 2 files changed, 60 insertions(+), 57 deletions(-) create mode 100644 preferences/.gitkeep diff --git a/fluxion b/fluxion index a93b14a..72594ff 100755 --- a/fluxion +++ b/fluxion @@ -8,21 +8,24 @@ # the script, however, will be loaded correctly. # Path to directory containing the FLUXION executable script. -declare -r FLUXIONPath=$(cd "$(dirname "$0")"; pwd -P) +readonly FLUXIONPath=$(cd "$(dirname "$0")"; pwd -P) # Path to the temp. directory available to FLUXION & subscripts. -declare -r FLUXIONWorkspacePath="/tmp/fluxspace" +readonly FLUXIONWorkspacePath="/tmp/fluxspace" # Path to FLUXION's preferences file, to be loaded afterward. -declare -r FLUXIONPreferencesFile="$FLUXIONPath/preferences.conf" +readonly FLUXIONLanguagePreferencesFile="$FLUXIONPath/preferences/LanguagePreference.conf" # Constants denoting the reference noise floor & ceiling levels. # These are used by the the wireless network scanner visualizer. -declare -r FLUXIONNoiseFloor=-90 -declare -r FLUXIONNoiseCeiling=-60 +readonly FLUXIONNoiseFloor=-90 +readonly FLUXIONNoiseCeiling=-60 -declare -r FLUXIONVersion=4 -declare -r FLUXIONRevision=1 +readonly FLUXIONVersion=4 +readonly FLUXIONRevision=2 + +# Declare window ration bigger = smaller windows +FLUXIONWindowRatio=4 # ============================================================ # @@ -79,14 +82,14 @@ source lib/HashUtils.sh # ============================================================ # if ! FLUXIONCLIArguments=$( getopt --options="vdkrnmtb:e:c:l:a:" \ - --longoptions="debug,version,killer,reloader,airmon-ng,multiplexer,target,test,bssid:,essid:,channel:,language:,attack:" \ + --longoptions="debug,version,killer,reloader,ratio,airmon-ng,multiplexer,target,test,bssid:,essid:,channel:,language:,attack:" \ --name="FLUXION V$FLUXIONVersion.$FLUXIONRevision" -- "$@" ); then echo -e "${CRed}Aborted$CClr, parameter error detected..."; exit 5 fi AttackCLIArguments=${FLUXIONCLIArguments##*--} -declare -r FLUXIONCLIArguments=${FLUXIONCLIArguments%%--*} +readonly FLUXIONCLIArguments=${FLUXIONCLIArguments%%--*} # ============================================================ # @@ -96,17 +99,18 @@ declare -r FLUXIONCLIArguments=${FLUXIONCLIArguments%%--*} # ============= < Argument Loaded Configurables > ============ # eval set -- "$FLUXIONCLIArguments" # Set environment parameters. -[ "$1" != "" ] && declare -r FLUXIONAuto=1 # Auto-mode if using CLI. +#[ "$1" != "" ] && readonly FLUXIONAuto=1 # Auto-mode if using CLI. while [ "$1" != "" -a "$1" != "--" ]; do case "$1" in -v|--version) echo "FLUXION V$FLUXIONVersion.$FLUXIONRevision"; exit;; - -d|--debug) declare -r FLUXIONDebug=1;; - -k|--killer) declare -r FLUXIONWIKillProcesses=1;; - -r|--reloader) declare -r FLUXIONWIReloadDriver=1;; - -n|--airmon-ng) declare -r FLUXIONAirmonNG=1;; - -m|--multiplexer) declare -r FLUXIONTMux=1;; + -d|--debug) readonly FLUXIONDebug=1;; + -k|--killer) readonly FLUXIONWIKillProcesses=1;; + -r|--reloader) readonly FLUXIONWIReloadDriver=1;; + -n|--airmon-ng) readonly FLUXIONAirmonNG=1;; + -m|--multiplexer) readonly FLUXIONTMux=1;; -b|--bssid) FluxionTargetMAC=$2; shift;; + --ratio) FLUXIONWindowRatio=$2;shift;; -e|--essid) FluxionTargetSSID=$2; FluxionTargetSSIDClean=$( echo "$FluxionTargetSSID" | sed -r 's/( |\/|\.|\~|\\)+/_/g' @@ -126,67 +130,67 @@ shift # Remove "--" to prepare for attacks to read parameters. # Load user-defined preferences if there's an executable script. # If no script exists, prepare one for the user to store config. # WARNING: Preferences file must assure no redeclared constants. -if [ -x "$FLUXIONPreferencesFile" ]; then - source "$FLUXIONPreferencesFile" +if [ -x "$FLUXIONLanguagePreferencesFile" ]; then + source "$FLUXIONLanguagePreferencesFile" else - echo '#!/bin/bash' > "$FLUXIONPreferencesFile" - chmod u+x "$FLUXIONPreferencesFile" + echo '#!/bin/bash' > "$FLUXIONLanguagePreferencesFile" + chmod u+x "$FLUXIONLanguagePreferencesFile" fi # ================ < Configurable Constants > ================ # if [ "$FLUXIONAuto" != "1" ]; then # If defined, assure 1. - declare -r FLUXIONAuto=${FLUXIONAuto:+1} + readonly FLUXIONAuto=${FLUXIONAuto:+1} fi if [ "$FLUXIONDebug" != "1" ]; then # If defined, assure 1. - declare -r FLUXIONDebug=${FLUXIONDebug:+1} + readonly FLUXIONDebug=${FLUXIONDebug:+1} fi if [ "$FLUXIONAirmonNG" != "1" ]; then # If defined, assure 1. - declare -r FLUXIONAirmonNG=${FLUXIONAirmonNG:+1} + readonly FLUXIONAirmonNG=${FLUXIONAirmonNG:+1} fi if [ "$FLUXIONWIKillProcesses" != "1" ]; then # If defined, assure 1. - declare -r FLUXIONWIKillProcesses=${FLUXIONWIKillProcesses:+1} + readonly FLUXIONWIKillProcesses=${FLUXIONWIKillProcesses:+1} fi if [ "$FLUXIONWIReloadDriver" != "1" ]; then # If defined, assure 1. - declare -r FLUXIONWIReloadDriver=${FLUXIONWIReloadDriver:+1} + readonly FLUXIONWIReloadDriver=${FLUXIONWIReloadDriver:+1} fi # FLUXIONDebug [Normal Mode "" / Developer Mode 1] if [ $FLUXIONDebug ]; then - declare -r FLUXIONOutputDevice="/dev/stdout" - declare -r FLUXIONHoldXterm="-hold" + readonly FLUXIONOutputDevice="/dev/stdout" + readonly FLUXIONHoldXterm="-hold" else - declare -r FLUXIONOutputDevice="/dev/null" - declare -r FLUXIONHoldXterm="" + readonly FLUXIONOutputDevice="/dev/null" + readonly FLUXIONHoldXterm="" fi # ================ < Configurable Variables > ================ # -declare -r FLUXIONPromptDefault="$CRed[${CSBlu}fluxion$CSYel@$CSWht$HOSTNAME$CClr$CRed]-[$CSYel~$CClr$CRed]$CClr " +readonly FLUXIONPromptDefault="$CRed[${CSBlu}fluxion$CSYel@$CSWht$HOSTNAME$CClr$CRed]-[$CSYel~$CClr$CRed]$CClr " FLUXIONPrompt=$FLUXIONPromptDefault -declare -r FLUXIONVLineDefault="$CRed[$CSYel*$CClr$CRed]$CClr" +readonly FLUXIONVLineDefault="$CRed[$CSYel*$CClr$CRed]$CClr" FLUXIONVLine=$FLUXIONVLineDefault # ================== < Library Parameters > ================== # -declare -r InterfaceUtilsOutputDevice="$FLUXIONOutputDevice" +readonly InterfaceUtilsOutputDevice="$FLUXIONOutputDevice" -declare -r SandboxWorkspacePath="$FLUXIONWorkspacePath" -declare -r SandboxOutputDevice="$FLUXIONOutputDevice" +readonly SandboxWorkspacePath="$FLUXIONWorkspacePath" +readonly SandboxOutputDevice="$FLUXIONOutputDevice" -declare -r InstallerUtilsWorkspacePath="$FLUXIONWorkspacePath" -declare -r InstallerUtilsOutputDevice="$FLUXIONOutputDevice" -declare -r InstallerUtilsNoticeMark="$FLUXIONVLine" +readonly InstallerUtilsWorkspacePath="$FLUXIONWorkspacePath" +readonly InstallerUtilsOutputDevice="$FLUXIONOutputDevice" +readonly InstallerUtilsNoticeMark="$FLUXIONVLine" -declare -r PackageManagerLog="$InstallerUtilsWorkspacePath/package_manager.log" +readonly PackageManagerLog="$InstallerUtilsWorkspacePath/package_manager.log" declare IOUtilsHeader="fluxion_header" -declare -r IOUtilsQueryMark="$FLUXIONVLine" -declare -r IOUtilsPrompt="$FLUXIONPrompt" +readonly IOUtilsQueryMark="$FLUXIONVLine" +readonly IOUtilsPrompt="$FLUXIONPrompt" -declare -r HashOutputDevice="$FLUXIONOutputDevice" +readonly HashOutputDevice="$FLUXIONOutputDevice" # ============================================================ # @@ -418,30 +422,29 @@ trap fluxion_handle_exit SIGINT SIGHUP # =============== < Resolution & Positioning > =============== # # ============================================================ # fluxion_set_resolution() { # Windows + Resolution - # Calc options - RATIO=4 - # Get demensions + # Get dimensions SCREEN_SIZE=$(xdpyinfo | grep dimension | awk '{print $4}' | tr -d "(") SCREEN_SIZE_X=$(printf '%.*f\n' 0 $(echo $SCREEN_SIZE | sed -e s'/x/ /'g | awk '{print $1}')) SCREEN_SIZE_Y=$(printf '%.*f\n' 0 $(echo $SCREEN_SIZE | sed -e s'/x/ /'g | awk '{print $2}')) + # Calculate proportional windows PROPOTION=$(echo $(awk "BEGIN {print $SCREEN_SIZE_X/$SCREEN_SIZE_Y}")/1 | bc) - NEW_SCREEN_SIZE_X=$(echo $(awk "BEGIN {print $SCREEN_SIZE_X/$RATIO}")/1 | bc) - NEW_SCREEN_SIZE_Y=$(echo $(awk "BEGIN {print $SCREEN_SIZE_Y/$RATIO}")/1 | bc) + NEW_SCREEN_SIZE_X=$(echo $(awk "BEGIN {print $SCREEN_SIZE_X/$FLUXIONWindowRatio}")/1 | bc) + NEW_SCREEN_SIZE_Y=$(echo $(awk "BEGIN {print $SCREEN_SIZE_Y/$FLUXIONWindowRatio}")/1 | bc) - NEW_SCREEN_SIZE_BIG_X=$(echo $(awk "BEGIN {print 1.5*$SCREEN_SIZE_X/$RATIO}")/1 | bc) - NEW_SCREEN_SIZE_BIG_Y=$(echo $(awk "BEGIN {print 1.5*$SCREEN_SIZE_Y/$RATIO}")/1 | bc) + NEW_SCREEN_SIZE_BIG_X=$(echo $(awk "BEGIN {print 1.5*$SCREEN_SIZE_X/$FLUXIONWindowRatio}")/1 | bc) + NEW_SCREEN_SIZE_BIG_Y=$(echo $(awk "BEGIN {print 1.5*$SCREEN_SIZE_Y/$FLUXIONWindowRatio}")/1 | bc) SCREEN_SIZE_MID_X=$(echo $(($SCREEN_SIZE_X + ($SCREEN_SIZE_X - 2 * $NEW_SCREEN_SIZE_X) / 2))) SCREEN_SIZE_MID_Y=$(echo $(($SCREEN_SIZE_Y + ($SCREEN_SIZE_Y - 2 * $NEW_SCREEN_SIZE_Y) / 2))) - # Upper + # Upper windows TOPLEFT="-geometry $NEW_SCREEN_SIZE_Xx$NEW_SCREEN_SIZE_Y+0+0" TOPRIGHT="-geometry $NEW_SCREEN_SIZE_Xx$NEW_SCREEN_SIZE_Y-0+0" TOP="-geometry $NEW_SCREEN_SIZE_Xx$NEW_SCREEN_SIZE_Y+$SCREEN_SIZE_MID_X+0" - # Lower + # Lower windows BOTTOMLEFT="-geometry $NEW_SCREEN_SIZE_Xx$NEW_SCREEN_SIZE_Y+0-0" BOTTOMRIGHT="-geometry $NEW_SCREEN_SIZE_Xx$NEW_SCREEN_SIZE_Y-0-0" BOTTOM="-geometry $NEW_SCREEN_SIZE_Xx$NEW_SCREEN_SIZE_Y+$SCREEN_SIZE_MID_X-0" @@ -542,7 +545,7 @@ fluxion_do_sequence() { if [ ${#@} -ne 2 ]; then return -1; fi # TODO: Implement an alternative, better method of doing - # what this subroutine does, maybe using for-loop iteration. + # what this subroutine does, maybe using for-loop iteFLUXIONWindowRation. # The for-loop implementation must support the subroutines # defined above, including updating the namespace tracker. @@ -618,8 +621,8 @@ fluxion_header() { fluxion_unset_language() { FluxionLanguage="" - if [ "$FLUXIONPreferencesFile" ]; then - sed -i.backup "/FluxionLanguage=.\+/ d" "$FLUXIONPreferencesFile" + if [ "$FLUXIONLanguagePreferencesFile" ]; then + sed -i.backup "/FluxionLanguage=.\+/ d" "$FLUXIONLanguagePreferencesFile" fi } @@ -661,13 +664,13 @@ fluxion_set_language() { source "$FLUXIONPath/language/$FluxionLanguage.sh" - if [ "$FLUXIONPreferencesFile" ]; then - if more $FLUXIONPreferencesFile | \ + if [ "$FLUXIONLanguagePreferencesFile" ]; then + if more $FLUXIONLanguagePreferencesFile | \ grep -q "FluxionLanguage=.\+" &> /dev/null; then sed -r "s/FluxionLanguage=.+/FluxionLanguage=$FluxionLanguage/g" \ - -i.backup "$FLUXIONPreferencesFile" + -i.backup "$FLUXIONLanguagePreferencesFile" else - echo "FluxionLanguage=$FluxionLanguage" >> "$FLUXIONPreferencesFile" + echo "FluxionLanguage=$FluxionLanguage" >> "$FLUXIONLanguagePreferencesFile" fi fi } @@ -1013,7 +1016,7 @@ fluxion_target_get_candidates() { return 3 fi - # Syntheize scan operation results from output file "dump-01.csv." + # Syntheize scan opeFLUXIONWindowRation results from output file "dump-01.csv." echo -e "$FLUXIONVLine $FLUXIONPreparingScannerResultsNotice" # WARNING: The code below may break with different version of airmon-ng. # The times matching operator "{n}" isn't supported by mawk (alias awk). diff --git a/preferences/.gitkeep b/preferences/.gitkeep new file mode 100644 index 0000000..e69de29