Package: passchek
PasschekPasschek is a simple cli tool, checks if your password has been compromised.Passchek is a python program for searching inTroy Hunt's pwnedpasswordAPI using the k-anonymity algorithm.Passchek was inspired byjamesridgway/pwnedpasswords.shbash script.AlgorithmHash the PASSWORD by SHA1.Split hash for 5 char prefix and 35 char suffix.RequestsTroy Hunt's pwnedpasswordAPI for the prefix.Convert response to the dictionary with suffixes as keys and number of matches as values.And finally determine matches for initial PASSWORD by its hash suffix as a key.FeaturesChecks one password or number of passwords.Shows a text sentence about  compromising or just figures.It can be used in shell pipes, it can read stdin.It can display the SHA1 password hash in a tuple format (“prefix”, “suffix”) without an Internet request.UsageUsage:passchek.py[options][<PASSWORD>]Arguments:PASSWORDProvide(password|passwords)asargumentorleaveblanktoprovideviastdinorpromptOptions:-h,--helpShowsthishelpmessageandexit-n,--num-onlySetoutputwithoutaccompanyingtext-p,--pipeForuseinshellpipes,readstdin-s,--sha1ShowsSHA1hashintuple("prefix","suffix")andexit-v,--versionShowscurrentversionoftheprogramandexitSecurity NotePlease note that in case of using PASSWORD as command line argument it will be kept in .bash_history file in raw insecure format. Using via explicit prompt dialog is more secure and preferably.Usage examplesA) Callpasschekwithout options and arguments, enter 'qwerty' as an example password.Please note that when you are typing password via explicit prompt, nothing is displayed on the screen, this is normal and is used for security reasons.After press Enter key you'll see a sentence in new line with number of matches in the pwnedpassword DB.$python3passchek.pyEnterpassword:Thispasswordhasappeared3912816timesindatabreaches.B) Callpasschekwith option '-n' (--num-only) without arguments, enter 'qwerty' as an example password. After press Enter key you'll see a number in new line with matches in the pwnedpassword DB.$python3passchek.py-nEnterpassword:3912816C) Callpasschekwith option '-s' (--sha1) without arguments, enter 'qwerty' as an example password. After press Enter key you'll see new line with the password hash in a tuple format (“prefix”, “suffix”).$python3passchek.py-sEnterpassword:('B1B37','73A05C0ED0176787A4F1574FF0075F7521E')D) Callpasschekwith options '-ns' (--num-only --sha1) without arguments, enter 'qwerty' as an example password. After press Enter key you'll see new line with the password hash splited by space 'prefix suffix'.$python3passchek.py-nsEnterpassword:B1B3773A05C0ED0176787A4F1574FF0075F7521EE) Callpasschekwithout options and with argument 'qwerty' as an example password. You'll see a sentence in new line with number of matches in the pwnedpassword DB.Please note that using real password as an argument not recommended, for more details seeSecurity Note.$python3passchek.pyqwertyThispasswordhasappeared3912816timesindatabreaches.F) Callpasschekwith option '-n' (--num-only) and with arguments 'qwerty', 'ytrewq', 'qazwsx'(these three are very common weak passwords)and 'jnfjdfksdjfbskjdeuhiseg'(random typing)as examples passwords. You'll see numbers in new lines with matches in the pwnedpassword DB.Please don't forget aboutSecurity Note.$python3passchek.py-nqwertyytrewqqazwsxjnfjdfksdjfbskjdeuhiseg3912816333385053440G) Usepasschekwith options '-np' (--num-only --pipe) in pipe withcat pass_list.txtto check all passwords in text file (In this example text file was created asls .. > pass_list.txtin the script dir). You'll see numbers in new lines with matches in the pwnedpassword DB.$catpass_list.txt|python3passchek.py-np218000000457H) Let's count a number of compromised passwords in the previous example 'G'.$catpass_list.txt|python3passchek.py-np|grep-v'^0'|wc-l3So three passwords in our list have been compromised.I) To determine these three weak passwords we need to know their line numbers in the text file.$catpass_list.txt|python3passchek.py-np|grep-vn'^0'1:212:89:457J) Now we can get a list of strong passwords just delete lines with compromised.$sed-i'1d;2d;9d;'pass_list.txt|python3passchek.py-np|grep-v'^0'|wc-l0So no more weak passwords detected.InstallationYou can simple download one script filepasschek.pyand use it with python3.Or try to install by pip.First check if package exists:$python3-mpipsearchpasschekInstall if package exists:$python3-mpipinstall--userpasschekOr just:$pip3installpasschekHelpFor help screen just provide-hor--helpas a command line option.Option-vor--versionshows current version.ContributingThe main repository if the code is athttps://github.com/edyatl/passchekI'm happy to take from you any patches, pull requests,  bug reports,  ideas about new functionality and so on.ThanksThanks toTroy Huntfor collecting data and providing API.Thanks toJames Ridgwayforpwnedpasswords.shbash script.AuthorsYevgeny Dyatlov (@edyatl)LicenseThis project is licensed under the MIT License.Copyright (c) 2020 Yevgeny Dyatlov (@edyatl)Please see theLICENSEfile for details.