forked from konomae/lastpass-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
26 lines (23 loc) · 793 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from lastpass import Fetcher, Parser
from getpass import getpass
from pprint import PrettyPrinter
import cPickle as pickle
if __name__ == "__main__":
blob = None
key = None
username = raw_input("Username: ")
password = getpass()
if False:
otp = raw_input("OTP (if rel): ")
fetcher = Fetcher.fetch(username, password, otp=otp)
key = fetcher.encryption_key
blob = fetcher.blob
pickle.dump(blob, open("blob.dat", "wb"))
else:
key = Fetcher.make_key(username, password)
blob = pickle.load(open("blob.dat", "rb"))
parser = Parser.parse(blob, key)
equivdom = parser.chunks['EQDN']
PrettyPrinter(indent=2).pprint(equivdom)
accounts = parser.chunks['ACCT']
PrettyPrinter(indent=2).pprint(accounts)