是否可以同时打开网页200次?

时间:2013-12-29 16:06:20

标签: python browser

我正在尝试使用python攻击我的网络服务器。

是否有可能在同一时间以某种方式打开网页?我该怎么做?也许使用线程?任何的想法?

import time, socket, os, sys, string, webbrowser, thread

def restart_program():
    python = sys.executable
    os.execl(python, python, * sys.argv)
curdir = os.getcwd()

print ("DDoS mode loaded")
host="hajnalgroup.com"
port= 80
message="+---------------------------+"
conn= 200
ip = socket.gethostbyname(host)
print ("[" + ip + "]")
print ( "[Attacking " + host + "]" )
def dos():
    #pid = os.fork()
    ddos = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    try:
        webbrowser.open('http://hajnalgroup.com')
        #thread.start_new_thread(webbrowser.open("hajnalgroup.com"))
    except socket.error:
        print("connection failed")
    print i, ( "attack just started")
    ddos.close()
for i in range(0, conn):
    dos()
print("The connections you requested had finished")
if __name__ == "__main__":
    answer = raw_input("Do you want to ddos more?")
    if answer.strip() in "y Y yes Yes YES".split():
        restart_program()
    else:
        print "bye"

1 个答案:

答案 0 :(得分:2)

我会做以下事情:

  1. 在您的功能中添加while true:
  2. 将您的函数定义复制到python解释器
  3. import thread
  4. thread.start_new_thread(ddos, ())
  5. 查看您的网页是否还活着。如果是,请重复第4点,直至不是。
  6. 通过这种方式,您可以获得服务器功能强大的粗略图像。

相关问题