PK! qkeepassx_tools/__init__.py__version__ = '0.1.0' PK!keepassx_tools/cli/__init__.pyPK!ZGkeepassx_tools/cli/check.pyimport os import sys from .. import __version__ import click from pykeepass import PyKeePass from pwnedapi import Password def current_entry(entry): if entry is not None: return '{path} ({username})'.format(path=entry.path, username=entry.username) @click.command() @click.argument('db_path') @click.password_option('--password') @click.version_option(version=__version__) @click.help_option() def main(db_path, password): click.echo('Decrypting database (this may take a while) ... ', nl=False) db = PyKeePass(os.path.expanduser(db_path), password=password) click.echo('Decrypted!') # Password hash => pwned counts (so we don't have to make numerous duplicate requests) pwds = {} failed = [] click.echo('Checking for pwned passwords...') with click.progressbar(db.entries, show_percent=False, show_pos=True, show_eta=False, item_show_func=current_entry) as entries: for entry in entries: if not entry.password: continue pwd = Password(entry.password) if pwd.hashed_password not in pwds: pwd.is_pwned() # Loads the cache for `pwd.pwned_count` pwds[pwd.hashed_password] = pwd.pwned_count pwned_count = pwds[pwd.hashed_password] if pwned_count == 0: continue failed.append(entry) failures = len(failed) for entry in failed: click.echo('{level}: {e}'.format(level=click.style('FAIL', fg='red'), e=current_entry(entry))) click.echo('Insecure passwords: {num} found'.format( num=click.style( str(failures), fg='bright_red' if failures > 0 else 'green'))) if failures > 0: sys.exit(1) PK!H}~?l/keepassx_tools-0.1.0.dist-info/entry_points.txtN+I/N.,()NM-H,.-(KMq32 s23Rr3jQPK!HnHTU$keepassx_tools-0.1.0.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!H'keepassx_tools-0.1.0.dist-info/METADATAQK0F+򨰆vm8܃á>_k$ߛP_>=!@+EJ0(Y Ҟ}(D1-:hTޕ/%۪ 5В|kG5Ӟ%.ZԻ C,iQa+> Q!DFiѱT*7v(-ئi\KKɹmz7+X-"-D~>,Щ  I$QD}PK!H\_B%keepassx_tools-0.1.0.dist-info/RECORDI@@ѽg)A@(E7DT(woL;&^(ʃ%$YLbT'_K3%n?u|P7F9H ZWfXy/;t,y1 r -h 4zv;3G!j7w&餰W?3ӱR7Yq2Id8vr%(gW22Z('qF+vr;3NNbϺEV:>+ccF)- \lOjՔ53i&\$1pvx`76ꪣtTFA7z3S{\ʓy&ô] A;Y;7PK! qkeepassx_tools/__init__.pyPK!Nkeepassx_tools/cli/__init__.pyPK!ZGkeepassx_tools/cli/check.pyPK!H}~?l/keepassx_tools-0.1.0.dist-info/entry_points.txtPK!HnHTU$keepassx_tools-0.1.0.dist-info/WHEELPK!H'keepassx_tools-0.1.0.dist-info/METADATAPK!H\_B% keepassx_tools-0.1.0.dist-info/RECORDPK4