From 07fb55faf3f10434a9944f8c3df9b13edb4553ec Mon Sep 17 00:00:00 2001 From: Matias Barcenas Date: Wed, 30 Aug 2017 16:41:09 -0500 Subject: [PATCH] Refactored interface initialization. --- attacks/Captive Portal/attack.sh | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/attacks/Captive Portal/attack.sh b/attacks/Captive Portal/attack.sh index 6f1da3f..10f545d 100755 --- a/attacks/Captive Portal/attack.sh +++ b/attacks/Captive Portal/attack.sh @@ -750,6 +750,24 @@ function captive_portal_set_routes() { iptables -t nat -A POSTROUTING -j MASQUERADE } +function captive_portal_stop_interface() { + captive_portal_unset_routes + + ap_stop +} + +function captive_portal_start_interface() { + echo -e "$FLUXIONVLine $CaptivePortalStaringAPServiceNotice" + ap_start + + echo -e "$FLUXIONVLine $CaptivePortalStaringAPRoutesNotice" + captive_portal_set_routes & + sleep 3 + + fuser -n tcp -k 53 67 80 443 &> $FLUXIONOutputDevice + fuser -n udp -k 53 67 80 443 &> $FLUXIONOutputDevice +} + function unprep_attack() { CaptivePortalState="Not Ready" captive_portal_unset_attack @@ -810,9 +828,7 @@ function stop_attack() { fi sandbox_remove_workfile "$FLUXIONWorkspacePath/clients.txt" - captive_portal_unset_routes - - ap_stop + captive_portal_stop_interface } function start_attack() { @@ -820,15 +836,7 @@ function start_attack() { stop_attack - echo -e "$FLUXIONVLine $CaptivePortalStaringAPServiceNotice" - ap_start - - echo -e "$FLUXIONVLine $CaptivePortalStaringAPRoutesNotice" - captive_portal_set_routes & - sleep 3 - - fuser -n tcp -k 53 67 80 443 &> $FLUXIONOutputDevice - fuser -n udp -k 53 67 80 443 &> $FLUXIONOutputDevice + captive_portal_start_interface echo -e "$FLUXIONVLine $CaptivePortalStartingDHCPServiceNotice" xterm -bg black -fg green $TOPLEFT -title "FLUXION AP DHCP Service" -e "dhcpd -d -f -lf \"$FLUXIONWorkspacePath/dhcpd.leases\" -cf \"$FLUXIONWorkspacePath/dhcpd.conf\" $VIGW 2>&1 | tee -a \"$FLUXIONWorkspacePath/clients.txt\"" &