From a78d7a6fdf2dc27bc94009485b4e26f5bc2432e5 Mon Sep 17 00:00:00 2001 From: Alexandre Pujol Date: Sat, 24 Feb 2018 18:10:37 +0000 Subject: [PATCH] Fix linter errors --- lib/audit.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/audit.py b/lib/audit.py index 85d404d..54ae3c9 100644 --- a/lib/audit.py +++ b/lib/audit.py @@ -20,9 +20,9 @@ import sys import glob import hashlib -import requests import argparse from subprocess import Popen, PIPE +import requests BASEAPIURL = "https://api.pwnedpasswords.com/" @@ -124,7 +124,7 @@ def _pass(self, arg=None, data=None): return stdout def list(self, path=''): - """ Return a list of paths in a store """ + """Return a list of paths in a store.""" paths = [] prefix = os.path.join(self.prefix, path) for file in glob.glob(prefix + '*/**/*.gpg', recursive=True): @@ -172,9 +172,9 @@ def password(self): data = [] prefixes = [] for path, password in self.data.items(): - hash = hashlib.sha1(password.encode("utf8")).hexdigest().upper() - prefix = hash[0:5] - data.append((path, password, hash, prefix)) + phash = hashlib.sha1(password.encode("utf8")).hexdigest().upper() + prefix = phash[0:5] + data.append((path, password, phash, prefix)) if prefix not in prefixes: prefixes.append(prefix) @@ -185,9 +185,9 @@ def password(self): # Compare the data and return the breached passwords. breached = [] - for path, password, hash, prefix in data: - if hash in buckets[prefix][0]: - index = buckets[prefix][0].index(hash) + for path, password, phash, prefix in data: + if phash in buckets[prefix][0]: + index = buckets[prefix][0].index(phash) count = buckets[prefix][1][index] breached.append((path, password, count)) return breached