Support reading passwords from standard input
This commit is contained in:
parent
366b730905
commit
068f0832f7
@ -3,6 +3,13 @@ Pwned Password API lookup
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
python pwned.py [password]
|
* `python pwned.py` – reads passwords from standard input;
|
||||||
|
* `pytohn pwned.py <[file-with-passwords]` – reads passwords from
|
||||||
|
a file;
|
||||||
|
* `another-command | pytohn pwned.py <[file-with-passwords]` – reads
|
||||||
|
passwords written to standard output by another command;
|
||||||
|
* `python pwned.py [password]` – checks passwords given as command line
|
||||||
|
arguments (beware the password may be saved in shell history and that
|
||||||
|
other users on the system ma be able to observe the command line).
|
||||||
|
|
||||||
Have fun! Oh, and if you find one of your own passwords, change it asap!
|
Have fun! Oh, and if you find one of your own passwords, change it asap!
|
||||||
|
3
pwned.py
3
pwned.py
@ -18,7 +18,8 @@ def lookup_pwned_api(pwd):
|
|||||||
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
for pwd in args:
|
for pwd in args or sys.stdin:
|
||||||
|
pwd = pwd.strip()
|
||||||
api_return = lookup_pwned_api(pwd)
|
api_return = lookup_pwned_api(pwd)
|
||||||
if (api_return):
|
if (api_return):
|
||||||
print(pwd, "was found")
|
print(pwd, "was found")
|
||||||
|
Loading…
Reference in New Issue
Block a user