This module implements different typo correction strategies discussed in https://www.cs.cornell.edu/~rahul/papers/pwtypos.pdf. For more details please refer to the project page https://www.cs.cornell.edu/~rahul/projects/pwtypos.html.
pwmodel
from here
bash
$ pip install git+https://github.com/rchatterjee/pwmodels.git
This should install all the dependencies, if not, you may have to
install python-Levenshtein
.
bash
$ pip install python-Levenshtein
bash
$ pip install git+https://github.com/rchatterjee/mistypography.git
To allow online typo correction, a set of corrected version of the
mistyped password is created, and then each of them is tested against
the real password hash. This code only generates the possible set of
corrections (a.k.a. ball). The simplest way to do this is to use one
of the built-in checkers (BUILT_IN_CHECKERS
) in
typofixer/checker.py
file. Descriptions of these checkers is given
in the checker.py
file.
You can also instantiate your own Checker
. To instanticate a
checker we need two arguments, first, a set of correctors which you
can see the names given in common.py, and second, a policy number
which will tune the checker to use one of the given policies (ChkAll,
ChkBl etc.).
Note, the checker needs the data
directory to be in the same
folder. You can move the data
directory and change path
DATA_DIR_PATH
in common.py
accordingly.
```bash $ python Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information.
from typofixer.checker import BUILT_IN_CHECKERS
chk = BUILT_IN_CHECKERS['ChkAllTop3']
chk = BUILT_IN_CHECKERS['ChkAllTop3']
chk.check('password') set(['passwor', 'Password', 'PASSWORD', 'password'])
chk_bl = BUILT_IN_CHECKERS['ChkBlTop3']
chk_bl.check('password') set(['passwor', 'password'])
chk_all = BUILT_IN_CHECKERS['ChkAllTop5']
chk_all.check('password1') set(['assword1', 'PASSWORD1', 'Password1', 'password!', 'password', 'password1'])
```
Rahul Chatterjee ([email protected])
Bumps ipython from 4.1.2 to 7.16.3.
d43c7c7
release 7.16.35fa1e40
Merge pull request from GHSA-pq7m-3gw7-gq5x8df8971
back to dev9f477b7
release 7.16.2138f266
bring back release helper from master branch5aa3634
Merge pull request #13341 from meeseeksmachine/auto-backport-of-pr-13335-on-7...bcae8e0
Backport PR #13335: What's new 7.16.28fcdcd3
Pin Jedi to <0.17.2.2486838
release 7.16.120bdc6f
fix conda buildDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Bumps py from 1.4.31 to 1.10.0.
Sourced from py's changelog.
1.10.0 (2020-12-12)
- Fix a regular expression DoS vulnerability in the py.path.svnwc SVN blame functionality (CVE-2020-29651)
- Update vendored apipkg: 1.4 => 1.5
- Update vendored iniconfig: 1.0.0 => 1.1.1
1.9.0 (2020-06-24)
Add type annotation stubs for the following modules:
py.error
py.iniconfig
py.path
(not including SVN paths)py.io
py.xml
There are no plans to type other modules at this time.
The type annotations are provided in external .pyi files, not inline in the code, and may therefore contain small errors or omissions. If you use
py
in conjunction with a type checker, and encounter any type errors you believe should be accepted, please report it in an issue.1.8.2 (2020-06-15)
- On Windows,
py.path.local
s which differ only in case now have the same Python hash value. Previously, such paths were considered equal but had different hashes, which is not allowed and breaks the assumptions made by dicts, sets and other users of hashes.1.8.1 (2019-12-27)
Handle
FileNotFoundError
when trying to import pathlib inpath.common
on Python 3.4 (#207).
py.path.local.samefile
now works correctly in Python 3 on Windows when dealing with symlinks.1.8.0 (2019-02-21)
add
"importlib"
pyimport mode for python3.5+, allowing unimportable test suites to contain identically named modules.fix
LocalPath.as_cwd()
not callingos.chdir()
withNone
, when being invoked from a non-existing directory.
... (truncated)
e5ff378
Update CHANGELOG for 1.10.094cf44f
Update vendored libs5e8ded5
testing: comment out an assert which fails on Python 3.9 for nowafdffcc
Rename HOWTORELEASE.rst to RELEASING.rst2de53a6
Merge pull request #266 from nicoddemus/gh-actionsfa1b32e
Merge pull request #264 from hugovk/patch-2887d6b8
Skip test_samefile_symlink on pypy3 on Windowse94e670
Fix test_comments() in test_sourcefef9a32
Adapt test4a694b0
Add GitHub Actions badge to READMEDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
n
size is never usedtpw_done
& guess_list
serve the same purpose, so remove tpw_done
estimated_ball_weight
is always positive (product of probability and the size of ball)test_success_rate
is never calledHi @rchatterjee,
I really like your work on typo correction! I read your 2016 paper and I've been digging through the code to try and understand it better.
I am curious about how the security loss lambda q greedy is calculated for the various checkers. After solving the best-q-guesses problem in your experiment, you sum the probability of the union ball for every password in the best greedy guesses:
https://github.com/rchatterjee/mistypography/blob/f0fb62cdc42bcd2f4e0881cdeaccfa640edd0b20/security/compute_sec_loss.ver1.py#L207
https://github.com/rchatterjee/mistypography/blob/f0fb62cdc42bcd2f4e0881cdeaccfa640edd0b20/security/compute_secloss.py#L30
I understand that the union ball would be the checked ball for the always checker but this isn't the case for the blacklist & optimal checkers. It seems to me that lambda q greedy should be calculated using the checked ball with typofixer.check(password) | set([password])
.
Looking forward to hearing back from you!