From 3185ca9ad8239ebea546b2420d27efed9b7a2b5b Mon Sep 17 00:00:00 2001 From: Matias Barcenas Date: Wed, 10 Jan 2018 20:17:08 -0600 Subject: [PATCH] Added attack targetting, minor bug & styling fixes. Added optional targetting functionality for attacks opting to use it. Fixed bugs caused by line length reduction (improperly escaping line). Corrected old tick-marks to new sub-shell marks ($()). --- fluxion | 57 +++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/fluxion b/fluxion index 137213f..cba1b78 100755 --- a/fluxion +++ b/fluxion @@ -545,7 +545,7 @@ fluxion_do_sequence() { local __fluxion_do_sequence__instruction=${__fluxion_do_sequence__sequence[0]} while [ "$__fluxion_do_sequence__instruction" ]; do if ! fluxion_do $__fluxion_do_sequence__namespace $__fluxion_do_sequence__instruction; then - if ! fluxion_undo; then $__fluxion_do_sequence__namespace + if ! fluxion_undo $__fluxion_do_sequence__namespace; then $__fluxion_do_sequence__namespace break fi fi @@ -745,7 +745,7 @@ fluxion_allocate_interface() { # Reserve interfaces # TODO: Make the loop below airmon-ng independent. # Maybe replace it with a list of network-managers? # WARNING: Version differences could break code below. - for program in "`airmon-ng check | awk 'NR>6{print $2}'`"; do + for program in "$(airmon-ng check | awk 'NR>6{print $2}')"; do killall "$program" &> $FLUXIONOutputDevice done fi @@ -849,7 +849,7 @@ fluxion_get_interface() { local interfacesAvailableState=() # Gather information from all available interfaces. - local -r interfacesAvailableCount=${#interfacesAvailable[@]} + local interfacesAvailableCount=${#interfacesAvailable[@]} local i for (( i = 0; i < interfacesAvailableCount; i++ )); do @@ -880,9 +880,10 @@ fluxion_get_interface() { # If only one interface exists and it's not unavailable, choose it. if [ "${#interfacesAvailable[@]}" -eq 1 -a \ "${interfacesAvailableState[0]}" != "[-]" ]; then - FluxionGetInterfaceSelected="${interfacesAvailable[0]}" - FluxionGetInterfaceSelectedState="${interfacesAvailableState[0]}" - FluxionGetInterfaceSelectedInfo="${interfacesAvailableInfo[0]}" + FluxionInterfaceSelected="${interfacesAvailable[0]}" + FluxionInterfaceSelectedState="${interfacesAvailableState[0]}" + FluxionInterfaceSelectedInfo="${interfacesAvailableInfo[0]}" + break else interfacesAvailable+=( \ "$FLUXIONGeneralRepeatOption" \ @@ -907,14 +908,14 @@ fluxion_get_interface() { case "${IOQueryFormatFields[1]}" in "$FLUXIONGeneralRepeatOption") continue;; "$FLUXIONGeneralBackOption") return -1;; - *) break;; + *) + FluxionInterfaceSelected="${IOQueryFormatFields[1]}" + FluxionInterfaceSelectedState="${IOQueryFormatFields[2]}" + FluxionInterfaceSelectedInfo="${IOQueryFormatFields[3]}" + break;; esac fi done - - FluxionInterfaceSelected="${IOQueryFormatFields[1]}" - FluxionInterfaceSelectedState="${IOQueryFormatFields[2]}" - FluxionInterfaceSelectedInfo="${IOQueryFormatFields[3]}" } @@ -970,11 +971,11 @@ fluxion_target_get_candidates() { # ) local -r matchMAC="([A-F0-9][A-F0-9]:)+[A-F0-9][A-F0-9]" readarray FluxionTargetCandidates < <( - awk -F, "NF==15 && length(\$1)==17 && \$1~/$matchMAC/ {print \$0}" + awk -F, "NF==15 && length(\$1)==17 && \$1~/$matchMAC/ {print \$0}" \ "$FLUXIONWorkspacePath/dump-01.csv" ) readarray FluxionTargetCandidatesClients < <( - awk -F, "NF==7 && length(\$1)==17 && \$1~/$matchMAC/ {print \$0}" + awk -F, "NF==7 && length(\$1)==17 && \$1~/$matchMAC/ {print \$0}" \ "$FLUXIONWorkspacePath/dump-01.csv" ) @@ -1089,10 +1090,10 @@ fluxion_get_target() { else # Bash doesn't support floating point division, work around it... # Q = ((P - F) / (C - F)); Q-quality, P-power, F-floor, C-Ceiling. - candidatesQuality[i]=$( - ((${candidatesPower[i]} * 10 - $FLUXIONNoiseFloor * 10) / \ - (($FLUXIONNoiseCeiling - $FLUXIONNoiseFloor) / 10)) - ) + candidatesQuality[i]=$(( \ + (${candidatesPower[i]} * 10 - $FLUXIONNoiseFloor * 10) / \ + (($FLUXIONNoiseCeiling - $FLUXIONNoiseFloor) / 10) \ + )) fi done @@ -1221,8 +1222,8 @@ fluxion_hash_verify() { hash_check_handshake \ "$verifier" \ "$hashPath" \ - "$APTargetSSID" \ - "$APTargetMAC" + "$hashESSID" \ + "$hashBSSID" local -r hashResult=$? @@ -1399,8 +1400,20 @@ fluxion_prep_attack() { # will define the constant FLUXIONAttackTargetted. source "$path/language/$FluxionLanguage.sh" source "$path/attack.sh" - - if + + # Check if attack is targetted & set the attack target. + if type -t attack_targetting_interfaces &> /dev/null; then + if ! fluxion_get_interface attack_targetting_interfaces; then + return 3 + fi + if ! fluxion_allocate_interface $FluxionInterfaceSelected; then + return 4 + fi + if ! fluxion_get_target \ + ${FluxionInterfaces[$FluxionInterfaceSelected]}; then + return 5 + fi + fi if ! prep_attack "$@"; then fluxion_unprep_attack @@ -1417,7 +1430,7 @@ fluxion_run_attack() { ) io_query_choice \ - "`io_dynamic_output $FLUXIONAttackInProgressNotice`" choices[@] + "$(io_dynamic_output $FLUXIONAttackInProgressNotice)" choices[@] echo