password hash utility uses getpass()

This commit is contained in:
iou1name 2019-06-03 07:04:50 -04:00
parent 4be501016c
commit 89e401b730

View File

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