
Security News
OpenGrep Restores Fingerprinting in JSON and SARIF Outputs
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
|Build Status|
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.
Install the package using pip: pip install zxcvbn
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
}],
}
Another optional argument is max_length
, allowing override of the default max password length of 72.
.. code:: python
from zxcvbn import zxcvbn
results = zxcvbn('JohnSmith321', user_inputs=['John', 'Smith'], max_length=88)
.. warning::
We strongly advise against setting max_length
greater than 72,
as it can lead to long processing times and may leave server-side applications open
to denial-of-service scenarios.
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.
CLI
You an also use zxcvbn from the command line::
echo 'password' | zxcvbn --user-input <user-input> | jq
You can include a ``--max-length`` argument::
echo '<long password>' | zxcvbn --max-length 142
You can also execute the zxcvbn module::
echo 'password' | python -m zxcvbn --user-input <user-input> | jq
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
FAQs
Unknown package
We found that zxcvbn demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.