Skip to content

Instantly share code, notes, and snippets.

@falco694
Last active September 24, 2019 14:38
Show Gist options
  • Save falco694/050f0dfe9bdb7cfa16326a43864977d8 to your computer and use it in GitHub Desktop.
Save falco694/050f0dfe9bdb7cfa16326a43864977d8 to your computer and use it in GitHub Desktop.
get lastpass data.
# -*- coding: utf-8 -*-
""" get lastpass data.
1. install python library.
- pip install boto3 lastpass-python
- pipenv install boto3 lastpass-python
"""
import boto3
import lastpass
def main():
vault = lastpass.Vault.open_remote(
get_parameters('lastpass-username'),
get_parameters('lastpass-password')
)
for i in vault.accounts:
print(i.id, i.name, i.username, i.password, i.url)
def get_parameters(param_key):
""" get parameter store value.
"""
region_name = boto3.session.Session().region_name
ssm = boto3.client('ssm', region_name=region_name)
response = ssm.get_parameters(
Names=[
param_key,
],
WithDecryption=True
)
return response['Parameters'][0]['Value']
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment