Advertisement
Guest User

Untitled

a guest
Sep 5th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. import hashlib
  2.  
  3. hex_dig_user = None
  4. hex_dig_pass = None
  5. loggedIn = None
  6.  
  7.  
  8. def user():
  9. user = input('Enter Username: ')
  10. # Assumes the default UTF-8
  11. hash_object = hashlib.sha512(user.encode())
  12. global hex_dig_user
  13. hex_dig_user = hash_object.hexdigest()
  14. print(hex_dig_user)
  15.  
  16. def passwd():
  17. passwd = input('Enter Password: ')
  18. # Assumes the default UTF-8
  19. hash_object = hashlib.sha512(passwd.encode())
  20. global hex_dig_pass
  21. hex_dig_pass = hash_object.hexdigest()
  22. print(hex_dig_pass)
  23.  
  24. def openFile():
  25.  
  26. file = open("database/credentials.txt", "r")
  27. global datafile
  28. datafile = file.readlines()
  29. file.close()
  30.  
  31. def checkHash():
  32. for line in datafile:
  33. username, password, admin = line.split("/")
  34. if(hex_dig_user == username and hex_dig_pass == password):
  35. print('Logged In')
  36. global loggedIn
  37. loggedIn = True
  38. else:
  39. print('Incorrect Username Or Password')
  40. login()
  41.  
  42. def login():
  43. user()
  44. passwd()
  45. openFile()
  46. checkHash()
  47.  
  48. def commands():
  49. if loggedIn == True:
  50. print('[-] Press 1 For Adding New Users')
  51. print('[-] Press 2 For Deleting Users')
  52. print('[-] Press 99 To Log Out')
  53. selectedCommand = input()
  54. if selectedCommand == "1" and admin == y:
  55. print('Username Of New User')
  56.  
  57.  
  58. def program():
  59. login()
  60. commands()
  61.  
  62. program()
  63.  
  64. 9d172a5f62b696ad23f9acc0db4c91ca5a1c591cc19dfa2c2bc90db0f16eb349a2ed12c44ccad8e25652b16f4047505bab7cda481924f54f8e616d5d03597b4d/b2396a002fe7aec008808687d7cbacb340b7f7a090008382f3c95870f6fb10415f61f5737c102d4bfec58fe525407ea2001e761dab1da8a501d9523921f0ec21/y
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement