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 ($()).
This commit is contained in:
Matias Barcenas 2018-01-10 20:17:08 -06:00
parent 7a61592df5
commit 3185ca9ad8
1 changed files with 35 additions and 22 deletions

55
fluxion
View File

@ -545,7 +545,7 @@ fluxion_do_sequence() {
local __fluxion_do_sequence__instruction=${__fluxion_do_sequence__sequence[0]} local __fluxion_do_sequence__instruction=${__fluxion_do_sequence__sequence[0]}
while [ "$__fluxion_do_sequence__instruction" ]; do while [ "$__fluxion_do_sequence__instruction" ]; do
if ! fluxion_do $__fluxion_do_sequence__namespace $__fluxion_do_sequence__instruction; then 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 break
fi fi
fi fi
@ -745,7 +745,7 @@ fluxion_allocate_interface() { # Reserve interfaces
# TODO: Make the loop below airmon-ng independent. # TODO: Make the loop below airmon-ng independent.
# Maybe replace it with a list of network-managers? # Maybe replace it with a list of network-managers?
# WARNING: Version differences could break code below. # 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 killall "$program" &> $FLUXIONOutputDevice
done done
fi fi
@ -849,7 +849,7 @@ fluxion_get_interface() {
local interfacesAvailableState=() local interfacesAvailableState=()
# Gather information from all available interfaces. # Gather information from all available interfaces.
local -r interfacesAvailableCount=${#interfacesAvailable[@]} local interfacesAvailableCount=${#interfacesAvailable[@]}
local i local i
for (( i = 0; i < interfacesAvailableCount; i++ )); do 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 only one interface exists and it's not unavailable, choose it.
if [ "${#interfacesAvailable[@]}" -eq 1 -a \ if [ "${#interfacesAvailable[@]}" -eq 1 -a \
"${interfacesAvailableState[0]}" != "[-]" ]; then "${interfacesAvailableState[0]}" != "[-]" ]; then
FluxionGetInterfaceSelected="${interfacesAvailable[0]}" FluxionInterfaceSelected="${interfacesAvailable[0]}"
FluxionGetInterfaceSelectedState="${interfacesAvailableState[0]}" FluxionInterfaceSelectedState="${interfacesAvailableState[0]}"
FluxionGetInterfaceSelectedInfo="${interfacesAvailableInfo[0]}" FluxionInterfaceSelectedInfo="${interfacesAvailableInfo[0]}"
break
else else
interfacesAvailable+=( \ interfacesAvailable+=( \
"$FLUXIONGeneralRepeatOption" \ "$FLUXIONGeneralRepeatOption" \
@ -907,14 +908,14 @@ fluxion_get_interface() {
case "${IOQueryFormatFields[1]}" in case "${IOQueryFormatFields[1]}" in
"$FLUXIONGeneralRepeatOption") continue;; "$FLUXIONGeneralRepeatOption") continue;;
"$FLUXIONGeneralBackOption") return -1;; "$FLUXIONGeneralBackOption") return -1;;
*) break;; *)
esac
fi
done
FluxionInterfaceSelected="${IOQueryFormatFields[1]}" FluxionInterfaceSelected="${IOQueryFormatFields[1]}"
FluxionInterfaceSelectedState="${IOQueryFormatFields[2]}" FluxionInterfaceSelectedState="${IOQueryFormatFields[2]}"
FluxionInterfaceSelectedInfo="${IOQueryFormatFields[3]}" FluxionInterfaceSelectedInfo="${IOQueryFormatFields[3]}"
break;;
esac
fi
done
} }
@ -970,11 +971,11 @@ fluxion_target_get_candidates() {
# ) # )
local -r matchMAC="([A-F0-9][A-F0-9]:)+[A-F0-9][A-F0-9]" local -r matchMAC="([A-F0-9][A-F0-9]:)+[A-F0-9][A-F0-9]"
readarray FluxionTargetCandidates < <( 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" "$FLUXIONWorkspacePath/dump-01.csv"
) )
readarray FluxionTargetCandidatesClients < <( 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" "$FLUXIONWorkspacePath/dump-01.csv"
) )
@ -1089,10 +1090,10 @@ fluxion_get_target() {
else else
# Bash doesn't support floating point division, work around it... # Bash doesn't support floating point division, work around it...
# Q = ((P - F) / (C - F)); Q-quality, P-power, F-floor, C-Ceiling. # Q = ((P - F) / (C - F)); Q-quality, P-power, F-floor, C-Ceiling.
candidatesQuality[i]=$( candidatesQuality[i]=$(( \
((${candidatesPower[i]} * 10 - $FLUXIONNoiseFloor * 10) / \ (${candidatesPower[i]} * 10 - $FLUXIONNoiseFloor * 10) / \
(($FLUXIONNoiseCeiling - $FLUXIONNoiseFloor) / 10)) (($FLUXIONNoiseCeiling - $FLUXIONNoiseFloor) / 10) \
) ))
fi fi
done done
@ -1221,8 +1222,8 @@ fluxion_hash_verify() {
hash_check_handshake \ hash_check_handshake \
"$verifier" \ "$verifier" \
"$hashPath" \ "$hashPath" \
"$APTargetSSID" \ "$hashESSID" \
"$APTargetMAC" "$hashBSSID"
local -r hashResult=$? local -r hashResult=$?
@ -1400,7 +1401,19 @@ fluxion_prep_attack() {
source "$path/language/$FluxionLanguage.sh" source "$path/language/$FluxionLanguage.sh"
source "$path/attack.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 if ! prep_attack "$@"; then
fluxion_unprep_attack fluxion_unprep_attack
@ -1417,7 +1430,7 @@ fluxion_run_attack() {
) )
io_query_choice \ io_query_choice \
"`io_dynamic_output $FLUXIONAttackInProgressNotice`" choices[@] "$(io_dynamic_output $FLUXIONAttackInProgressNotice)" choices[@]
echo echo