aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--info/passcheck.texinfo4
-rwxr-xr-xpasscheck.py12
2 files changed, 16 insertions, 0 deletions
diff --git a/info/passcheck.texinfo b/info/passcheck.texinfo
index ad1c879..90da502 100644
--- a/info/passcheck.texinfo
+++ b/info/passcheck.texinfo
@@ -98,6 +98,10 @@ the strength of a passphrase:
The passphrase is not a commonly use passphrase.
Currently a top-1000 list is used.
@item
+The passphrase is not a word listed in a file
+inside either ofthe directory @file{/usr/share/dict/}
+abd @file{/usr/local/share/dict/}.
+@item
The degree to which characters are mixed.
@item
The classes of used characters. For example non-ASCII
diff --git a/passcheck.py b/passcheck.py
index 0cfdd32..e8776c8 100755
--- a/passcheck.py
+++ b/passcheck.py
@@ -19,6 +19,7 @@
#
import sys
+import os
def _class(char):
@@ -114,6 +115,17 @@ def evaluate(data):
blacklist = None
with open('blacklist', 'rb') as file:
blacklist = set(file.read().decode('utf-8', 'replace').split('\n'))
+for directory in ['/usr/share/dict/', '/usr/local/share/dict/']:
+ dictionaries = None
+ try:
+ dictionaries = os.listdir(directory)
+ except FileNotFoundError:
+ pass
+ if dictionaries is not None:
+ for dictionary in dictionaries:
+ if not os.path.isdir(directory + dictionary):
+ with open(directory + dictionary, 'rb') as file:
+ blacklist.update(set(file.read().decode('utf-8', 'replace').split('\n')))
raw = ('--raw' in sys.argv[1:]) or ('-r' in sys.argv[1:])