forked from alhamood/STG-database-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassword_tool.py
More file actions
30 lines (24 loc) · 872 Bytes
/
password_tool.py
File metadata and controls
30 lines (24 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 15 00:46:35 2015
Simple tool to reset Admin password for STG database server
Run from command line (terminal), restart server after (app.py)
@author: alhamood
"""
import getpass
import hashlib
import json
print('This tool resets the password for Admin.')
print('Admin account can control all data and users on the server')
new_password = getpass.getpass('New Admin password: ')
confirm = getpass.getpass('Confirm new password: ')
if new_password == confirm:
with open('databases/user_pdatabase.json') as json_data:
user_pdatabase = json.load(json_data)
json_data.close()
user_pdatabase['Admin']=hashlib.sha256(new_password).hexdigest()
with open('databases/user_pdatabase.json', 'w') as outfile:
json.dump(user_pdatabase, outfile)
print('Password reset.')
else:
print('Passwords did not match! Did nothing.')