mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-23 19:19:31 +01:00
3d5e7cd1c1
- This function was renamed in Passlib 1.7, deprecating the old name. - Depend accordingly on Passlib >= 1.7.0
27 lines
815 B
Python
Executable File
27 lines
815 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Password hashing utility for PyLink IRC Services.
|
|
"""
|
|
|
|
from pylinkirc.coremods.login import pwd_context
|
|
import getpass
|
|
|
|
if __name__ == '__main__':
|
|
import argparse
|
|
|
|
parser = argparse.ArgumentParser(description='Hashes a password for use with PyLink IRC Services.')
|
|
parser.add_argument('password', help='specifies the password to hash', nargs='?', default='')
|
|
args = parser.parse_args()
|
|
|
|
assert pwd_context, 'Cannot hash passwords because passlib is missing! Install it via "pip3 install passlib".'
|
|
|
|
password = args.password
|
|
|
|
# If no password was given, enter one on the command line
|
|
if not password:
|
|
password = getpass.getpass()
|
|
|
|
password = password.strip()
|
|
assert password, "Password cannot be empty!"
|
|
print(pwd_context.hash(password))
|