All Projects → DragonBe → Hibp

DragonBe / Hibp

Licence: mit
A composer package to verify if a password was previously used in a breach using Have I Been Pwned API.

Projects that are alternatives of or similar to Hibp

Passpwn
See if your passwords in pass has been breached.
Stars: ✭ 130 (+3.17%)
Mutual labels:  password, haveibeenpwned
keepassxc-pwned
Check your keepassxc database against previously breached haveibeenpwned passwords
Stars: ✭ 25 (-80.16%)
Mutual labels:  password, haveibeenpwned
H8mail
Email OSINT & Password breach hunting tool, locally or using premium services. Supports chasing down related email
Stars: ✭ 2,163 (+1616.67%)
Mutual labels:  password, haveibeenpwned
laravel-pwned-passwords
Simple Laravel validation rule that allows you to prevent or limit the re-use of passwords that are known to be pwned (unsafe). Based on TroyHunt's Have I Been Pwned (https://haveibeenpwned.com)
Stars: ✭ 67 (-46.83%)
Mutual labels:  password, haveibeenpwned
pass-audit
A pass extension for auditing your password repository.
Stars: ✭ 71 (-43.65%)
Mutual labels:  password, haveibeenpwned
Pwned
An easy, Ruby way to use the Pwned Passwords API.
Stars: ✭ 290 (+130.16%)
Mutual labels:  password, haveibeenpwned
Rooster
The simple password manager for geeks, built with Rust.
Stars: ✭ 106 (-15.87%)
Mutual labels:  password
Keepass4web
An application that serves KeePass database entries on a web frontend
Stars: ✭ 115 (-8.73%)
Mutual labels:  password
Codo Tools
CODO运维工具支持:告警管理、告警自愈、项目管理、事件管理、加密解密、随机密码、提醒管理等
Stars: ✭ 103 (-18.25%)
Mutual labels:  password
Wifipassword Stealer
Get All Registered Wifi Passwords from Target Computer.
Stars: ✭ 97 (-23.02%)
Mutual labels:  password
Password4j
Password4j is a user-friendly cryptographic library that supports Argon2, Bcrypt, Scrypt, PBKDF2 and various cryptographic hash functions.
Stars: ✭ 124 (-1.59%)
Mutual labels:  password
Gosecretsdump
Dump ntds.dit really fast
Stars: ✭ 122 (-3.17%)
Mutual labels:  password
Gitpass
Open Source Your Password (Mismanagement)!
Stars: ✭ 113 (-10.32%)
Mutual labels:  password
Dllpasswordfilterimplant
DLL Password Filter Implant with Exfiltration Capabilities
Stars: ✭ 107 (-15.08%)
Mutual labels:  password
Keeweb
Free cross-platform password manager compatible with KeePass
Stars: ✭ 10,587 (+8302.38%)
Mutual labels:  password
Fpass
FPASS · 密码安全管理工具
Stars: ✭ 106 (-15.87%)
Mutual labels:  password
Signify
OpenBSD tool to signs and verify signatures on files. Portable version.
Stars: ✭ 122 (-3.17%)
Mutual labels:  verify
Piracychecker
An Android library that prevents your app from being pirated / cracked using Google Play Licensing (LVL), APK signature protection and more. API 14+ required.
Stars: ✭ 1,359 (+978.57%)
Mutual labels:  verify
Android Complexify
An Android library which makes checking the quality of user's password a breeze.
Stars: ✭ 111 (-11.9%)
Mutual labels:  password
Lil Pwny
Fast, offline auditing of Active Directory passwords using Python.
Stars: ✭ 117 (-7.14%)
Mutual labels:  haveibeenpwned

PHP 7.2+ Packagist version Packagist daily downloads CircleCI status Infection MSI

Have I been pwned Composer package

To increase security of users on your system, I started building a client for @TroyHunt's Have I Been Pwned? API v2 that will check if a given password was already used in a breach. Many thanks to Mr. Troy Hunt for providing us this service.

Project scope

The goal of this project is to have a composer package that will allow you to quickly verify if a given password (from a registration or password reset form) was found in a data breach so you can inform your users to change their password and thus improving overal security.

This project was also the subject of my talk Mutation Testing with Infection where the code base was not only covered by unit tests, but also was subjected to Mutation Testing using Infection to ensure no coding mistakes could slip into the codebase.

Getting started

First of all you need to add this library to your project. The easiest way is to use Composer.

composer require dragonbe/hibp

If you want to quickly test the functionality, copy/paste the following code in a file named hibp.php.

<?php

require_once __DIR__ . '/vendor/autoload.php';

$hibp = \Dragonbe\Hibp\HibpFactory::create();
echo 'Password "password": ' . ($hibp->isPwnedPassword('password') ? 'Pwned' : 'OK') . PHP_EOL;
echo 'Password "NVt3MpvQ": ' . ($hibp->isPwnedPassword('NVt3MpvQ') ? 'Pwned' : 'OK') . PHP_EOL;

Now run this file to make sure all is working fine.

php hibp.php

If all works well, you should see the following result:

Password "password": Pwned
Password "NVt3MpvQ": OK

Getting number of hits found in HIBP

Sometimes you want to display a number of hits found for a given password. Just call count() on your $hibp instance or call $hibp->count() directly.

<?php

require_once __DIR__ . '/vendor/autoload.php';

$hibp = \Dragonbe\Hibp\HibpFactory::create();
$passwords = ['password', 'NVt3MpvQ'];
foreach ($passwords as $password) {
    $found = $hibp->isPwnedPassword($password);
    $count = count($hibp);

    echo sprintf(
        'Password "%s": %s',
        $password,
        $found ? ('Pwned (' . $count . ' times)') : 'OK'
    ) . PHP_EOL;
}

This will give you a more detailed view on how many times a password has been used that was found in breaches collected in Have I Been Pwned?.

Password "password": Pwned (3311463 times)
Password "NVt3MpvQ": OK

For more details please check out the unit test directory tests/ to understand what exceptions can occur and what other options there are to use this library.

Roadmap

Even though this is the beginning of the project, I want to make full use of HIBP API by searching on usernames and email addresses to see if they were discovered in breaches. This might be convenient to alert users that they might want to use a more secure password or change all their passwords for the provided credential.

In short, these are the goals I want to accomplish in the near future:

  • check for existence of credential (username/email address) in HIBP Sites
  • check for existence of credential (username/email address) in HIBP Pastes

And who knows, maybe when people are using this library more ideas will be provided

Acknowledgement

This library wasn't possible if Mr. Troy Hunt didn't spend his valuable time in feeding breached data in his database and providing his site haveibeenpwned.com. So thank you good sir for putting such great efforts in HIBP.

License

I've provided this project "as-is" and I licensed it with an MIT license so you can use it freely in your projects.

Questions, suggestions, feedback of issues

Please use this project's issue feature to reach out to me with your suggestions. I love your feedback and also interested in the use cases where you have used this library in.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].