PK6NURgghibpcli/__init__.py"""A command line interface for the "haveibeenpwned.com" API - talks keepass.""" __version__ = "0.0.1" PK46N!j--hibpcli/cli.pyimport click from hibpcli.keepass import check_passwords_from_db @click.command() def main(): path = click.prompt("Please enter the path to the database") master_password = click.prompt("Please enter the master password for the database") # needs error handling rv = check_passwords_from_db(path=path, master_password=master_password) if rv: click.echo("The passwords of following entries are leaked:") click.echo(rv) else: click.echo("Hooray, everything is safe!") if __name__ == "__main__": main() PK6Nhibpcli/keepass.pyfrom pykeepass import PyKeePass from hibpcli import password def check_passwords_from_db(path, master_password): """ - """ kp = PyKeePass(path, password=master_password) leaked_entries = [] for entry in kp.entries: p = password.Password(password=entry.password) if p.is_password_leaked(): leaked_entries.append(entry) return leaked_entries PK5Nhibpcli/password.pyimport hashlib import requests class Password: def __init__(self, password): self.password = password def is_password_leaked(self): hex_digest = self._generate_hash() first_hash_part, second_hash_part = hex_digest[:5], hex_digest[5:] result = requests.get(f"https://api.pwnedpasswords.com/range/{first_hash_part}").text # the result is text with entries split by new line # one entry consists of the rest of the hash and count of # leak, separated by a colon # cut off string - information after the hash is of no interest partial_hash_list = [line[:35] for line in result.splitlines()] return second_hash_part in partial_hash_list def _generate_hash(self): hash_object = hashlib.sha1(bytes(self.password, "UTF-8")) hex_digest = hash_object.hexdigest().upper() return hex_digest PK46NݿSShibpcli/requirements-dev.txtargon2-cffi==19.1.0 astroid==2.1.0 atomicwrites==1.2.1 attrs==18.2.0 certifi==2018.11.29 cffi==1.11.5 chardet==3.0.4 Click==7.0 construct==2.9.45 coverage==4.5.2 docutils==0.14 fancycompleter==0.8 flit==1.2.1 idna==2.8 isort==4.3.4 lazy-object-proxy==1.3.1 lxml==4.3.0 mccabe==0.6.1 more-itertools==5.0.0 pdbpp==0.9.3 pluggy==0.8.1 py==1.7.0 pycparser==2.19 pycryptodome==3.7.3 Pygments==2.3.1 pykeepass==3.0.2 pylint==2.2.2 pytest==4.1.1 pytest-cov==2.6.1 python-dateutil==2.7.5 pytoml==0.1.20 requests==2.21.0 rope==0.11.0 six==1.12.0 typed-ast==1.2.0 urllib3==1.24.1 wmctrl==0.3 wrapt==1.11.1PKl4NP{88hibpcli-0.0.1.dist-info/LICENSEThe MIT License (MIT) Copyright (c) 2019 Jürgen Gmach Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!Hd BUchibpcli-0.0.1.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,rzd&Y)r$[)T&UD"PK!HfI hibpcli-0.0.1.dist-info/METADATASMo0WHm&Y8Ī (ەZuIctw7mBDc{3'y=>uB^/ْXB/*SK/E˒--ۡww\n\k;ɔtƓTP Fo;$WN%\^ﰉ狳}eeug09W] Ib`9ePk8=#pizMGJa/$5 {5yR.F%ISw. yWoniw166%u8-ԛ8:e:)-]Z"^"88dzo_jmnuINdJÏS=MPM- >X)K9>b; q c,q'PNF['!j х1R6b]?2Z>=?e\bgϔ}v /PK!H#chibpcli-0.0.1.dist-info/RECORDuɒ@}} X(Ӣ @)X n@Dѯo;۞']zŸQLhݨMbn0/r|aГ%r?/ݽYS GzܛXm5{:l53$9)`dzŲKM:ۛr@} zJ5AfBG]HI/smR#Q÷Q,TYjmP(>;!}.329aRBNH;60w+O30\ \dc1ω6jE7{_7v3Ar0#[ /G7Z=qbQ;slh05کsF43h+Vzӧp܉@!y r? vT PK6NURgghibpcli/__init__.pyPK46N!j--hibpcli/cli.pyPK6Nhibpcli/keepass.pyPK5Nhibpcli/password.pyPK46NݿSSfhibpcli/requirements-dev.txtPKl4NP{88 hibpcli-0.0.1.dist-info/LICENSEPK!Hd BUchhibpcli-0.0.1.dist-info/WHEELPK!HfI hibpcli-0.0.1.dist-info/METADATAPK!H#chibpcli-0.0.1.dist-info/RECORDPK zx