A Python client for interacting with the Have I Been Pwned (HIBP) API. This script allows you to check if an email address has been involved in any data breaches, determine if a password has been pwned, retrieve details of specific breaches, and more.
Features
- Check Email Breaches: Identify whether an email address has been compromised in any known data breaches.
- Check Password Pwned: Determine if a password has been exposed in any known data breaches using the k-Anonymity model.
- List All Breaches: Retrieve a list of all known breaches from the HIBP API.
- Get Breach Details: Fetch detailed information about a specific breach by its name.
- Check Subscription Status: Get the current subscription status of the API key.
- Python 3.x
- A Have I Been Pwned API key. You can obtain one from here.
- A
.env
file with your HIBP API key.
-
Clone the repository into your User Directory:
cd ~ git clone https://github.com/j4m1n-t/hibp-api.git cd hibp-api
-
Create a virtual environment (optional but recommended):
python3 -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Set up your
.env
file:Create a
.env
file in the root directory with the following content:HIBP_API_KEY=your_hibp_api_key
-
Modify the
.env
location inhibp-api.py
if necessary. By default, it is set to:dotenv_path = os.path.expanduser("~/hibp-api/.env")
Run the script with various arguments to perform different actions:
python hibp-api.py --email example@example.com
python hibp-api.py --password yourpassword123
python hibp-api.py --email example@example.com --password yourpassword123
python hibp-api.py --all-breaches
python hibp-api.py --breach-details BreachName
python hibp-api.py --subscription-status
python hibp-api.py --email example@example.com --truncate
Argument | Description |
---|---|
--email |
The email address to check for breaches. |
--password |
The password to check if it has been pwned. |
--all-breaches |
List all breaches. |
--breach-details |
Get details of a specific breach by name. |
--subscription-status |
Get the current subscription status. |
--truncate |
Truncate the response when checking breaches (default: True). |
python hibp-api.py --email john.doe@example.com --password mysecurepassword
python hibp-api.py --all-breaches
python hibp-api.py --breach-details LinkedIn
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or issues, please contact Jamin Thompson at j.thompson@j4m1n.me.