feat: added -insane mode to pwgen.py
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
|
||||
import petname
|
||||
import secrets
|
||||
from itertools import chain
|
||||
|
||||
def generate_password(names: int) -> str:
|
||||
"""
|
||||
@@ -17,5 +19,12 @@ def generate_password(names: int) -> str:
|
||||
results.append(str(secrets.randbelow(8999)+1000))
|
||||
return ".".join(results)
|
||||
|
||||
def generate_insane_password(length: int) -> str:
|
||||
ascii_pool: str = ''.join(chr(i) for i in chain(range(40, 127), range(180, 256)))
|
||||
return ''.join(secrets.choice(ascii_pool) for _ in range(20))
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) <= 1:
|
||||
print(generate_password(3))
|
||||
elif sys.argv[1] == '-insane':
|
||||
print(generate_insane_password(16))
|
||||
Reference in New Issue
Block a user