Fixed multiple bugs introduced in commit 3353955.

This commit is contained in:
Matias Barcenas 2018-07-12 00:04:26 -05:00
parent b615cf7d09
commit 153d6caec5
1 changed files with 29 additions and 24 deletions

View File

@ -22,7 +22,7 @@ readonly FLUXIONNoiseFloor=-90
readonly FLUXIONNoiseCeiling=-60 readonly FLUXIONNoiseCeiling=-60
readonly FLUXIONVersion=4 readonly FLUXIONVersion=4
readonly FLUXIONRevision=13 readonly FLUXIONRevision=14
# Declare window ration bigger = smaller windows # Declare window ration bigger = smaller windows
FLUXIONWindowRatio=4 FLUXIONWindowRatio=4
@ -233,7 +233,7 @@ fluxion_startup() {
"¯¯¯ ¯¯¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯ ¯¯¯ ¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯" "¯¯¯ ¯¯¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯ ¯¯¯ ¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯"
banner+=("$FormatCenterLiterals") banner+=("$FormatCenterLiterals")
printf "\\e[2J"; clear
if [ "$FLUXIONAuto" ]; then echo -e "$CBlu"; else echo -e "$CRed"; fi if [ "$FLUXIONAuto" ]; then echo -e "$CBlu"; else echo -e "$CRed"; fi
@ -383,7 +383,7 @@ fluxion_shutdown() {
sleep 3 sleep 3
printf "\\e[2J"; clear
exit 0 exit 0
} }
@ -395,7 +395,7 @@ fluxion_shutdown() {
# Delete log only in Normal Mode ! # Delete log only in Normal Mode !
fluxion_conditional_clear() { fluxion_conditional_clear() {
# Clear iff we're not in debug mode # Clear iff we're not in debug mode
if [ ! $FLUXIONDebug ]; then printf "\\e[2J"; fi if [ ! $FLUXIONDebug ]; then clear; fi
} }
fluxion_conditional_bail() { fluxion_conditional_bail() {
@ -485,9 +485,14 @@ trap fluxion_handle_target_change SIGALRM
fluxion_set_resolution() { # Windows + Resolution fluxion_set_resolution() { # Windows + Resolution
# Get dimensions # Get dimensions
shopt -s checkwinsize; (:;:) # Verify this works on Kali before commiting.
SCREEN_SIZE_X="$LINES" # shopt -s checkwinsize; (:;:)
SCREEN_SIZE_Y="$COLUMNS" # SCREEN_SIZE_X="$LINES"
# SCREEN_SIZE_Y="$COLUMNS"
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 # Calculate proportional windows
if hash bc ;then if hash bc ;then
@ -541,7 +546,7 @@ declare -rA FLUXIONUndoable=( \
# Yes, I know, the identifiers are fucking ugly. If only we had # Yes, I know, the identifiers are fucking ugly. If only we had
# some type of mangling with bash identifiers, that'd be great. # some type of mangling with bash identifiers, that'd be great.
fluxion_do() { 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__namespace=$1
local -r __fluxion_do__identifier=$2 local -r __fluxion_do__identifier=$2
@ -554,7 +559,7 @@ fluxion_do() {
} }
fluxion_undo() { fluxion_undo() {
if [ ${#@} -ne 1 ]; then return 1; fi if [ ${#@} -ne 1 ]; then return -1; fi
local -r __fluxion_undo__namespace=$1 local -r __fluxion_undo__namespace=$1
@ -568,7 +573,7 @@ fluxion_undo() {
local __fluxion_undo__i local __fluxion_undo__i
for (( __fluxion_undo__i=${#__fluxion_undo__history[@]}; \ for (( __fluxion_undo__i=${#__fluxion_undo__history[@]}; \
__fluxion_undo__i > 0; __fluxion_undo__i-- )); do __fluxion_undo__i > 0; __fluxion_undo__i-- )); do
local __fluxion_undo__instruction=${__fluxion_undo__history[__fluxion_undo__i1]} local __fluxion_undo__instruction=${__fluxion_undo__history[__fluxion_undo__i-1]}
local __fluxion_undo__command=${__fluxion_undo__instruction%%_*} local __fluxion_undo__command=${__fluxion_undo__instruction%%_*}
local __fluxion_undo__identifier=${__fluxion_undo__instruction#*_} local __fluxion_undo__identifier=${__fluxion_undo__instruction#*_}
@ -583,21 +588,21 @@ fluxion_undo() {
fi fi
done done
return 2 # The undo-chain failed. return -2 # The undo-chain failed.
} }
fluxion_done() { fluxion_done() {
if [ ${#@} -ne 1 ]; then return 1; fi if [ ${#@} -ne 1 ]; then return -1; fi
local -r __fluxion_done__namespace=$1 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 if [ ! "$FluxionDone" ]; then return 1; fi
} }
fluxion_done_reset() { fluxion_done_reset() {
if [ ${#@} -ne 1 ]; then return 1; fi if [ ${#@} -ne 1 ]; then return -1; fi
local -r __fluxion_done_reset__namespace=$1 local -r __fluxion_done_reset__namespace=$1
@ -953,7 +958,7 @@ fluxion_next_assignable_interface() {
# Parameters: <interfaces:lambda> [<query>] # Parameters: <interfaces:lambda> [<query>]
# Note: The interfaces lambda must print an interface per line. # 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). # Return 1: Missing interfaces lambda identifier (not passed).
fluxion_get_interface() { fluxion_get_interface() {
if ! type -t "$1" &> /dev/null; then return 1; fi if ! type -t "$1" &> /dev/null; then return 1; fi
@ -1046,7 +1051,7 @@ fluxion_get_interface() {
FluxionInterfaceSelectedInfo="" FluxionInterfaceSelectedInfo=""
return 0;; return 0;;
"$FLUXIONGeneralRepeatOption") continue;; "$FLUXIONGeneralRepeatOption") continue;;
"$FLUXIONGeneralBackOption") return 1;; "$FLUXIONGeneralBackOption") return -1;;
*) *)
FluxionInterfaceSelected="${IOQueryFormatFields[1]}" FluxionInterfaceSelected="${IOQueryFormatFields[1]}"
FluxionInterfaceSelectedState="${IOQueryFormatFields[2]}" FluxionInterfaceSelectedState="${IOQueryFormatFields[2]}"
@ -1175,7 +1180,7 @@ fluxion_get_target() {
fluxion_target_get_candidates $interface $channels;; fluxion_target_get_candidates $interface $channels;;
"$FLUXIONGeneralBackOption") "$FLUXIONGeneralBackOption")
return 1;; return -1;;
esac esac
# Abort if errors occured while searching for candidates. # Abort if errors occured while searching for candidates.
@ -1192,7 +1197,7 @@ fluxion_get_target() {
# Gather information from all the candidates detected. # Gather information from all the candidates detected.
# TODO: Clean up this for loop using a cleaner algorithm. # 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 for candidateAPInfo in "${FluxionTargetCandidates[@]}"; do
# Strip candidate info from any extraneous spaces after commas. # Strip candidate info from any extraneous spaces after commas.
candidateAPInfo=$(echo "$candidateAPInfo" | sed -r "s/,\s*/,/g") candidateAPInfo=$(echo "$candidateAPInfo" | sed -r "s/,\s*/,/g")
@ -1219,8 +1224,8 @@ fluxion_get_target() {
candidatesESSID[i]=$(eval "echo \$'$sanitizedESSID'") candidatesESSID[i]=$(eval "echo \$'$sanitizedESSID'")
local power=${candidatesPower[i]} local power=${candidatesPower[i]}
if [ $power -eq 1 ]; then if [ $power -eq -1 ]; then
# airodump-ng's man page says 1 means unsupported value. # airodump-ng's man page says -1 means unsupported value.
candidatesQuality[i]="??" candidatesQuality[i]="??"
elif [ $power -le $FLUXIONNoiseFloor ]; then elif [ $power -le $FLUXIONNoiseFloor ]; then
candidatesQuality[i]=0 candidatesQuality[i]=0
@ -1551,7 +1556,7 @@ fluxion_hash_verify() {
local -r verifier="cowpatty" ;; local -r verifier="cowpatty" ;;
"$FLUXIONGeneralBackOption") "$FLUXIONGeneralBackOption")
return 1 ;; return -1 ;;
esac esac
fi fi
@ -1625,7 +1630,7 @@ fluxion_hash_set_path() {
return $? ;; return $? ;;
"$FLUXIONGeneralBackOption") "$FLUXIONGeneralBackOption")
return 1 ;; return -1 ;;
esac esac
fi fi
fi fi
@ -1661,7 +1666,7 @@ fluxion_hash_get_path() {
while true; do while true; do
fluxion_hash_unset_path fluxion_hash_unset_path
if ! fluxion_hash_set_path "$@"; then 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 fi
if fluxion_hash_verify "$FluxionHashPath" "$2" "$3"; then if fluxion_hash_verify "$FluxionHashPath" "$2" "$3"; then
@ -1727,7 +1732,7 @@ fluxion_set_attack() {
echo echo
if [ "${IOQueryFormatFields[1]}" = "$FLUXIONGeneralBackOption" ]; then if [ "${IOQueryFormatFields[1]}" = "$FLUXIONGeneralBackOption" ]; then
return 1 return -1
fi fi
if [ "${IOQueryFormatFields[1]}" = "$FLUXIONAttackRestartOption" ]; then if [ "${IOQueryFormatFields[1]}" = "$FLUXIONAttackRestartOption" ]; then