Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sqlite3
- import subprocess
- conn = sqlite3.connect('/var/lib/matrix-synapse/homeserver.db')
- c = conn.cursor()
- print('Select users:\n')
- for row in c.execute('select * from users;'):
- print(row[0])
- selected_user = str(input())
- print('\n')
- print('Print password:\n')
- password = str(input())
- hash_password = subprocess.check_output(['/usr/bin/hash_password', '-p ' + password]).strip()
- print(hash_password.decode("utf-8"))
- print("UPDATE users SET password_hash='{}' where name ='{}'".format(hash_password.decode("utf-8"), selected_user))
- subprocess.call(['service', 'matrix-synapse', 'stop'])
- c.execute("UPDATE users SET password_hash='{}' where name ='{}';".format(hash_password.decode("utf-8"), selected_user))
- print('Password set!')
- conn.commit()
- subprocess.call(['service', 'matrix-synapse', 'start'])
- print('matrix reload')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement