Created
December 18, 2019 14:33
-
-
Save markuman/d7a5d8e4efa293d6020645177af9b915 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"login": "myuser", | |
"site": "aws-123456789", | |
"lowercase": true, | |
"uppercase": true, | |
"symbols": true, | |
"numbers": true, | |
"counter": 20191201, | |
"length": 32 | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"login": "myuser", | |
"site": "aws", | |
"lowercase": true, | |
"uppercase": true, | |
"symbols": true, | |
"numbers": true, | |
"counter": 20191201, | |
"length": 32 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import json | |
import yaml | |
import sys | |
from getpass import getpass | |
from lesspass.password import generate_password | |
if __name__ == '__main__': | |
#arg = "ansible-vault-private_key.json" | |
arg = sys.argv[1] | |
if arg.find(".yml") == (len(arg) -4): | |
profile = yaml.load(open(arg)) | |
elif arg.find(".json") == (len(arg) -5): | |
profile = json.load(open(arg)) | |
else: | |
print("cannot parse profile file") | |
sys.exit(1) | |
master_password = getpass("Master Password: ") | |
print(generate_password(profile, master_password)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment