Re:"Pwned Passwords" V2 With Half a Billion Passwords
by r1ch on Wednesday February 21, 2018 @05:39PM
(#16433632)
Another way is to prefix the command with whitespace.
[ Parent
| on HN ]
Re:"Pwned Passwords" V2 With Half a Billion Passwords
by baliex on Wednesday February 21, 2018 @05:57PM
(#16433732)
Only if..
export HISTCONTROL=ignorespace
..is set (either by default or explicitly)
Re:"Pwned Passwords" V2 With Half a Billion Passwords
by deathanatos on Wednesday February 21, 2018 @09:30PM
(#16434742)
python3 -c 'import getpass, hashlib; print(hashlib.sha1(getpass.getpass().encode("utf-8")).hexdigest())'
Avoids history, doesn't echo to the terminal.In fact, you should be able to just make a rudimentary CLI into Troy's API simply with:
#!/bin/bash
HASH="$(python3 -c 'import getpass, hashlib; print(hashlib.sha1(getpass.getpass().encode("utf-8")).hexdigest().upper())')"
curl -sS "https://api.pwnedpasswords.com/range/${HASH:0:5}" | grep "${HASH:5}"
(It'll emit the line from the API response matching your pass; if it does, then that password was compromised. Bash isn't real good at error handling though, so my biggest concern would be what this might do if an HTTP/TCP error happened. I've attempted to throw -S there to catch that, but use with your head screwed on.)