Handshake Snooper target tracking implemented.

This commit is contained in:
Matias Barcenas 2018-04-22 22:16:37 -05:00
parent a95b67efd9
commit 147147b631
2 changed files with 71 additions and 40 deletions

View File

@ -224,6 +224,7 @@ handshake_snooper_set_deauthenticator_identifier() {
handshake_snooper_unset_jammer_interface() { handshake_snooper_unset_jammer_interface() {
if [ ! "$HandshakeSnooperJammerInterface" ]; then return 1; fi if [ ! "$HandshakeSnooperJammerInterface" ]; then return 1; fi
HandshakeSnooperJammerInterface="" HandshakeSnooperJammerInterface=""
HandshakeSnooperJammerInterfaceOriginal=""
# Check if we're automatically selecting the interface & skip # Check if we're automatically selecting the interface & skip
# this one if so to take the user back properly. # this one if so to take the user back properly.
@ -238,19 +239,18 @@ handshake_snooper_set_jammer_interface() {
#if [ "$HandshakeSnooperDeauthenticatorIdentifier" = \ #if [ "$HandshakeSnooperDeauthenticatorIdentifier" = \
# "$HandshakeSnooperMonitorMethodOption" ]; then return 0; fi # "$HandshakeSnooperMonitorMethodOption" ]; then return 0; fi
if [ ! "$HandshakeSnooperUninitializedJammerInterface" ]; then if [ ! "$HandshakeSnooperJammerInterfaceOriginal" ]; then
echo "Running get jammer interface." > $FLUXIONOutputDevice echo "Running get jammer interface." > $FLUXIONOutputDevice
if ! fluxion_get_interface attack_targetting_interfaces \ if ! fluxion_get_interface attack_targetting_interfaces \
"$HandshakeSnooperJammerInterfaceQuery"; then "$HandshakeSnooperJammerInterfaceQuery"; then
echo "Failed to get jammer interface" > $FLUXIONOutputDevice echo "Failed to get jammer interface" > $FLUXIONOutputDevice
return 1 return 1
fi fi
local selectedInterface=$FluxionInterfaceSelected HandshakeSnooperJammerInterfaceOriginal=$FluxionInterfaceSelected
else
local selectedInterface=$HandshakeSnooperUninitializedJammerInterface
unset HandshakeSnooperUninitializedJammerInterface
fi fi
local selectedInterface=$HandshakeSnooperJammerInterfaceOriginal
if ! fluxion_allocate_interface $selectedInterface; then if ! fluxion_allocate_interface $selectedInterface; then
echo "Failed to allocate jammer interface" > $FLUXIONOutputDevice echo "Failed to allocate jammer interface" > $FLUXIONOutputDevice
return 2 return 2
@ -424,31 +424,6 @@ prep_attack() {
IOUtilsHeader="handshake_snooper_header" IOUtilsHeader="handshake_snooper_header"
local -r attackPath="$FLUXIONPath/attacks/Handshake Snooper"
# Attempt loading configuration if one is available.
# TODO: Enable this by removing extraneous " -a ! " when properly implemented.
if [ -f "$attackPath/attack.conf" ]; then
local choice=${1:+Y}
# TODO: This doesn't translate choices to the selected language.
while ! echo "$choice" | grep -q "^[ynYN]$" &> /dev/null; do
echo -ne "$FLUXIONVLine Would you like to repeat the last attack? [Y/n] "
read choice
if [ ! "$choice" ]; then break; fi
done
if [ "${choice,,}" != "n" ]; then
local configuration
readarray -t configuration < <(more "$attackPath/attack.conf")
HandshakeSnooperDeauthenticatorIdentifier=${configuration[0]}
HandshakeSnooperUninitializedJammerInterface=${configuration[1]}
HandshakeSnooperVerifierIdentifier=${configuration[2]}
HandshakeSnooperVerifierInterval=${configuration[3]}
HandshakeSnooperVerifierSynchronicity=${configuration[4]}
fi
fi
# Removed read-only due to local constant shadowing bug. # Removed read-only due to local constant shadowing bug.
# I've reported the bug, we can add it when fixed. # I've reported the bug, we can add it when fixed.
local sequence=( local sequence=(
@ -463,15 +438,32 @@ prep_attack() {
return 1 return 1
fi fi
HandshakeSnooperState="Ready"
}
load_attack() {
local -r configurationPath=$1
local configuration
readarray -t configuration < <(more "$configurationPath")
HandshakeSnooperDeauthenticatorIdentifier=${configuration[0]}
HandshakeSnooperJammerInterfaceOriginal=${configuration[1]}
HandshakeSnooperVerifierIdentifier=${configuration[2]}
HandshakeSnooperVerifierInterval=${configuration[3]}
HandshakeSnooperVerifierSynchronicity=${configuration[4]}
}
save_attack() {
local -r configurationPath=$1
# Store/overwrite attack configuration for pause & resume. # Store/overwrite attack configuration for pause & resume.
# Order: DeauthID, JammerWI, VerifId, VerifInt, VerifSync # Order: DeauthID, JammerWI, VerifId, VerifInt, VerifSync
echo "$HandshakeSnooperDeauthenticatorIdentifier" > "$attackPath/attack.conf" echo "$HandshakeSnooperDeauthenticatorIdentifier" > "$configurationPath"
echo "$HandshakeSnooperJammerInterface" >> "$attackPath/attack.conf" echo "$HandshakeSnooperJammerInterfaceOriginal" >> "$configurationPath"
echo "$HandshakeSnooperVerifierIdentifier" >> "$attackPath/attack.conf" echo "$HandshakeSnooperVerifierIdentifier" >> "$configurationPath"
echo "$HandshakeSnooperVerifierInterval" >> "$attackPath/attack.conf" echo "$HandshakeSnooperVerifierInterval" >> "$configurationPath"
echo "$HandshakeSnooperVerifierSynchronicity" >> "$attackPath/attack.conf" echo "$HandshakeSnooperVerifierSynchronicity" >> "$configurationPath"
HandshakeSnooperState="Ready"
} }
stop_attack() { stop_attack() {

View File

@ -450,6 +450,22 @@ fluxion_handle_target_change() {
FluxionTargetChannel=${targetInfo[2]} FluxionTargetChannel=${targetInfo[2]}
FluxionTargetSSIDClean=$(fluxion_target_normalize_SSID) FluxionTargetSSIDClean=$(fluxion_target_normalize_SSID)
if ! stop_attack; then
fluxion_conditional_bail "Target tracker failed to stop attack."
fi
if ! load_attack "$FLUXIONPath/attacks/$FluxionAttack/attack.conf"; then
fluxion_conditional_bail "Target tracker failed to load attack."
fi
if ! prep_attack; then
fluxion_conditional_bail "Target tracker failed to prep attack."
fi
if ! fluxion_run_attack; then
fluxion_conditional_bail "Target tracker failed to start attack."
fi
} }
# If target monitoring enabled, act on changes. # If target monitoring enabled, act on changes.
@ -1736,11 +1752,34 @@ fluxion_prep_attack() {
# Check if attack provides tracking interfaces, get & set one. # Check if attack provides tracking interfaces, get & set one.
# TODO: Uncomment the lines below after implementation. # TODO: Uncomment the lines below after implementation.
#if type -t attack_tracking_interfaces &> /dev/null; then if type -t attack_tracking_interfaces &> /dev/null; then
# if ! fluxion_target_set_tracker; then return 4; fi if ! fluxion_target_set_tracker; then return 4; fi
#fi fi
# If attack is capable of restoration, check for configuration.
if type -t load_attack &> /dev/null; then
# If configuration file available, check if user wants to restore.
if [ -f "$path/attack.conf" ]; then
local choice=${1:+Y}
# TODO: This doesn't translate choices to the selected language.
while ! echo "$choice" | grep -q "^[ynYN]$" &> /dev/null; do
echo -ne "$FLUXIONVLine Would you like to repeat the last attack? [Y/n] "
read choice
if [ ! "$choice" ]; then break; fi
done
if [ "${choice,,}" != "n" ]; then
load_attack "$path/attack.conf"
fi
fi
fi
if ! prep_attack; then return 5; fi if ! prep_attack; then return 5; fi
# Save the attack for user's convenience if possible.
if type -t save_attack &> /dev/null; then
save_attack "$path/attack.conf"
fi
} }
fluxion_run_attack() { fluxion_run_attack() {