PK!`keepassx_tools/__init__.py__version__ = '0.1.1' 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@n/keepassx_tools-0.1.1.dist-info/entry_points.txtN+I/N.,()NM-H,.-(KMqKss23Rr3RPK!&keepassx_tools-0.1.1.dist-info/LICENSECopyright (c) 2019 David Alexander. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PK!HnHTU$keepassx_tools-0.1.1.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!HG,$DF'keepassx_tools-0.1.1.dist-info/METADATAOO@s0 4 ylۭ~{w5/&37ofb'FCJp *ј&J&&"s̶uONixEXY%R X1 Xm:v/hY(Ia}\-VU 50s 0Z0˩"%}$QT餪 ]=媠X(k%4p:4lX8cN8^z{ ԪvM__VF)3,*NOd'\!ErdĢEDVPPC)<{jwPK!HK㖒%keepassx_tools-0.1.1.dist-info/RECORDrP} 3@´"p.~{TO