How to query the ‘Have I been pwned?’ service from command line?
Pretty simple, with a node.js application
Have I Been Pwned? is a website created by security expert Troy Hunt, that allows internet users to check if their personal data has been compromised by data breaches.
The site collects and analyzes dozens of data leaks containing information about leaked accounts, and allows users to search for their own information by entering their username or email address.
Why build the site?
This site serves two primary purposes for me: firstly, it obviously provides a service to the public. Data breaches are rampant and many people don’t appreciate the scale or frequency with which they occur.
Secondly, the site provided me with an excellent use case for putting a number of technologies through their paces and keeping my hands-on skills somewhat current.
Can i access this service from command line or from a script?
Yes! The GitHub user wKovacs64 has developed a useful node.js script for querying ‘Have I been pwned?’ from the command line:
Usage: pwned [option | command]
ba [options] <account> get all breaches for an account (username or email address)
breaches [options] get all breaches in the system
breach [options] <name> get a single breached site by breach name
dc [options] get all data classes in the system
pa [options] <email> get all pastes for an account (email address)
Each command has its own -h (--help) option.
-h, --help output usage information
-v, --version output the version number
The installation is pretty simple, just use npm:
npm install pwned -g
Now, if you want to check your account for all breaches, simple use this command:
$ pwned ba firstname.lastname@example.org
- Email addresses
- Geographic locations
- Professional skills
- Years of professional experience
Ok, I have been pwned! :-)
For more information and usage examples please check the official website: