Added missing safety checks & state updates.

This commit is contained in:
Matias Barcenas 2017-12-01 16:05:55 -06:00
parent 1c905a10d3
commit a6a4261ebd
2 changed files with 18 additions and 5 deletions

View File

@ -410,7 +410,7 @@ index-file.names = (
" > "$FLUXIONWorkspacePath/lighttpd.conf" " > "$FLUXIONWorkspacePath/lighttpd.conf"
# Create a DNS service with python, forwarding all traffic to gateway. # Create a DNS service with python, forwarding all traffic to gateway.
echo "\ echo "\
import socket import socket
@ -479,7 +479,7 @@ echo > \"$FLUXIONWorkspacePath/candidate.txt\"
echo -n \"0\"> \"$FLUXIONWorkspacePath/hit.txt\" echo -n \"0\"> \"$FLUXIONWorkspacePath/hit.txt\"
echo > \"$FLUXIONWorkspacePath/wpa_supplicant.log\" echo > \"$FLUXIONWorkspacePath/wpa_supplicant.log\"
# Make console cursor invisible, cnorm to revert. # Make console cursor invisible, cnorm to revert.
tput civis tput civis
clear clear
@ -910,7 +910,7 @@ function prep_attack() {
done done
# Check for prep abortion. # Check for prep abortion.
if [ "$CaptivePortalState" = "Not Ready" ]; then if [ "$CaptivePortalState" != "Ready" ]; then
unprep_attack unprep_attack
return 1; return 1;
fi fi
@ -950,10 +950,14 @@ function stop_attack() {
sandbox_remove_workfile "$FLUXIONWorkspacePath/clients.txt" sandbox_remove_workfile "$FLUXIONWorkspacePath/clients.txt"
captive_portal_stop_interface captive_portal_stop_interface
CaptivePortalState="Stopped"
} }
function start_attack() { function start_attack() {
if [ "$CaptivePortalState" = "Running" ]; then return 0; fi if [ "$CaptivePortalState" = "Running" ]; then return 0; fi
if [ "$CaptivePortalState" != "Ready" ]; then return 1; fi
CaptivePortalState="Running"
stop_attack stop_attack

View File

@ -6,7 +6,7 @@ HandshakeSnooperState="Not Ready"
################################# < Handshake Snooper > ################################ ################################# < Handshake Snooper > ################################
function handshake_snooper_arbiter_daemon() { function handshake_snooper_arbiter_daemon() {
if [ ${#@} -lt 1 ]; then return 1; fi if [ ${#@} -lt 1 -o "$HandshakeSnooperState" != "Running" ]; then return 1; fi
# Start daemon in the running state to continue execution until aborted, # Start daemon in the running state to continue execution until aborted,
# or until a hash has been verified to exist in the capture file. # or until a hash has been verified to exist in the capture file.
@ -121,6 +121,7 @@ function handshake_snooper_stop_captor() {
function handshake_snooper_start_captor() { function handshake_snooper_start_captor() {
if [ "$HANDSHAKECaptorPID" ]; then return 0; fi if [ "$HANDSHAKECaptorPID" ]; then return 0; fi
if [ "$HandshakeSnooperState" != "Running" ]; then return 1; fi
handshake_snooper_stop_captor handshake_snooper_stop_captor
@ -139,6 +140,7 @@ function handshake_snooper_stop_deauthenticator() {
function handshake_snooper_start_deauthenticator() { function handshake_snooper_start_deauthenticator() {
if [ "$HANDSHAKEDeauthenticatorPID" ]; then return 0; fi if [ "$HANDSHAKEDeauthenticatorPID" ]; then return 0; fi
if [ "$HandshakeSnooperState" != "Running" ]; then return 1; fi
handshake_snooper_stop_deauthenticator handshake_snooper_stop_deauthenticator
@ -248,6 +250,7 @@ function handshake_snooper_set_verifier_synchronicity() {
function unprep_attack() { function unprep_attack() {
HandshakeSnooperState="Not Ready" HandshakeSnooperState="Not Ready"
handshake_snooper_unset_verifier_synchronicity handshake_snooper_unset_verifier_synchronicity
handshake_snooper_unset_verifier_interval handshake_snooper_unset_verifier_interval
handshake_snooper_unset_verifier_identifier handshake_snooper_unset_verifier_identifier
@ -275,7 +278,7 @@ function prep_attack() {
done done
# Check for handshake abortion. # Check for handshake abortion.
if [ "$HandshakeSnooperState" = "Not Ready" ]; then if [ "$HandshakeSnooperState" != "Ready" ]; then
unprep_attack unprep_attack
return 1; return 1;
fi fi
@ -287,9 +290,15 @@ function stop_attack() {
fi fi
HANDSHAKEArbiterPID="" HANDSHAKEArbiterPID=""
HandshakeSnooperState="Stopped"
} }
function start_attack() { function start_attack() {
if [ "$HandshakeSnooperState" = "Running" ]; then return 0; fi
if [ "$HandshakeSnooperState" != "Ready" ]; then return 1; fi
HandshakeSnooperState="Running"
handshake_snooper_arbiter_daemon $$ &> $FLUXIONOutputDevice & handshake_snooper_arbiter_daemon $$ &> $FLUXIONOutputDevice &
HANDSHAKEArbiterPID=$! HANDSHAKEArbiterPID=$!
} }