password hash utility uses getpass()
This commit is contained in:
parent
4be501016c
commit
89e401b730
|
@ -4,6 +4,7 @@ The overwrought server, for exchanging mods from master to slave recipients.
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
import getpass
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
@ -81,10 +82,12 @@ def post():
|
||||||
file.save(os.path.join(config_server.mods_dir, fname))
|
file.save(os.path.join(config_server.mods_dir, fname))
|
||||||
return "Success!"
|
return "Success!"
|
||||||
|
|
||||||
def generate_hash(password):
|
def generate_hash(password=None):
|
||||||
"""
|
"""
|
||||||
A utility for generating an argon2 password hash.
|
A utility for generating an argon2 password hash.
|
||||||
"""
|
"""
|
||||||
|
if not password:
|
||||||
|
password = getpass.getpass()
|
||||||
pw_hash = argon2.hash(password)
|
pw_hash = argon2.hash(password)
|
||||||
return pw_hash
|
return pw_hash
|
||||||
|
|
||||||
|
@ -99,12 +102,8 @@ if __name__ == "__main__":
|
||||||
choices=['hash'],
|
choices=['hash'],
|
||||||
help="What action to perform.",
|
help="What action to perform.",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
|
||||||
'target',
|
|
||||||
help="The target to perform the action on."
|
|
||||||
)
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.action == "hash":
|
if args.action == "hash":
|
||||||
pw_hash = generate_hash(args.target)
|
pw_hash = generate_hash()
|
||||||
print(pw_hash)
|
print(pw_hash)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user