Hack Forums
[Python] HaveIBeenPwned Mass checker - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] HaveIBeenPwned Mass checker (/showthread.php?tid=5837718)



HaveIBeenPwned Mass checker - LSDoom - May 17, 2018

Code
from lxml import html
import time
import requests

file = open("emails.txt").readlines()


for line in file:
    newline = line.replace("\n","")
    page = requests.get('https://haveibeenpwned.com/account/' + newline)
    tree = html.fromstring(page.content)

    data = tree.xpath('//div[@class="pwnedSearchResult pwnedWebsite panel-collapse in"]/@id')
    data_2 = tree.xpath('//p[@class="dataClasses"]/text()')
    merged = list(zip(data, data_2))

    if not merged:
        print("[-]No breach info found on user: " + newline)
    else:
        print("\nUsername/Email: " +  newline + "\n")
        for item in merged:
            print("[+]Breach FOUND: " + item[0].upper() + "\n" + item[1] + "\n")
    time.sleep(1)


Just edit emails.txt to whatever input file you want to use. Each line of the file should contain a username or an email.

This is by no means a perfect program, but it should be able to check lists of usernames/emails.


output looks like this:

Code
Username/Email: [email protected]

[+]Breach FOUND: EXPLOITIN
Email addresses, Passwords

[+]Breach FOUND: XSPLIT
Email addresses, Names, Passwords, Usernames