Skip to content

Instantly share code, notes, and snippets.

@markuman
Created December 18, 2019 14:33
Show Gist options
  • Save markuman/d7a5d8e4efa293d6020645177af9b915 to your computer and use it in GitHub Desktop.
Save markuman/d7a5d8e4efa293d6020645177af9b915 to your computer and use it in GitHub Desktop.
{
"login": "myuser",
"site": "aws-123456789",
"lowercase": true,
"uppercase": true,
"symbols": true,
"numbers": true,
"counter": 20191201,
"length": 32
}
{
"login": "myuser",
"site": "aws",
"lowercase": true,
"uppercase": true,
"symbols": true,
"numbers": true,
"counter": 20191201,
"length": 32
}
#!/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