kickSOMEOff + kickALLOff Enhancements

This commit is contained in:
k4m4 2017-01-01 21:19:50 +02:00
parent 81d78c6cab
commit b6ed64a06d

View File

@ -97,7 +97,7 @@ def kickoneoff():
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 break # TODO: Test "break"
print("\n{0}Target mac => '{1}" + one_target_mac + "{2}'{3}\n").format(GREEN, RED, GREEN, END) print("\n{0}Target mac => '{1}" + one_target_mac + "{2}'{3}\n").format(GREEN, RED, GREEN, END)
print("{0}Spoofing started... {1}\n").format(GREEN, END) print("{0}Spoofing started... {1}\n").format(GREEN, END)
@ -129,13 +129,12 @@ def kicksomeoff():
if host[0] == onlineIPs[i]: if host[0] == onlineIPs[i]:
mac = host[1] mac = host[1]
vendor = resolveMac(mac) vendor = resolveMac(mac)
print(" [{0}" + str(i) + "{1}] {2}" + str(onlineIPs[i]) + "{3}\t" + vendor + "\n{4}").format(YELLOW, WHITE, print(" [{0}" + str(i) + "{1}] {2}" + str(onlineIPs[i]) + "{3}\t" + vendor + "\n{4}").format(YELLOW, WHITE, RED, GREEN, END)
RED, GREEN, END)
canBreak = False canBreak = False
while not canBreak: while not canBreak:
try: try:
choice = raw_input("\nChoose the targets (separate by a ','): ") choice = raw_input("\nChoose devices to target(comma-separated): ")
canBreak = True canBreak = True
except KeyboardInterrupt: except KeyboardInterrupt:
return return
@ -145,7 +144,7 @@ def kicksomeoff():
some_ipList = "" some_ipList = ""
for i in some_targets: for i in some_targets:
try: try:
some_ipList = some_ipList + GREEN + "'" + RED + onlineIPs[int(i)] + GREEN + "', " some_ipList += GREEN + "'" + RED + onlineIPs[int(i)] + GREEN + "', "
except KeyboardInterrupt: except KeyboardInterrupt:
return return
except: except:
@ -193,6 +192,8 @@ def kickalloff():
vendor = resolveMac(mac) vendor = resolveMac(mac)
print(str("{0}"+ str(onlineIPs[i]) + "{1}\t" + vendor + "{2}").format(RED, GREEN, END)) print(str("{0}"+ str(onlineIPs[i]) + "{1}\t" + vendor + "{2}").format(RED, GREEN, END))
print("\n{0}Targets: {1}" + ','.join(onlineIPs)).format(GREEN, END)
print("\n{0}Spoofing started... {1}\n").format(GREEN, END) print("\n{0}Spoofing started... {1}\n").format(GREEN, END)
try: try:
reScan = 0 reScan = 0
@ -222,34 +223,25 @@ def getDefaultInterface():
if (arg <= 0 or arg >= 0xFFFFFFFF): if (arg <= 0 or arg >= 0xFFFFFFFF):
raise ValueError("illegal netmask value", hex(arg)) raise ValueError("illegal netmask value", hex(arg))
return 32 - int(round(math.log(0xFFFFFFFF - arg, 2))) return 32 - int(round(math.log(0xFFFFFFFF - arg, 2)))
def to_CIDR_notation(bytes_network, bytes_netmask): def to_CIDR_notation(bytes_network, bytes_netmask):
network = scapy.utils.ltoa(bytes_network) network = scapy.utils.ltoa(bytes_network)
netmask = long2net(bytes_netmask) netmask = long2net(bytes_netmask)
net = "%s/%s" % (network, netmask) net = "%s/%s" % (network, netmask)
if netmask < 16: if netmask < 16:
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 # 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:
continue continue
net = to_CIDR_notation(network, netmask) net = to_CIDR_notation(network, netmask)
if interface != scapy.config.conf.iface: if interface != scapy.config.conf.iface:
continue continue
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
@ -264,7 +256,9 @@ def resolveMac(mac):
vendor = vendor[:25] vendor = vendor[:25]
return vendor return vendor
except: except:
return "RESOLVING_ERROR" return "[-] Error Resolving Mac Address"
return "[-] Exiting..."
raise SystemExit
def main(): def main():
@ -272,10 +266,8 @@ def main():
print( print(
"\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, + defaultGatewayIP + "{6}'. {7}" + str(len(hostsList)) + "{8} hosts are up.{9}").format(GREEN, RED, GREEN, RED, GREEN,
GREEN, RED, GREEN, RED, RED, GREEN, RED, GREEN, END)
GREEN, END)
try: try:
while True: while True:
@ -315,5 +307,4 @@ if __name__ == '__main__':
defaultInterfaceMac = get_if_hwaddr(defaultInterface) defaultInterfaceMac = get_if_hwaddr(defaultInterface)
scanNetwork() scanNetwork()
main()
main()