From 9655ab8f280f1bbf4f5cb920a8f2b599a7e9b841 Mon Sep 17 00:00:00 2001 From: k4m4 Date: Sun, 6 Oct 2019 17:12:48 -0400 Subject: [PATCH] Fix scanning animation on input bug (fixes #399) --- kickthemout.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kickthemout.py b/kickthemout.py index 718c4f6..afeafd4 100644 --- a/kickthemout.py +++ b/kickthemout.py @@ -185,7 +185,9 @@ def getDefaultInterfaceMAC(): def getGatewayIP(): global stopAnimation try: - getGateway = sr1(IP(dst="github.com", ttl=0) / ICMP() / "XXXXXXXXXXX", verbose=False) + getGateway, timeout = sr1(IP(dst="github.com", ttl=0) / ICMP() / "XXXXXXXXXXX", verbose=False, timeout=4) + if timeout: + raise Exception() return getGateway.src except: # request gateway IP address (after failed detection by scapy) @@ -229,7 +231,7 @@ def resolveMac(mac): # regenerate online IPs array & configure gateway def regenOnlineIPs(): - global onlineIPs, defaultGatewayMac, defaultGatewayMacSet + global onlineIPs, defaultGatewayMac, defaultGatewayMacSet, stopAnimation if not defaultGatewayMacSet: defaultGatewayMac = "" @@ -243,6 +245,7 @@ def regenOnlineIPs(): if not defaultGatewayMacSet and defaultGatewayMac == "": # request gateway MAC address (after failed detection by scapy) + stopAnimation = True print("\n{}ERROR: Default Gateway MAC Address could not be obtained. Please enter MAC manually.{}\n".format(RED, END)) header = ("{}kickthemout{}> {}Enter your gateway's MAC Address {}(MM:MM:MM:SS:SS:SS): ".format(BLUE, WHITE, RED, END)) defaultGatewayMac = input(header)