def get_hashes(username, password, pool=None): if not pool: pool = Pool() fetcher = Fetcher.fetch(username, password) parser = Parser.parse(fetcher.blob, fetcher.encryption_key) accounts = parser.chunks['ACCT'] passwords = set(a["password"] for a in accounts if a["password"]) pass_hashes = list(pool.imap_unordered(hash_pw, passwords, chunksize=CHUNK_SIZE)) min_length = len(min(passwords, key=len)) max_length = len(max(passwords, key=len)) return pass_hashes, max_length, min_length
def get_hashes(username, password, pool=None): if not pool: pool = Pool() fetcher = Fetcher.fetch(username, password) parser = Parser.parse(fetcher.blob, fetcher.encryption_key) accounts = parser.chunks['ACCT'] passwords = set(a["password"] for a in accounts if a["password"]) pass_hashes = list( pool.imap_unordered(hash_pw, passwords, chunksize=CHUNK_SIZE)) min_length = len(min(passwords, key=len)) max_length = len(max(passwords, key=len)) return pass_hashes, max_length, min_length
# coding: utf-8 from lastpass import Fetcher, Parser fetcher = Fetcher.fetch('username', 'password') parser = Parser.parse(fetcher.blob, fetcher.encryption_key) accounts = parser.chunks['ACCT'] print accounts
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: "******"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)