[Python-modules-commits] [python-zxcvbn] 01/01: removed unused files; updated changelog and setup.py
Sabino Par
sprab-guest at moszumanska.debian.org
Tue May 23 21:02:54 UTC 2017
This is an automated email from the git hooks/post-receive script.
sprab-guest pushed a commit to branch master
in repository python-zxcvbn.
commit 5513eb08981992407cb58b92abd957c454b122e1
Author: sprab-guest <sprab at onenetbeyond.org>
Date: Tue May 23 23:00:46 2017 +0200
removed unused files;
updated changelog and setup.py
---
LICENSE.txt | 20 -
.../zxcvbn_python-4.4.14.egg-info => PKG-INFO | 0
README.rst | 138 +++++
debian/.git-dpm | 11 -
debian/changelog | 6 -
debian/files | 3 -
debian/python-zxcvbn/DEBIAN/control | 18 -
debian/python-zxcvbn/DEBIAN/md5sums | 11 -
debian/python-zxcvbn/DEBIAN/postinst | 9 -
debian/python-zxcvbn/DEBIAN/prerm | 14 -
.../lib/python2.7/dist-packages/zxcvbn/__init__.py | 26 -
.../dist-packages/zxcvbn/adjacency_graphs.py | 7 -
.../lib/python2.7/dist-packages/zxcvbn/feedback.py | 135 -----
.../dist-packages/zxcvbn/frequency_lists.py | 9 -
.../lib/python2.7/dist-packages/zxcvbn/matching.py | 670 ---------------------
.../lib/python2.7/dist-packages/zxcvbn/scoring.py | 418 -------------
.../dist-packages/zxcvbn/time_estimates.py | 77 ---
.../usr/share/doc/python-zxcvbn/README.rst.gz | Bin 1631 -> 0 bytes
.../share/doc/python-zxcvbn/changelog.Debian.gz | Bin 584 -> 0 bytes
.../usr/share/doc/python-zxcvbn/copyright | 33 -
debian/python3-zxcvbn/DEBIAN/control | 19 -
debian/python3-zxcvbn/DEBIAN/md5sums | 10 -
debian/python3-zxcvbn/DEBIAN/postinst | 9 -
debian/python3-zxcvbn/DEBIAN/prerm | 12 -
.../lib/python3/dist-packages/zxcvbn/__init__.py | 26 -
.../dist-packages/zxcvbn/adjacency_graphs.py | 7 -
.../lib/python3/dist-packages/zxcvbn/feedback.py | 135 -----
.../dist-packages/zxcvbn/frequency_lists.py | 9 -
.../lib/python3/dist-packages/zxcvbn/matching.py | 670 ---------------------
.../lib/python3/dist-packages/zxcvbn/scoring.py | 418 -------------
.../python3/dist-packages/zxcvbn/time_estimates.py | 77 ---
.../dist-packages/zxcvbn_python-4.4.14.egg-info | 12 -
.../share/doc/python3-zxcvbn/changelog.Debian.gz | Bin 584 -> 0 bytes
.../usr/share/doc/python3-zxcvbn/copyright | 33 -
setup.py | 22 +-
35 files changed, 151 insertions(+), 2913 deletions(-)
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index 6613022..0000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2012 Dropbox, Inc.
-
-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.
diff --git a/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn_python-4.4.14.egg-info b/PKG-INFO
similarity index 100%
rename from debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn_python-4.4.14.egg-info
rename to PKG-INFO
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..fc92a0c
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,138 @@
+|Build Status|
+
+zxcvbn-python
+=============
+
+A realistic password strength estimator.
+
+This is a Python implementation of the library created by the team at Dropbox.
+The original library, written for JavaScript, can be found
+`here <https://github.com/dropbox/zxcvbn>`__.
+
+While there may be other Python ports available, this one is the most up
+to date and is recommended by the original developers of zxcvbn at this
+time.
+
+
+Features
+--------
+- **Tested in Python versions 2.6-2.7, 3.3-3.6**
+- Accepts user data to be added to the dictionaries that are tested against (name, birthdate, etc)
+- Gives a score to the password, from 0 (terrible) to 4 (great)
+- Provides feedback on the password and ways to improve it
+- Returns time estimates on how long it would take to guess the password in different situations
+
+Installation
+------------
+
+Install the package using pip: ``pip install zxcvbn-python``
+
+Usage
+-----
+
+Pass a password as the first parameter, and a list of user-provided
+inputs as the ``user_inputs`` parameter (optional).
+
+.. code:: python
+
+ from zxcvbn import zxcvbn
+
+ results = zxcvbn('JohnSmith123', user_inputs=['John', 'Smith'])
+
+ print(results)
+
+Output:
+
+::
+
+ {
+ 'password': 'JohnSmith123',
+ 'score': 2,
+ 'guesses': 2567800,
+ 'guesses_log10': 6.409561194521849,
+ 'calc_time': datetime.timedelta(0, 0, 5204)
+ 'feedback': {
+ 'warning': '',
+ 'suggestions': [
+ 'Add another word or two. Uncommon words are better.',
+ "Capitalization doesn't help very much"
+ ]
+ },
+ 'crack_times_display': {
+ 'offline_fast_hashing_1e10_per_second': 'less than a second'
+ 'offline_slow_hashing_1e4_per_second': '4 minutes',
+ 'online_no_throttling_10_per_second': '3 days',
+ 'online_throttling_100_per_hour': '3 years',
+ },
+ 'crack_times_seconds': {
+ 'offline_fast_hashing_1e10_per_second': 0.00025678,
+ 'offline_slow_hashing_1e4_per_second': 256.78
+ 'online_no_throttling_10_per_second': 256780.0,
+ 'online_throttling_100_per_hour': 92440800.0,
+ },
+ 'sequence': [{
+ 'matched_word': 'john',
+ 'rank': 2,
+ 'pattern': 'dictionary',
+ 'reversed': False,
+ 'token': 'John',
+ 'l33t': False,
+ 'uppercase_variations': 2,
+ 'i': 0,
+ 'guesses': 50,
+ 'l33t_variations': 1,
+ 'dictionary_name': 'male_names',
+ 'base_guesses': 2,
+ 'guesses_log10': 1.6989700043360185,
+ 'j': 3
+ }, {
+ 'matched_word': 'smith123',
+ 'rank': 12789,
+ 'pattern': 'dictionary',
+ 'reversed': False,
+ 'token': 'Smith123',
+ 'l33t': False,
+ 'uppercase_variations': 2,
+ 'i': 4,
+ 'guesses': 25578,
+ 'l33t_variations': 1,
+ 'dictionary_name': 'passwords',
+ 'base_guesses': 12789,
+ 'guesses_log10': 4.407866583030775,
+ 'j': 11
+ }],
+ }
+
+
+Custom Ranked Dictionaries
+--------------------------
+
+In order to support more languages or just add password dictionaries of your own, there is a helper function you may use.
+
+.. code:: python
+
+ from zxcvbn.matching import add_frequency_lists
+
+ add_frequency_lists({
+ 'my_list': ['foo', 'bar'],
+ 'another_list': ['baz']
+ })
+
+These lists will be added to the current ones, but you can also overwrite the current ones if you wish.
+The lists you add should be in order of how common the word is used with the most common words appearing first.
+
+
+Contribute
+----------
+
+- Report an Issue: https://github.com/dwolfhub/zxcvbn-python/issues
+- Submit a Pull Request: https://github.com/dwolfhub/zxcvbn-python/pulls
+
+License
+-------
+
+The project is licensed under the MIT license.
+
+
+.. |Build Status| image:: https://travis-ci.org/dwolfhub/zxcvbn-python.svg?branch=master
+ :target: https://travis-ci.org/dwolfhub/zxcvbn-python
diff --git a/debian/.git-dpm b/debian/.git-dpm
deleted file mode 100644
index 25992e9..0000000
--- a/debian/.git-dpm
+++ /dev/null
@@ -1,11 +0,0 @@
-# see git-dpm(1) from git-dpm package
-8f1e7d86f147de6acf26296ecf59a61aee326c1d
-8f1e7d86f147de6acf26296ecf59a61aee326c1d
-8f1e7d86f147de6acf26296ecf59a61aee326c1d
-8f1e7d86f147de6acf26296ecf59a61aee326c1d
-python-zxcvbn_4.4.14.orig.tar.gz
-ffc0b68a5e2efcd5de081e56a8f14e63914df274
-405082
-debianTag="debian/%e%v"
-patchedTag="patched/%e%v"
-upstreamTag="upstream/%e%u"
diff --git a/debian/changelog b/debian/changelog
index 711b711..ba3cafb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,3 @@
-python-zxcvbn (4.4.14-1) UNRELEASED; urgency=medium
-
- * new upstream version
-
- -- sprawl <sprawl at sprawl.sprawl> Wed, 19 Apr 2017 22:21:06 +0200
-
python-zxcvbn (4.4.14-0.1) experimental; urgency=low
[Sabino Par]
diff --git a/debian/files b/debian/files
deleted file mode 100644
index 40cb8ae..0000000
--- a/debian/files
+++ /dev/null
@@ -1,3 +0,0 @@
-python-zxcvbn_4.4.14-0.1_all.deb python optional
-python-zxcvbn_4.4.14-0.1_amd64.buildinfo python optional
-python3-zxcvbn_4.4.14-0.1_all.deb python optional
diff --git a/debian/python-zxcvbn/DEBIAN/control b/debian/python-zxcvbn/DEBIAN/control
deleted file mode 100644
index d1f0c08..0000000
--- a/debian/python-zxcvbn/DEBIAN/control
+++ /dev/null
@@ -1,18 +0,0 @@
-Package: python-zxcvbn
-Version: 4.4.14-0.1
-Architecture: all
-Maintainer: Sabino Par <sprab at onenetbeyond.org>
-Installed-Size: 848
-Depends: python:any (<< 2.8), python:any (>= 2.7.5-5~)
-Section: python
-Priority: optional
-Homepage: https://github.com/dwolfhub/zxcvbn-python/tree/master
-Description: Realistic password strength estimator. Python2 module
- This is a Python implementation of the library created by the
- team at Dropbox. Accepts user data to be added to the dictionaries
- that are tested against, gives a score to the password, provides
- feedback on the password and ways to improve it, returns time
- estimates on how long it would take to guess the password in
- different situations
- .
- This package provides the Python 2 library.
diff --git a/debian/python-zxcvbn/DEBIAN/md5sums b/debian/python-zxcvbn/DEBIAN/md5sums
deleted file mode 100644
index a1c7993..0000000
--- a/debian/python-zxcvbn/DEBIAN/md5sums
+++ /dev/null
@@ -1,11 +0,0 @@
-cae66136e395afc68ea2a80f3b7ae2c1 usr/lib/python2.7/dist-packages/zxcvbn/__init__.py
-160167e69c0949a2f040aaa406502daf usr/lib/python2.7/dist-packages/zxcvbn/adjacency_graphs.py
-2f8d18fe93a82d43c3190e0ae28b9d4e usr/lib/python2.7/dist-packages/zxcvbn/feedback.py
-1015e6e2065b88a53aa8f6b69e679a66 usr/lib/python2.7/dist-packages/zxcvbn/frequency_lists.py
-77ab0d7243ae199b14ba2e47fbfed6f6 usr/lib/python2.7/dist-packages/zxcvbn/matching.py
-61036279a0559143f7936c7e5df1f9ee usr/lib/python2.7/dist-packages/zxcvbn/scoring.py
-2d5ee14d6009d60f16d86ca99e5e2492 usr/lib/python2.7/dist-packages/zxcvbn/time_estimates.py
-4a33e06bf449883ba9cf6e5577b80ab1 usr/lib/python2.7/dist-packages/zxcvbn_python-4.4.14.egg-info
-706de2b401358289cf3669aaa8be7f49 usr/share/doc/python-zxcvbn/README.rst.gz
-e26efdfbe7fefe916e682e162b7e4f30 usr/share/doc/python-zxcvbn/changelog.Debian.gz
-b482c5b03191b11e8429d269a53c2390 usr/share/doc/python-zxcvbn/copyright
diff --git a/debian/python-zxcvbn/DEBIAN/postinst b/debian/python-zxcvbn/DEBIAN/postinst
deleted file mode 100755
index 6bdc76f..0000000
--- a/debian/python-zxcvbn/DEBIAN/postinst
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-set -e
-
-# Automatically added by dh_python2:
-if which pycompile >/dev/null 2>&1; then
- pycompile -p python-zxcvbn
-fi
-
-# End automatically added section
diff --git a/debian/python-zxcvbn/DEBIAN/prerm b/debian/python-zxcvbn/DEBIAN/prerm
deleted file mode 100755
index 8ba4d1e..0000000
--- a/debian/python-zxcvbn/DEBIAN/prerm
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-set -e
-
-# Automatically added by dh_python2:
-if which pyclean >/dev/null 2>&1; then
- pyclean -p python-zxcvbn
-else
- dpkg -L python-zxcvbn | grep \.py$ | while read file
- do
- rm -f "${file}"[co] >/dev/null
- done
-fi
-
-# End automatically added section
diff --git a/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn/__init__.py b/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn/__init__.py
deleted file mode 100644
index 11964eb..0000000
--- a/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from datetime import datetime
-
-from . import matching, scoring, time_estimates, feedback
-
-
-def zxcvbn(password, user_inputs=None):
- if user_inputs is None:
- user_inputs = []
-
- start = datetime.now()
-
- sanitized_inputs = [str(arg).lower() for arg in user_inputs]
- matching.set_user_input_dictionary(sanitized_inputs)
-
- matches = matching.omnimatch(password)
- result = scoring.most_guessable_match_sequence(password, matches)
- result['calc_time'] = datetime.now() - start
-
- attack_times = time_estimates.estimate_attack_times(result['guesses'])
- for prop, val in attack_times.items():
- result[prop] = val
-
- result['feedback'] = feedback.get_feedback(result['score'],
- result['sequence'])
-
- return result
diff --git a/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn/adjacency_graphs.py b/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn/adjacency_graphs.py
deleted file mode 100644
index 6fd08d2..0000000
--- a/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn/adjacency_graphs.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# generated by scripts/build_keyboard_adjacency_graphs.py
-ADJACENCY_GRAPHS = {
- "qwerty": {"!": ["`~", None, None, "2@", "qQ", None], "\"": [";:", "[{", "]}", None, None, "/?"], "#": ["2@", None, None, "4$", "eE", "wW"], "$": ["3#", None, None, "5%", "rR", "eE"], "%": ["4$", None, None, "6^", "tT", "rR"], "&": ["6^", None, None, "8*", "uU", "yY"], "'": [";:", "[{", "]}", None, None, "/?"], "(": ["8*", None, None, "0)", "oO", "iI"], ")": ["9(", None, None, "-_", "pP", "oO"], "*": ["7&", None, None, "9(", "iI", "uU"], "+": ["-_", None, None, None, "]}", "[{"], "," [...]
- "dvorak": {"!": ["`~", None, None, "2@", "'\"", None], "\"": [None, "1!", "2@", ",<", "aA", None], "#": ["2@", None, None, "4$", ".>", ",<"], "$": ["3#", None, None, "5%", "pP", ".>"], "%": ["4$", None, None, "6^", "yY", "pP"], "&": ["6^", None, None, "8*", "gG", "fF"], "'": [None, "1!", "2@", ",<", "aA", None], "(": ["8*", None, None, "0)", "rR", "cC"], ")": ["9(", None, None, "[{", "lL", "rR"], "*": ["7&", None, None, "9(", "cC", "gG"], "+": ["/?", "]}", None, "\\|", None, "-_"], " [...]
- "keypad": {"*": ["/", None, None, None, "-", "+", "9", "8"], "+": ["9", "*", "-", None, None, None, None, "6"], "-": ["*", None, None, None, None, None, "+", "9"], ".": ["0", "2", "3", None, None, None, None, None], "/": [None, None, None, None, "*", "9", "8", "7"], "0": [None, "1", "2", "3", ".", None, None, None], "1": [None, None, "4", "5", "2", "0", None, None], "2": ["1", "4", "5", "6", "3", ".", "0", None], "3": ["2", "5", "6", None, None, None, ".", "0"], "4": [None, None, "7" [...]
- "mac_keypad": {"*": ["/", None, None, None, None, None, "-", "9"], "+": ["6", "9", "-", None, None, None, None, "3"], "-": ["9", "/", "*", None, None, None, "+", "6"], ".": ["0", "2", "3", None, None, None, None, None], "/": ["=", None, None, None, "*", "-", "9", "8"], "0": [None, "1", "2", "3", ".", None, None, None], "1": [None, None, "4", "5", "2", "0", None, None], "2": ["1", "4", "5", "6", "3", ".", "0", None], "3": ["2", "5", "6", "+", None, None, ".", "0"], "4": [None, None, " [...]
-}
\ No newline at end of file
diff --git a/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn/feedback.py b/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn/feedback.py
deleted file mode 100644
index f8f7549..0000000
--- a/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn/feedback.py
+++ /dev/null
@@ -1,135 +0,0 @@
-from zxcvbn.scoring import START_UPPER, ALL_UPPER
-from gettext import gettext as _
-
-
-def get_feedback(score, sequence):
- if len(sequence) == 0:
- return {
- 'warning': '',
- 'suggestions': [
- _("Use a few words, avoid common phrases."),
- _("No need for symbols, digits, or uppercase letters.")
- ]
- }
-
- if score > 2:
- return {
- 'warning': '',
- 'suggestions': [],
- }
-
- longest_match = sequence[0]
- for match in sequence[1:]:
- if len(match['token']) > len(longest_match['token']):
- longest_match = match
-
- feedback = get_match_feedback(longest_match, len(sequence) == 1)
- extra_feedback = _('Add another word or two. Uncommon words are better.')
- if feedback:
- feedback['suggestions'].insert(0, extra_feedback)
- if not feedback['warning']:
- feedback['warning'] = ''
- else:
- feedback = {
- 'warning': '',
- 'suggestions': [extra_feedback]
- }
-
- return feedback
-
-
-def get_match_feedback(match, is_sole_match):
- if match['pattern'] == 'dictionary':
- return get_dictionary_match_feedback(match, is_sole_match)
- elif match['pattern'] == 'spatial':
- if match['turns'] == 1:
- warning = _('Straight rows of keys are easy to guess.')
- else:
- warning = _('Short keyboard patterns are easy to guess.')
-
- return {
- 'warning': warning,
- 'suggestions': [
- _('Use a longer keyboard pattern with more turns.')
- ]
- }
- elif match['pattern'] == 'repeat':
- if len(match['base_token']) == 1:
- warning = _('Repeats like "aaa" are easy to guess.')
- else:
- warning = _('Repeats like "abcabcabc" are only slightly harder to ' \
- 'guess than "abc".')
- return {
- 'warning': warning,
- 'suggestions': [
- _('Avoid repeated words and characters.')
- ]
- }
- elif match['pattern'] == 'sequence':
- return {
- 'warning': _("Sequences like abc or 6543 are easy to guess."),
- 'suggestions': [
- _('Avoid sequences.')
- ]
- }
- elif match['pattern'] == 'regex':
- if match['regex_name'] == 'recent_year':
- return {
- 'warning': _("Recent years are easy to guess."),
- 'suggestions': [
- _('Avoid recent years.'),
- _('Avoid years that are associated with you.'),
- ]
- }
- elif match['pattern'] == 'date':
- return {
- 'warning': _("Dates are often easy to guess."),
- 'suggestions': [
- _('Avoid dates and years that are associated with you.'),
- ],
- }
-
-
-def get_dictionary_match_feedback(match, is_sole_match):
- warning = ''
- if match['dictionary_name'] == 'passwords':
- if is_sole_match and not match.get('l33t', False) and not \
- match['reversed']:
- if match['rank'] <= 10:
- warning = _('This is a top-10 common password.')
- elif match['rank'] <= 100:
- warning = _('This is a top-100 common password.')
- else:
- warning = _('This is a very common password.')
- elif match['guesses_log10'] <= 4:
- warning = _('This is similar to a commonly used password.')
- elif match['dictionary_name'] == 'english':
- if is_sole_match:
- warning = _('A word by itself is easy to guess.')
- elif match['dictionary_name'] in ['surnames', 'male_names',
- 'female_names', ]:
- if is_sole_match:
- warning = _('Names and surnames by themselves are easy to guess.')
- else:
- warning = _('Common names and surnames are easy to guess.')
- else:
- warning = ''
-
- suggestions = []
- word = match['token']
- if START_UPPER.search(word):
- suggestions.append(_("Capitalization doesn't help very much."))
- elif ALL_UPPER.search(word) and word.lower() != word:
- suggestions.append(_("All-uppercase is almost as easy to guess as "
- "all-lowercase."))
-
- if match['reversed'] and len(match['token']) >= 4:
- suggestions.append(_("Reversed words aren't much harder to guess."))
- if match.get('l33t', False):
- suggestions.append(_("Predictable substitutions like '@' instead of 'a' "
- "don't help very much."))
-
- return {
- 'warning': warning,
- 'suggestions': suggestions,
- }
diff --git a/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn/frequency_lists.py b/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn/frequency_lists.py
deleted file mode 100644
index 9d4ce38..0000000
--- a/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn/frequency_lists.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# generated by build_frequency_lists
-FREQUENCY_LISTS = {
- "passwords": "123456,password,12345678,qwerty,123456789,12345,1234,111111,1234567,dragon,123123,baseball,abc123,football,monkey,letmein,shadow,master,696969,mustang,666666,qwertyuiop,123321,1234567890,pussy,superman,654321,1qaz2wsx,7777777,fuckyou,qazwsx,jordan,123qwe,000000,killer,trustno1,hunter,harley,zxcvbnm,asdfgh,buster,batman,soccer,tigger,charlie,sunshine,iloveyou,fuckme,ranger,hockey,computer,starwars,asshole,pepper,klaster,112233,zxcvbn,freedom,princess,maggie,pass,ginger,1 [...]
- "english_wikipedia": "the,of,and,in,was,is,for,as,on,with,by,he,at,from,his,an,were,are,which,doc,https,also,or,has,had,first,one,their,its,after,new,who,they,two,her,she,been,other,when,time,during,there,into,school,more,may,years,over,only,year,most,would,world,city,some,where,between,later,three,state,such,then,national,used,made,known,under,many,university,united,while,part,season,team,these,american,than,film,second,born,south,became,states,war,through,being,including,both,befor [...]
- "female_names": "mary,patricia,linda,barbara,elizabeth,jennifer,maria,susan,margaret,dorothy,lisa,nancy,karen,betty,helen,sandra,donna,carol,ruth,sharon,michelle,laura,sarah,kimberly,deborah,jessica,shirley,cynthia,angela,melissa,brenda,amy,anna,rebecca,virginia,kathleen,pamela,martha,debra,amanda,stephanie,carolyn,christine,marie,janet,catherine,frances,ann,joyce,diane,alice,julie,heather,teresa,doris,gloria,evelyn,jean,cheryl,mildred,katherine,joan,ashley,judith,rose,janice,kelly,n [...]
- "surnames": "smith,johnson,williams,jones,brown,davis,miller,wilson,moore,taylor,anderson,jackson,white,harris,martin,thompson,garcia,martinez,robinson,clark,rodriguez,lewis,lee,walker,hall,allen,young,hernandez,king,wright,lopez,hill,green,adams,baker,gonzalez,nelson,carter,mitchell,perez,roberts,turner,phillips,campbell,parker,evans,edwards,collins,stewart,sanchez,morris,rogers,reed,cook,morgan,bell,murphy,bailey,rivera,cooper,richardson,cox,howard,ward,torres,peterson,gray,ramirez [...]
- "us_tv_and_film": "you,i,to,that,it,me,what,this,know,i'm,no,have,my,don't,just,not,do,be,your,we,it's,so,but,all,well,oh,about,right,you're,get,here,out,going,like,yeah,if,can,up,want,think,that's,now,go,him,how,got,did,why,see,come,good,really,look,will,okay,back,can't,mean,tell,i'll,hey,he's,could,didn't,yes,something,because,say,take,way,little,make,need,gonna,never,we're,too,she's,i've,sure,our,sorry,what's,let,thing,maybe,down,man,very,there's,should,anything,said,much,any,even [...]
- "male_names": "james,john,robert,michael,william,david,richard,charles,joseph,thomas,christopher,daniel,paul,mark,donald,george,kenneth,steven,edward,brian,ronald,anthony,kevin,jason,matthew,gary,timothy,jose,larry,jeffrey,frank,scott,eric,stephen,andrew,raymond,gregory,joshua,jerry,dennis,walter,patrick,peter,harold,douglas,henry,carl,arthur,ryan,roger,joe,juan,jack,albert,jonathan,justin,terry,gerald,keith,samuel,willie,ralph,lawrence,nicholas,roy,benjamin,bruce,brandon,adam,harry, [...]
-}
\ No newline at end of file
diff --git a/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn/matching.py b/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn/matching.py
deleted file mode 100644
index 713aa16..0000000
--- a/debian/python-zxcvbn/usr/lib/python2.7/dist-packages/zxcvbn/matching.py
+++ /dev/null
@@ -1,670 +0,0 @@
-from zxcvbn import scoring
-from . import adjacency_graphs
-from zxcvbn.frequency_lists import FREQUENCY_LISTS
-import re
-
-from zxcvbn.scoring import most_guessable_match_sequence
-
-
-def build_ranked_dict(ordered_list):
- result = {}
- i = 1
- for word in ordered_list:
- result[word] = i
- i += 1
-
- return result
-
-
-RANKED_DICTIONARIES = {}
-
-
-def add_frequency_lists(frequency_lists_):
- for name, lst in frequency_lists_.items():
- RANKED_DICTIONARIES[name] = build_ranked_dict(lst)
-
-
-add_frequency_lists(FREQUENCY_LISTS)
-
-GRAPHS = {
- 'qwerty': adjacency_graphs.ADJACENCY_GRAPHS['qwerty'],
- 'dvorak': adjacency_graphs.ADJACENCY_GRAPHS['dvorak'],
- 'keypad': adjacency_graphs.ADJACENCY_GRAPHS['keypad'],
- 'mac_keypad': adjacency_graphs.ADJACENCY_GRAPHS['mac_keypad'],
-}
-
-L33T_TABLE = {
- 'a': ['4', '@'],
- 'b': ['8'],
- 'c': ['(', '{', '[', '<'],
- 'e': ['3'],
- 'g': ['6', '9'],
- 'i': ['1', '!', '|'],
- 'l': ['1', '|', '7'],
- 'o': ['0'],
- 's': ['$', '5'],
- 't': ['+', '7'],
- 'x': ['%'],
- 'z': ['2'],
-}
-
-REGEXEN = {
- 'recent_year': re.compile(r'19\d\d|200\d|201\d'),
-}
-
-DATE_MAX_YEAR = 2050
-DATE_MIN_YEAR = 1000
-DATE_SPLITS = {
- 4: [ # for length-4 strings, eg 1191 or 9111, two ways to split:
- [1, 2], # 1 1 91 (2nd split starts at index 1, 3rd at index 2)
- [2, 3], # 91 1 1
- ],
- 5: [
- [1, 3], # 1 11 91
- [2, 3], # 11 1 91
- ],
- 6: [
- [1, 2], # 1 1 1991
- [2, 4], # 11 11 91
- [4, 5], # 1991 1 1
- ],
- 7: [
- [1, 3], # 1 11 1991
- [2, 3], # 11 1 1991
- [4, 5], # 1991 1 11
- [4, 6], # 1991 11 1
- ],
- 8: [
- [2, 4], # 11 11 1991
- [4, 6], # 1991 11 11
- ],
-}
-
-
-# omnimatch -- perform all matches
-def omnimatch(password):
- matches = []
- for matcher in [
- dictionary_match,
- reverse_dictionary_match,
- l33t_match,
- spatial_match,
- repeat_match,
- sequence_match,
- regex_match,
- date_match,
- ]:
- matches.extend(matcher(password))
-
- return sorted(matches, key=lambda x: (x['i'], x['j']))
-
-
-# dictionary match (common passwords, english, last names, etc)
-def dictionary_match(password, _ranked_dictionaries=RANKED_DICTIONARIES):
- matches = []
- length = len(password)
- password_lower = password.lower()
- for dictionary_name, ranked_dict in _ranked_dictionaries.items():
- for i in range(length):
- for j in range(i, length):
- if password_lower[i:j + 1] in ranked_dict:
- word = password_lower[i:j + 1]
- rank = ranked_dict[word]
- matches.append({
- 'pattern': 'dictionary',
- 'i': i,
- 'j': j,
- 'token': password[i:j + 1],
- 'matched_word': word,
- 'rank': rank,
- 'dictionary_name': dictionary_name,
- 'reversed': False,
- 'l33t': False,
- })
-
- return sorted(matches, key=lambda x: (x['i'], x['j']))
-
-
-def reverse_dictionary_match(password,
- _ranked_dictionaries=RANKED_DICTIONARIES):
- reversed_password = ''.join(reversed(password))
- matches = dictionary_match(reversed_password, _ranked_dictionaries)
- for match in matches:
- match['token'] = ''.join(reversed(match['token']))
- match['reversed'] = True
- match['i'], match['j'] = len(password) - 1 - match['j'], \
- len(password) - 1 - match['i']
-
- return sorted(matches, key=lambda x: (x['i'], x['j']))
-
-
-def set_user_input_dictionary(ordered_list):
- RANKED_DICTIONARIES['user_inputs'] = build_ranked_dict(ordered_list)
-
-
-def relevant_l33t_subtable(password, table):
- password_chars = {}
- for char in list(password):
- password_chars[char] = True
-
- subtable = {}
- for letter, subs in table.items():
- relevant_subs = [sub for sub in subs if sub in password_chars]
- if len(relevant_subs) > 0:
- subtable[letter] = relevant_subs
-
- return subtable
-
-
-def enumerate_l33t_subs(table):
- keys = list(table.keys())
- subs = [[]]
-
- def dedup(subs):
- deduped = []
- members = {}
- for sub in subs:
- assoc = [(k, v) for v, k in sub]
- assoc.sort()
- label = '-'.join([k + ',' + str(v) for k, v in assoc])
- if label not in members:
- members[label] = True
- deduped.append(sub)
-
- return deduped
-
- def helper(keys, subs):
- if not len(keys):
- return subs
-
- first_key = keys[0]
- rest_keys = keys[1:]
- next_subs = []
- for l33t_chr in table[first_key]:
- for sub in subs:
- dup_l33t_index = -1
- for i in range(len(sub)):
- if sub[i][0] == l33t_chr:
- dup_l33t_index = i
- break
- if dup_l33t_index == -1:
- sub_extension = list(sub)
- sub_extension.append([l33t_chr, first_key])
- next_subs.append(sub_extension)
- else:
- sub_alternative = sub
- sub_alternative.pop(dup_l33t_index)
- sub_alternative.append([l33t_chr, first_key])
- next_subs.append(sub)
- next_subs.append(sub_alternative)
-
- subs = dedup(next_subs)
- return helper(rest_keys, subs)
-
- subs = helper(keys, subs)
- sub_dicts = [] # convert from assoc lists to dicts
- for sub in subs:
- sub_dict = {}
- for l33t_chr, chr in sub:
- sub_dict[l33t_chr] = chr
- sub_dicts.append(sub_dict)
-
- return sub_dicts
-
-
-def translate(string, chr_map):
- chars = []
- for char in list(string):
- if chr_map.get(char, False):
- chars.append(chr_map[char])
- else:
- chars.append(char)
-
- return ''.join(chars)
-
-
-def l33t_match(password, _ranked_dictionaries=RANKED_DICTIONARIES,
- _l33t_table=L33T_TABLE):
- matches = []
-
- for sub in enumerate_l33t_subs(
- relevant_l33t_subtable(password, _l33t_table)):
- if not len(sub):
- break
-
- subbed_password = translate(password, sub)
- for match in dictionary_match(subbed_password, _ranked_dictionaries):
- token = password[match['i']:match['j'] + 1]
- if token.lower() == match['matched_word']:
- # only return the matches that contain an actual substitution
- continue
-
- # subset of mappings in sub that are in use for this match
- match_sub = {}
- for subbed_chr, chr in sub.items():
- if subbed_chr in token:
- match_sub[subbed_chr] = chr
- match['l33t'] = True
- match['token'] = token
- match['sub'] = match_sub
- match['sub_display'] = ', '.join(
- ["%s -> %s" % (k, v) for k, v in match_sub.items()]
- )
- matches.append(match)
-
- matches = [match for match in matches if len(match['token']) > 1]
-
- return sorted(matches, key=lambda x: (x['i'], x['j']))
-
-
-# repeats (aaa, abcabcabc) and sequences (abcdef)
-def repeat_match(password):
- matches = []
- greedy = re.compile(r'(.+)\1+')
- lazy = re.compile(r'(.+?)\1+')
- lazy_anchored = re.compile(r'^(.+?)\1+$')
- last_index = 0
- while last_index < len(password):
- greedy_match = greedy.search(password, pos=last_index)
- lazy_match = lazy.search(password, pos=last_index)
-
- if not greedy_match:
- break
-
- if len(greedy_match.group(0)) > len(lazy_match.group(0)):
- # greedy beats lazy for 'aabaab'
- # greedy: [aabaab, aab]
- # lazy: [aa, a]
- match = greedy_match
- # greedy's repeated string might itself be repeated, eg.
- # aabaab in aabaabaabaab.
- # run an anchored lazy match on greedy's repeated string
- # to find the shortest repeated string
- base_token = lazy_anchored.search(match.group(0)).group(1)
- else:
- match = lazy_match
- base_token = match.group(1)
-
- i, j = match.span()[0], match.span()[1] - 1
-
- # recursively match and score the base string
- base_analysis = most_guessable_match_sequence(
- base_token,
- omnimatch(base_token)
- )
- base_matches = base_analysis['sequence']
- base_guesses = base_analysis['guesses']
- matches.append({
- 'pattern': 'repeat',
- 'i': i,
- 'j': j,
- 'token': match.group(0),
- 'base_token': base_token,
- 'base_guesses': base_guesses,
- 'base_matches': base_matches,
- 'repeat_count': len(match.group(0)) / len(base_token),
- })
- last_index = j + 1
-
- return matches
-
-
-def spatial_match(password, _graphs=GRAPHS):
- matches = []
- for graph_name, graph in _graphs.items():
- matches.extend(spatial_match_helper(password, graph, graph_name))
-
- return sorted(matches, key=lambda x: (x['i'], x['j']))
-
-
-SHIFTED_RX = re.compile(r'[~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?]')
-
-
-def spatial_match_helper(password, graph, graph_name):
- matches = []
- i = 0
- while i < len(password) - 1:
- j = i + 1
- last_direction = None
- turns = 0
- if graph_name in ['qwerty', 'dvorak', ] and \
- SHIFTED_RX.search(password[i]):
- # initial character is shifted
- shifted_count = 1
- else:
- shifted_count = 0
-
- while True:
- prev_char = password[j - 1]
- found = False
- found_direction = -1
- cur_direction = -1
- try:
- adjacents = graph[prev_char] or []
- except KeyError:
- adjacents = []
- # consider growing pattern by one character if j hasn't gone
- # over the edge.
- if j < len(password):
- cur_char = password[j]
- for adj in adjacents:
- cur_direction += 1
- if adj and cur_char in adj:
- found = True
- found_direction = cur_direction
- if adj.index(cur_char) == 1:
- # index 1 in the adjacency means the key is shifted,
- # 0 means unshifted: A vs a, % vs 5, etc.
- # for example, 'q' is adjacent to the entry '2@'.
- # @ is shifted w/ index 1, 2 is unshifted.
- shifted_count += 1
- if last_direction != found_direction:
- # adding a turn is correct even in the initial case
- # when last_direction is null:
- # every spatial pattern starts with a turn.
- turns += 1
- last_direction = found_direction
- break
- # if the current pattern continued, extend j and try to grow again
- if found:
- j += 1
- # otherwise push the pattern discovered so far, if any...
- else:
- if j - i > 2: # don't consider length 1 or 2 chains.
- matches.append({
- 'pattern': 'spatial',
- 'i': i,
- 'j': j - 1,
- 'token': password[i:j],
- 'graph': graph_name,
- 'turns': turns,
- 'shifted_count': shifted_count,
- })
- # ...and then start a new search for the rest of the password.
- i = j
- break
-
- return matches
-
-
-MAX_DELTA = 5
-
-
-def sequence_match(password):
- # Identifies sequences by looking for repeated differences in unicode codepoint.
- # this allows skipping, such as 9753, and also matches some extended unicode sequences
- # such as Greek and Cyrillic alphabets.
- #
- # for example, consider the input 'abcdb975zy'
- #
- # password: a b c d b 9 7 5 z y
- # index: 0 1 2 3 4 5 6 7 8 9
- # delta: 1 1 1 -2 -41 -2 -2 69 1
- #
- # expected result:
- # [(i, j, delta), ...] = [(0, 3, 1), (5, 7, -2), (8, 9, 1)]
- if len(password) == 1:
- return []
-
- def update(i, j, delta):
- if j - 1 > 1 or delta and abs(delta) == 1:
- if 0 < abs(delta) <= MAX_DELTA:
- token = password[i:j + 1]
- if re.compile(r'^[a-z]+$').match(token):
- sequence_name = 'lower'
- sequence_space = 26
- elif re.compile(r'^[A-Z]+$').match(token):
- sequence_name = 'upper'
- sequence_space = 26
- elif re.compile(r'^\d+$').match(token):
- sequence_name = 'digits'
- sequence_space = 10
- else:
- sequence_name = 'unicode'
- sequence_space = 26
- result.append({
- 'pattern': 'sequence',
- 'i': i,
- 'j': j,
- 'token': password[i:j + 1],
- 'sequence_name': sequence_name,
- 'sequence_space': sequence_space,
- 'ascending': delta > 0
- })
-
- result = []
- i = 0
- last_delta = None
-
- for k in range(1, len(password)):
- delta = ord(password[k]) - ord(password[k - 1])
- if not last_delta:
- last_delta = delta
- if delta == last_delta:
- continue
- j = k - 1
- update(i, j, last_delta)
- i = j
- last_delta = delta
- update(i, len(password) - 1, last_delta)
-
- return result
-
-
-def regex_match(password, _regexen=REGEXEN):
- matches = []
- for name, regex in _regexen.items():
- rx_match = regex.match(password)
... 2317 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-zxcvbn.git
More information about the Python-modules-commits
mailing list