Giter Site home page Giter Site logo

plasticuproject / hibpwned Goto Github PK

View Code? Open in Web Editor NEW
34.0 2.0 7.0 107 KB

Python API wrapper for haveibeenpwned.com (API v3)

License: GNU Lesser General Public License v3.0

Python 100.00%
python api wrapper haveibeenpwned hibp binding breach security infosec api-v3

hibpwned's Introduction

build Python 3.8 License: LGPL v3 PyPI version Downloads Coverage Status CodeQL Quality Gate Status Security Rating

hibpwned

A friendly, low-level, fully functional, Python API wrapper for haveibeenpwned.com
All data sourced from https://haveibeenpwned.com
Visit https://haveibeenpwned.com/API/v3 to read the Acceptable Use Policy
for rules regarding acceptable usage of this API.

Installation

pip install hibpwned

Making calls to the HIBP API requires a key. You can purchase an HIBP-API-Key at
https://haveibeenpwned.com/API/Key

Usage

This module contains the class Pwned with functions:

search_all_breaches
all_breaches
single_breach
data_classes
search_pastes
search_password
search_hashes

All functions return a list of JSON objects containing relevent data, with the exception
of search_password and search_hashes, which returns an integer and a string object,
respectively.

See module DocStrings for function descriptions and parameters

Examples

import hibpwned

my_app = hibpwned.Pwned("[email protected]", "My_App", "My_API_Key")

my_breaches = my_app.search_all_breaches()
breaches = my_app.all_breaches()
adobe = my_app.single_breach("adobe")
data = my_app.data_classes()
my_pastes = my_app.search_pastes()
password = my_app.search_password("BadPassword")
my_hashes = my_app.search_hashes("21BD1")

hibpwned's People

Contributors

dependabot[bot] avatar plasticuproject avatar th0mcat avatar vken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hibpwned's Issues

Forbidden: No user agent has been specified in the request

I'm using this snippet to get breaches (copied from the README):

import hibpwned
myApp = hibpwned.Pwned('[email protected]', 'My_App')
myBreaches = myApp.searchAllBreaches()

It doesn't work. Even if I try manually accessing the API using the browser (url https://haveibeenpwned.com/api/v2/breachedaccount/test%40example.com) I get a 403 HTTP error.

I also tried this, but it does not work:

import requests
import urllib
headers = {'User-Agent': 'My_App'}
url = "https://haveibeenpwned.com/api/v2/breachedaccount/%s" % urllib.parse.quote("[email protected]")
response = requests.get(url, headers=headers)
json = response.json()

Is it my internet that has some problems or has the API changed its requirements?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.