Last active
February 7, 2019 11:39
-
-
Save Mic92/33bbac24601ce87453ac7453b6976a4c to your computer and use it in GitHub Desktop.
Check CSV export of a keepassx database against haveibeenpwnd (k-anonymized)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import csv | |
import sys | |
# https://github.com/lionheart/pwnedpasswords | |
import pwnedpasswords | |
def main(): | |
if len(sys.argv) == 0: | |
print("USAGE: %s keepass-passwords.csv", sys.argv[0]) | |
sys.exit(1) | |
with open(sys.argv[1]) as f: | |
reader = csv.DictReader(f) | |
for line in reader: | |
password = line.get("Password", "") | |
if password == "": continue | |
pwned = pwnedpasswords.check(password) | |
if pwned != 0: | |
title = line.get("Title", "") | |
print("Password %s for %s is insecure" % (password, title)) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment