diff --git a/attacks/Handshake Snooper/attack.sh b/attacks/Handshake Snooper/attack.sh index 51fe3fe..6653e9e 100755 --- a/attacks/Handshake Snooper/attack.sh +++ b/attacks/Handshake Snooper/attack.sh @@ -6,7 +6,6 @@ HandshakeSnooperState="Not Ready" - # ============================================================ # # ========= < Handshake Snooper Helper Subroutines > ========= # # ============================================================ # @@ -14,7 +13,6 @@ handshake_snooper_header() { fluxion_header; fluxion_target_show; echo } - # ============================================================ # # ============= < Handshake Snooper Subroutines > ============ # # ============================================================ # @@ -372,7 +370,7 @@ if [ ! "$HandshakeSnooperCLIArguments" ]; then getopt --options="v:i:j:a" \ --longoptions="verifier:,interval:,jammer:,asynchronous" \ --name="Handshake Snooper V$FLUXIONVersion.$FLUXIONRevision" -- "$@" - ); then + );n then echo -e "${CRed}Aborted$CClr, parameter error detected..." sleep 5 fluxion_handle_exit diff --git a/fluxion.sh b/fluxion.sh index 3dc4099..65ef628 100755 --- a/fluxion.sh +++ b/fluxion.sh @@ -4,7 +4,7 @@ # ================== < FLUXION Parameters > ================== # # ============================================================ # # Path to directory containing the FLUXION executable script. -readonly FLUXIONPath=$(dirname $(readlink -f "$0")) +readonly FLUXIONPath=$(dirname "$(readlink -f "$0")") # Path to directory containing the FLUXION library (scripts). readonly FLUXIONLibPath="$FLUXIONPath/lib" @@ -22,7 +22,7 @@ readonly FLUXIONNoiseFloor=-90 readonly FLUXIONNoiseCeiling=-60 readonly FLUXIONVersion=4 -readonly FLUXIONRevision=12 +readonly FLUXIONRevision=13 # Declare window ration bigger = smaller windows FLUXIONWindowRatio=4 @@ -34,32 +34,32 @@ FLUXIONSkipDependencies=0 # ================= < Script Sanity Checks > ================= # # ============================================================ # if [ $EUID -ne 0 ]; then # Super User Check - echo -e "\033[31mAborted, please execute the script as root.\033[0m"; exit 1 + echo -e "\\033[31mAborted, please execute the script as root.\\033[0m"; exit 1 fi # ===================== < XTerm Checks > ===================== # # TODO: Run the checks below only if we're not using tmux. if [ ! "${DISPLAY:-}" ]; then # Assure display is available. - echo -e "\033[31mAborted, X (graphical) session unavailable.\033[0m"; exit 2 + echo -e "\\033[31mAborted, X (graphical) session unavailable.\\033[0m"; exit 2 fi if ! hash xdpyinfo 2>/dev/null; then # Assure display probe. - echo -e "\033[31mAborted, xdpyinfo is unavailable.\033[0m"; exit 3 + echo -e "\\033[31mAborted, xdpyinfo is unavailable.\\033[0m"; exit 3 fi if ! xdpyinfo &>/dev/null; then # Assure display info available. - echo -e "\033[31mAborted, xterm test session failed.\033[0m"; exit 3 + echo -e "\\033[31mAborted, xterm test session failed.\\033[0m"; exit 3 fi # ================ < Parameter Parser Check > ================ # getopt --test > /dev/null # Assure enhanced getopt (returns 4). if [ $? -ne 4 ]; then - echo "\033[31mAborted, enhanced getopt isn't available.\033[0m"; exit 4 + echo "\\033[31mAborted, enhanced getopt isn't available.\\033[0m"; exit 4 fi # =============== < Working Directory Check > ================ # if ! mkdir -p "$FLUXIONWorkspacePath" &> /dev/null; then - echo "\033[31mAborted, can't generate a workspace directory.\033[0m"; exit 5 + echo "\\033[31mAborted, can't generate a workspace directory.\\033[0m"; exit 5 fi # Once sanity check is passed, we can start to load everything. @@ -104,7 +104,7 @@ fi eval set -- "$FLUXIONCLIArguments" # Set environment parameters. #[ "$1" != "--" ] && readonly FLUXIONAuto=1 # Auto-mode if using CLI. -while [ "$1" != "" -a "$1" != "--" ]; do +while [ "$1" != "" ] && [ "$1" != "--" ]; do case "$1" in -v|--version) echo "FLUXION V$FLUXIONVersion.$FLUXIONRevision"; exit;; -h|--help) fluxion_help; exit;; @@ -165,7 +165,7 @@ fi # FLUXIONDebug [Normal Mode "" / Developer Mode 1] if [ $FLUXIONDebug ]; then - touch /tmp/fluxion_debug_log + :> /tmp/fluxion_debug_log readonly FLUXIONOutputDevice="/tmp/fluxion_debug_log" readonly FLUXIONHoldXterm="-hold" else @@ -233,7 +233,7 @@ fluxion_startup() { "¯¯¯ ¯¯¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯ ¯¯¯ ¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯" banner+=("$FormatCenterLiterals") - clear + printf "\\e[2J"; if [ "$FLUXIONAuto" ]; then echo -e "$CBlu"; else echo -e "$CRed"; fi @@ -284,12 +284,12 @@ fluxion_startup() { echo echo -e "${CRed}Dependency installation failed!$CClr" echo "Press enter to retry, ctrl+c to exit..." - read bullshit + read -r bullshit fi done fi - echo -e "\n\n" # This echo is for spacing + echo -e "\\n\\n" # This echo is for spacing } fluxion_shutdown() { @@ -315,7 +315,8 @@ fluxion_shutdown() { local targetID # Program identifier/title for targetID in "${targets[@]}"; do # Get PIDs of all programs matching targetPID - local targetPID=$( + local targetPID + targetPID=$( echo "${processes[@]}" | awk '$4~/'"$targetID"'/{print $1}' ) if [ ! "$targetPID" ]; then continue; fi @@ -366,8 +367,8 @@ fluxion_shutdown() { echo -e "$CWht[$CRed-$CWht] $FLUXIONRestartingNetworkManagerNotice$CClr" # TODO: Add support for other network managers (wpa_supplicant?). - if [ $(which systemctl) ]; then - if [ $(which service) ];then + if [ ! -x "$(command -v systemctl)" ]; then + if [ -x "$(command -v service)" ];then service network-manager restart &> $FLUXIONOutputDevice & service networkmanager restart &> $FLUXIONOutputDevice & service networking restart &> $FLUXIONOutputDevice & @@ -382,7 +383,7 @@ fluxion_shutdown() { sleep 3 - clear + printf "\\e[2J"; exit 0 } @@ -394,7 +395,7 @@ fluxion_shutdown() { # Delete log only in Normal Mode ! fluxion_conditional_clear() { # Clear iff we're not in debug mode - if [ ! $FLUXIONDebug ]; then clear; fi + if [ ! $FLUXIONDebug ]; then printf "\\e[2J"; fi } fluxion_conditional_bail() { @@ -405,7 +406,7 @@ fluxion_conditional_bail() { return 1 fi echo "Press any key to continue execution..." - read bullshit + read -r bullshit } # ERROR Report only in Developer Mode @@ -484,9 +485,9 @@ trap fluxion_handle_target_change SIGALRM fluxion_set_resolution() { # Windows + Resolution # 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}')) + shopt -s checkwinsize; (:;:) + SCREEN_SIZE_X="$LINES" + SCREEN_SIZE_Y="$COLUMNS" # Calculate proportional windows if hash bc ;then @@ -540,7 +541,7 @@ declare -rA FLUXIONUndoable=( \ # Yes, I know, the identifiers are fucking ugly. If only we had # some type of mangling with bash identifiers, that'd be great. fluxion_do() { - if [ ${#@} -lt 2 ]; then return -1; fi + if [ ${#@} -lt 2 ]; then return 1; fi local -r __fluxion_do__namespace=$1 local -r __fluxion_do__identifier=$2 @@ -553,7 +554,7 @@ fluxion_do() { } fluxion_undo() { - if [ ${#@} -ne 1 ]; then return -1; fi + if [ ${#@} -ne 1 ]; then return 1; fi local -r __fluxion_undo__namespace=$1 @@ -567,7 +568,7 @@ fluxion_undo() { local __fluxion_undo__i for (( __fluxion_undo__i=${#__fluxion_undo__history[@]}; \ __fluxion_undo__i > 0; __fluxion_undo__i-- )); do - local __fluxion_undo__instruction=${__fluxion_undo__history[__fluxion_undo__i-1]} + local __fluxion_undo__instruction=${__fluxion_undo__history[__fluxion_undo__i1]} local __fluxion_undo__command=${__fluxion_undo__instruction%%_*} local __fluxion_undo__identifier=${__fluxion_undo__instruction#*_} @@ -582,21 +583,21 @@ fluxion_undo() { fi done - return -2 # The undo-chain failed. + return 2 # The undo-chain failed. } fluxion_done() { - if [ ${#@} -ne 1 ]; then return -1; fi + if [ ${#@} -ne 1 ]; then return 1; fi local -r __fluxion_done__namespace=$1 - eval "FluxionDone=\${FXDLog_$__fluxion_done__namespace[-1]}" + eval "FluxionDone=\${FXDLog_${__fluxion_done__namespace[1]}}" if [ ! "$FluxionDone" ]; then return 1; fi } fluxion_done_reset() { - if [ ${#@} -ne 1 ]; then return -1; fi + if [ ${#@} -ne 1 ]; then return 1; fi local -r __fluxion_done_reset__namespace=$1 @@ -604,7 +605,7 @@ fluxion_done_reset() { } fluxion_do_sequence() { - if [ ${#@} -ne 2 ]; then return -1; fi + if [ ${#@} -ne 2 ]; then return 1; fi # TODO: Implement an alternative, better method of doing # what this subroutine does, maybe using for-loop iteFLUXIONWindowRation. @@ -692,7 +693,7 @@ fluxion_set_language() { if [ ! "$FluxionLanguage" ]; then # Get all languages available. local languageCodes - readarray -t languageCodes < <(ls -1 language | sed -E 's/\.sh//') + readarray -t languageCodes < <(ls 1 language | sed -E 's/\.sh//') local languages readarray -t languages < <( @@ -767,7 +768,7 @@ fluxion_deallocate_interface() { # Release interfaces fi # Attempt to restore the original interface identifier. - if ! interface_reidentify $oldIdentifier $newIdentifier; then + if ! interface_reidentify "$oldIdentifier" "$newIdentifier"; then return 5 fi fi @@ -952,7 +953,7 @@ fluxion_next_assignable_interface() { # Parameters: [] # Note: The interfaces lambda must print an interface per line. # ------------------------------------------------------------ # -# Return -1: Go back +# Return 1: Go back # Return 1: Missing interfaces lambda identifier (not passed). fluxion_get_interface() { if ! type -t "$1" &> /dev/null; then return 1; fi @@ -1045,7 +1046,7 @@ fluxion_get_interface() { FluxionInterfaceSelectedInfo="" return 0;; "$FLUXIONGeneralRepeatOption") continue;; - "$FLUXIONGeneralBackOption") return -1;; + "$FLUXIONGeneralBackOption") return 1;; *) FluxionInterfaceSelected="${IOQueryFormatFields[1]}" FluxionInterfaceSelectedState="${IOQueryFormatFields[2]}" @@ -1174,7 +1175,7 @@ fluxion_get_target() { fluxion_target_get_candidates $interface $channels;; "$FLUXIONGeneralBackOption") - return -1;; + return 1;; esac # Abort if errors occured while searching for candidates. @@ -1191,7 +1192,7 @@ fluxion_get_target() { # Gather information from all the candidates detected. # TODO: Clean up this for loop using a cleaner algorithm. - # Maybe try using array appending & [-1] for last elements. + # Maybe try using array appending & [1] for last elements. for candidateAPInfo in "${FluxionTargetCandidates[@]}"; do # Strip candidate info from any extraneous spaces after commas. candidateAPInfo=$(echo "$candidateAPInfo" | sed -r "s/,\s*/,/g") @@ -1218,8 +1219,8 @@ fluxion_get_target() { candidatesESSID[i]=$(eval "echo \$'$sanitizedESSID'") local power=${candidatesPower[i]} - if [ $power -eq -1 ]; then - # airodump-ng's man page says -1 means unsupported value. + if [ $power -eq 1 ]; then + # airodump-ng's man page says 1 means unsupported value. candidatesQuality[i]="??" elif [ $power -le $FLUXIONNoiseFloor ]; then candidatesQuality[i]=0 @@ -1550,7 +1551,7 @@ fluxion_hash_verify() { local -r verifier="cowpatty" ;; "$FLUXIONGeneralBackOption") - return -1 ;; + return 1 ;; esac fi @@ -1624,7 +1625,7 @@ fluxion_hash_set_path() { return $? ;; "$FLUXIONGeneralBackOption") - return -1 ;; + return 1 ;; esac fi fi @@ -1641,7 +1642,7 @@ fluxion_hash_set_path() { # Back-track when the user leaves the hash path blank. # Notice: Path is cleared if we return, no need to unset. - if [ ! "$FluxionHashPath" ]; then return -1; fi + if [ ! "$FluxionHashPath" ]; then return 1; fi # Make sure the path points to a valid generic file. if [ ! -f "$FluxionHashPath" -o ! -s "$FluxionHashPath" ]; then @@ -1660,7 +1661,7 @@ fluxion_hash_get_path() { while true; do fluxion_hash_unset_path if ! fluxion_hash_set_path "$@"; then - return -1 # WARNING: The recent error code is NOT contained in $? here! + return 1 # WARNING: The recent error code is NOT contained in $? here! fi if fluxion_hash_verify "$FluxionHashPath" "$2" "$3"; then @@ -1692,7 +1693,7 @@ fluxion_set_attack() { fluxion_target_show local attacks - readarray -t attacks < <(ls -1 "$FLUXIONPath/attacks") + readarray -t attacks < <(ls 1 "$FLUXIONPath/attacks") local descriptions readarray -t descriptions < <( @@ -1726,7 +1727,7 @@ fluxion_set_attack() { echo if [ "${IOQueryFormatFields[1]}" = "$FLUXIONGeneralBackOption" ]; then - return -1 + return 1 fi if [ "${IOQueryFormatFields[1]}" = "$FLUXIONAttackRestartOption" ]; then @@ -1843,7 +1844,6 @@ fluxion_run_attack() { fluxion_unset_attack } - # ============================================================ # # ================= < Argument Executables > ================= # # ============================================================ # @@ -1855,7 +1855,6 @@ while [ "$1" != "" -a "$1" != "--" ]; do shift # Shift new parameters done - # ============================================================ # # ===================== < FLUXION Loop > ===================== # # ============================================================ # diff --git a/misc/check_device.sh b/misc/check_device.sh new file mode 100755 index 0000000..f791867 --- /dev/null +++ b/misc/check_device.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +fluxion_check_ap() { + readonly SUPPORT_AP=$(sed -n -e "$(echo $(($1+4)))p" devices.xml | cut -d ">" -f2 | cut -d "<" -f1) + if [ "$SUPPORT_AP" == "n" ];then + echo "false" + fi +} + +fluxion_check_mo() { + readonly SUPPORT_MO=$(sed -n -e "$(echo $(($1+6)))p" devices.xml | cut -d ">" -f2 | cut -d "<" -f1) + if [ "$SUPPORT_MO" == "n" ];then + echo "false" + fi +} + +# first identifier +fluxion_check_chipset() { + declare -r LINE=$(grep "$1" devices.xml -n | head -n 1 | cut -d ":" -f1) + + if [ "$(fluxion_check_ap "$LINE")" == "false" ] || [ "$(fluxion_check_mo "$LINE")" == "false" ];then + echo "false" + else + echo "true" + fi +} + +fluxion_check_chipset "$1"