[python]Sample code to check if your email is pwned

This is a free website where you can check if your email address is exposed from some hacked website which you are registered to.

import requests
import sys

check_account_api = "https://haveibeenpwned.com/api/v2/pasteaccount/"
email = sys.argv[1]

    response = requests.get(check_account_api + email)
    result = response.json()[0]
    print(result["Id"] + "\n" +
          result["Source"] + "\n" +
          result["Title"] + "\n" +
          result["Date"] + "\n")

except BaseException as e:
    print("Page not found, http:" + str(response.status_code) + " " +
          "probably your email is not breached")

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s