Advertisement
Neonprimetime

2018-11-01 version 2.0 python script phishing kits

Nov 1st, 2018
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. 11/1/2018 version 2.0
  2. https://neonprimetime.blogspot.com/2018/01/python-script-search-open-directories.html
  3.  
  4. from urllib.request import urlopen
  5. from urllib.request import urlretrieve
  6. import re
  7. import sys
  8. import os
  9. filepath = 'urls.txt'
  10. with open(filepath) as fp:
  11. theurl = fp.readline()
  12. while theurl:
  13. if(not theurl.startswith('http')):
  14. if(":443" in theurl):
  15. theurl = 'https://' + theurl.strip()
  16. else:
  17. theurl = 'http://' + theurl.strip()
  18. theurl = theurl.strip()
  19. if(theurl.endswith("/") or theurl.endswith("\\")):
  20. theurl = theurl[:-1]
  21. stopnow = 0
  22. while stopnow == 0:
  23. try:
  24. html = urlopen(theurl, timeout=3)
  25. val = html.read()
  26. titles = re.findall(r'(?i)<title>(.*?)</title>',str(val))
  27. if len(titles) > 0:
  28. if titles[0].startswith('Index of'):
  29. print("opendir," + theurl + "(" + titles[0] + ")")
  30. zipfiles = re.findall(r'(?i)href\=\"[^\"]+\.zip\"\>',str(val))
  31. if len(zipfiles) > 0:
  32. for zipfile in zipfiles:
  33. zipfile = zipfile.replace('\"', '').replace('href=', '').replace('>','').replace("&amp;", "&")
  34. if theurl.endswith('/'):
  35. phishkit = theurl + zipfile
  36. else:
  37. phishkit = theurl + "/" + zipfile
  38. try:
  39. urlretrieve(phishkit, zipfile)
  40. print("phishkit," + phishkit)
  41. except Exception as e:
  42. print("failedphishkit," + phishkit + "(" + str(e) + ")")
  43. exefiles = re.findall(r'(?i)href\=\"[^\"]+\.exe\"\>',str(val))
  44. if len(exefiles) > 0:
  45. for exefile in exefiles:
  46. exefile = exefile.replace('\"', '').replace('href=', '').replace('>','').replace("&amp;", "&")
  47. if theurl.endswith('/'):
  48. malware = theurl + exefile
  49. else:
  50. malware = theurl + "/" + exefile
  51. try:
  52. urlretrieve(malware, exefile)
  53. print("malware," + malware)
  54. except Exception as e:
  55. print("failedmalware," + malware + "(" + str(e) + ")")
  56. panels = re.findall(r'(?i)href\=\"(panel|webpanel|fre\.php)\"\>',str(val))
  57. if len(panels) > 0:
  58. for panel in panels:
  59. panel = panel.replace('\"', '').replace('href=' ,'').replace('>', '').replace("&amp;", "&")
  60. if theurl.endswith('/'):
  61. panelurl = theurl + panel
  62. else:
  63. panelurl = theurl + "/" + panel
  64. print("panel," + panelurl)
  65. else:
  66. print("webpage," + theurl + "(" + titles[0] + ")")
  67. theurl = re.sub(r'\/[^\/]*$', '', theurl)
  68. if theurl.endswith('http:/') or theurl.endswith('https:/'):
  69. stopnow = 1
  70. except Exception as e:
  71. if "no host given" in str(e):
  72. stopnow = 1
  73. else:
  74. print("failedurl," + theurl + "(" + str(e) + ")")
  75. theurl = re.sub(r'\/[^\/]*$', '', theurl)
  76. theurl = fp.readline()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement