From a904948af1a1a62934b855f90117f235cd5f746a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sch=C3=BCtz?= Date: Sat, 14 Jan 2017 12:13:02 +0100 Subject: [PATCH 1/5] Add files via upload --- kickthemout.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kickthemout.py b/kickthemout.py index 260e840..f7d0811 100644 --- a/kickthemout.py +++ b/kickthemout.py @@ -14,6 +14,11 @@ import urllib2 as urllib BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[94m', '\033[91m', '\33[97m', '\33[93m', '\033[1;35m', '\033[1;32m', '\033[0m' logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Shut up scapy! + +if os.geteuid() != 0: + print("\n{0}ERROR: KickThemOut must run as root. Try again with sudo/root:\n\t{1}$ sudo python kickthemout.py{2}\n").format(RED, GREEN, END) + raise SystemExit + try: from scapy.all import * import scan, spoof From 52d483965593681812885b4f29c52ca6f598e192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sch=C3=BCtz?= Date: Sat, 14 Jan 2017 12:15:35 +0100 Subject: [PATCH 2/5] Add files via upload --- kickthemout.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kickthemout.py b/kickthemout.py index f7d0811..443c487 100644 --- a/kickthemout.py +++ b/kickthemout.py @@ -15,9 +15,13 @@ import urllib2 as urllib BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[94m', '\033[91m', '\33[97m', '\33[93m', '\033[1;35m', '\033[1;32m', '\033[0m' logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Shut up scapy! -if os.geteuid() != 0: - print("\n{0}ERROR: KickThemOut must run as root. Try again with sudo/root:\n\t{1}$ sudo python kickthemout.py{2}\n").format(RED, GREEN, END) - raise SystemExit +try: + if os.geteuid() != 0: + print("\n{0}ERROR: KickThemOut must run as root. Try again with sudo/root:\n\t{1}$ sudo python kickthemout.py{2}\n").format(RED, GREEN, END) + raise SystemExit +except: + # User is probably on windows + pass try: from scapy.all import * From 2b456367d11478ed44a40497d82f8c7319dbf828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sch=C3=BCtz?= Date: Sat, 14 Jan 2017 12:18:43 +0100 Subject: [PATCH 3/5] Add files via upload --- kickthemout.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kickthemout.py b/kickthemout.py index 443c487..986c125 100644 --- a/kickthemout.py +++ b/kickthemout.py @@ -18,10 +18,12 @@ logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Shut up scapy! try: if os.geteuid() != 0: print("\n{0}ERROR: KickThemOut must run as root. Try again with sudo/root:\n\t{1}$ sudo python kickthemout.py{2}\n").format(RED, GREEN, END) - raise SystemExit + notRoot = True except: # User is probably on windows pass +if notRoot: + raise SystemExit try: from scapy.all import * From b86ce1c11b48ebde904233473fb0c8bcea28dff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sch=C3=BCtz?= Date: Sat, 14 Jan 2017 12:19:43 +0100 Subject: [PATCH 4/5] Add files via upload --- kickthemout.py | 1 + 1 file changed, 1 insertion(+) diff --git a/kickthemout.py b/kickthemout.py index 986c125..ad8e230 100644 --- a/kickthemout.py +++ b/kickthemout.py @@ -15,6 +15,7 @@ import urllib2 as urllib BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[94m', '\033[91m', '\33[97m', '\33[93m', '\033[1;35m', '\033[1;32m', '\033[0m' logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Shut up scapy! +notRoot = False try: if os.geteuid() != 0: print("\n{0}ERROR: KickThemOut must run as root. Try again with sudo/root:\n\t{1}$ sudo python kickthemout.py{2}\n").format(RED, GREEN, END) From 5134484f3576efe417dcfd388af871cc1048bb1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sch=C3=BCtz?= Date: Sun, 15 Jan 2017 19:04:03 +0100 Subject: [PATCH 5/5] 0 host detection --- kickthemout.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/kickthemout.py b/kickthemout.py index ad8e230..abcc557 100644 --- a/kickthemout.py +++ b/kickthemout.py @@ -14,24 +14,12 @@ import urllib2 as urllib BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[94m', '\033[91m', '\33[97m', '\33[93m', '\033[1;35m', '\033[1;32m', '\033[0m' logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Shut up scapy! - -notRoot = False -try: - if os.geteuid() != 0: - print("\n{0}ERROR: KickThemOut must run as root. Try again with sudo/root:\n\t{1}$ sudo python kickthemout.py{2}\n").format(RED, GREEN, END) - notRoot = True -except: - # User is probably on windows - pass -if notRoot: - raise SystemExit - try: from scapy.all import * import scan, spoof except: print("\n{0}ERROR: Requirements have not been properly satisfied. Please try running:\n\t{1}$ sudo pip install -r requirements.txt{2}").format(RED, GREEN, END) - print("\n{0}If you still get the same error, please submit an issue here:\n\t{1}https://github.com/k4m4/kickthemout/issues/\n{2}").format(RED, BLUE, END) + print("\n{0}If you still get the same error, please submit an issue here:\n\t{1}https://github.com/k4m4/kickthemout/issues\n{2}").format(RED, BLUE, END) raise SystemExit def heading(): @@ -278,6 +266,21 @@ def main(): + defaultGatewayIP + "{6}' --> {7}" + str(len(hostsList)) + "{8} hosts are up.{9}").format(GREEN, RED, GREEN, RED, GREEN, RED, GREEN, RED, GREEN, END) + if len(hostsList) == 0 or len(hostsList) == 1: + if len(hostsList) == 1: + if hostsList[0][0] == defaultGatewayIP: + print("\n{0}{1}WARNING: There are {2}0{3} hosts up on you network except your gateway.\n\tYou can't kick anyone off {4}:/{5}\n").format( + GREEN, RED, GREEN, RED, GREEN, END) + raise SystemExit + else: + print( + "\n{0}{1}WARNING: There are {2}0{3} hosts up on you network.\n\tIt looks like something went wrong {4}:/{5}").format( + GREEN, RED, GREEN, RED, GREEN, END) + print( + "\n{0}If you are experiencing this error multiple times, please submit an issue here:\n\t{1}https://github.com/k4m4/kickthemout/issues\n{2}").format( + RED, BLUE, END) + raise SystemExit + try: while True: