philnash / pwned

😱 An easy, Ruby way to use the Pwned Passwords API.
https://rubygems.org/gems/pwned/
MIT License
421 stars 22 forks source link

Add a pwned CLI/executable tool #12

Closed philnash closed 5 years ago

philnash commented 5 years ago

This takes @chrp's work from #11 and extends it with a bit more CLI stuff.

Honestly, I might have got a bit carried away with this. Possibly over-engineered the situation with OptionParser but it doesn't add any more dependencies (yay stdlib) and it does do a bunch of things I'd expect from a CLI. Including:

It also allows you to pass a password to be tested directly from calling the executable:

$ pwned password
Pwned!
The password has been found in public breaches 3645804 times.

Or you can pass the -s or --secret flag and type in the password without it being seen:

$ pwned --secret
Password: 
Pwned!
The password has been found in public breaches 3645804 times.