Advertisement
Neonprimetime

2018-01-11 original version python phishing kit script

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