Advertisement
Guest User

find the backup files pls

a guest
Sep 22nd, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.92 KB | None | 0 0
  1. import requests
  2. import time
  3. from progressbar import ProgressBar
  4.  
  5. things = ['conf', 'bak', 'swp', 'txt', 'old', 'tar', 'tar.gz', 'tar.bz2', 'zip', 'inc',
  6.         'asa', 'tgz', 'gz', 'rar', 'java', 'py', 'js', 'pdf', 'doc', 'docx', 'rtf',
  7.         'pl', 'o', 'obj', 'jar', 'inf', 'exe', 'c', 'bat', 'asm', 'awk', 's', 'sh',
  8.         'src', 'log', 'lock', 'jsp', 'aspx', 'dev', 'orig', 'copy', 'tmp', '~', 'backup',
  9.         'copyof', 'copy of', 'snapshot']
  10.  
  11. print
  12. print "============="
  13. print "[i] Beginning..."
  14. print "============="
  15.  
  16. http = raw_input("[>] Enter the HTTP host >>> ")
  17. link = raw_input("[>] Enter the directory >>> ")
  18. file = raw_input("[>] Enter the file      >>> ")
  19. fiex = raw_input("[>] Enter the extension >>> ")
  20. things.append(fiex)
  21.  
  22. session = requests.head(http)
  23. if session.status_code == 200:
  24.     print "[i] Connection is working."
  25. else:
  26.     print "[!] Connection does not work!"
  27.     print "============="
  28.     exit(1)
  29.  
  30. urls = []
  31. codes = []
  32. direct = []
  33.  
  34. def store(request, code, directlink):
  35.     urls.append(request)
  36.     codes.append(code)
  37.     direct.append(directlink)
  38.  
  39. def checkreq(request):
  40.     if request in direct:
  41.         return False
  42.     else:
  43.         return True
  44.  
  45. print "============="
  46. print "=== Appending ==="
  47. pbar = ProgressBar()
  48. for ext in pbar(things):
  49.     req = http + link + file + "." + fiex + "." + ext
  50.     if checkreq(req):
  51.         connection = requests.head(req)
  52.         store(req, connection.status_code, req)
  53.         time.sleep(0.05)
  54.     else:
  55.         continue
  56.  
  57. print "=== Replacing ==="
  58. pbar = ProgressBar()
  59. for repl in pbar(things):
  60.     req = http + link + file + "." + repl
  61.     if checkreq(req):
  62.         connection = requests.head(req)
  63.         store(req, connection.status_code, req)
  64.         time.sleep(0.05)
  65.     else:
  66.         continue
  67.  
  68. print "=== Prepending ==="
  69. pbar = ProgressBar()
  70. for pre in pbar(things):
  71.     req = http + link + pre + file + "." + fiex
  72.     if checkreq(req):
  73.         connection = requests.head(req)
  74.         store(req, connection.status_code, req)
  75.         time.sleep(0.05)
  76.     else:
  77.         continue
  78.  
  79. print "=== Mixing ==="
  80. pbar = ProgressBar()
  81. for exten in pbar(range(0, len(things))):
  82.     for main in things:
  83.         req = http + link + main + file + fiex + "." + things[exten]
  84.         if checkreq(req):
  85.             connection = requests.head(req)
  86.             store(req, connection.status_code, req)
  87.             time.sleep(0.05)
  88.         else:
  89.             continue
  90.  
  91. c200s = 0
  92. for search in range(0, len(codes)):
  93.     if codes[search] != 404:
  94.         c200s += 1
  95.         print "============="
  96.         print "[" + str(c200s) + "] URL ::: " + urls[search].replace("\n", "").replace("\r", "")
  97.         print "|__ COD ::: " + str(codes[search])
  98.  
  99. print "============="
  100. print "[i] " + str(c200s) + " URLs found."
  101. print "[i] " + str(len(codes)) + " URLs attempted."
  102. print "============="
  103. print "[*] Done."
  104. print "============="
  105. print
  106. exit(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement