diff options
| author | Mattias Andrée <maandree@operamail.com> | 2015-10-29 03:23:51 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@operamail.com> | 2015-10-29 03:23:51 +0100 |
| commit | cbd26551fcf9a4558b507f0acc46c30c63faf596 (patch) | |
| tree | 440e3d91280a11e1fbb20551a21150f8e516b537 | |
| parent | m makefile (diff) | |
| download | passcheck-cbd26551fcf9a4558b507f0acc46c30c63faf596.tar.gz passcheck-cbd26551fcf9a4558b507f0acc46c30c63faf596.tar.bz2 passcheck-cbd26551fcf9a4558b507f0acc46c30c63faf596.tar.xz | |
blacklist a words in /usr/share/dict and /usr/local/share/dict
Signed-off-by: Mattias Andrée <maandree@operamail.com>
| -rw-r--r-- | info/passcheck.texinfo | 4 | ||||
| -rwxr-xr-x | passcheck.py | 12 |
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:]) |
