Skip to content

Add LeakCheck service #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@
| [scylla.so](https://scylla.so/) - Service (free) | Cleartext passwords, hashs and salts, usernames, IPs, domain | :construction: |
| [Dehashed.com](https://dehashed.com/) - Service | Cleartext passwords, hashs and salts, usernames, IPs, domain | :white_check_mark: :key: |
| [IntelX.io](https://intelx.io/signup) - Service (free trial) | Cleartext passwords, hashs and salts, usernames, IPs, domain, Bitcoin Wallets, IBAN | :white_check_mark: :key: |
| :new: [Breachdirectory.org](https://breachdirectory.org) - Service (free) | Cleartext passwords, hashs and salts, usernames, domain | :construction: :key: |
| [Breachdirectory.org](https://breachdirectory.org) - Service (free) | Cleartext passwords, hashs and salts, usernames, domain | :construction: :key: |
| :new: [LeakCheck.io](https://leakcheck.io/?from=h8mail) - Public | List of data breaches by e-mail or username and compromised fields | :white_check_mark: |
| :new: [LeakCheck.io](https://leakcheck.io/?from=h8mail) - Service | Cleartext passwords, e-mails, usernames, ZIPs, IPs, full names, phones, stealer logs | :white_check_mark: :key: |

*:key: - API key required*

Expand Down
80 changes: 80 additions & 0 deletions h8mail/utils/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import platform
from .version import __version__

LC_SUPPORTED = ['email', 'domain', 'keyword', 'username', 'phone', 'phash', 'origin', 'password']

class local_breach_target:
"""
Expand Down Expand Up @@ -750,6 +751,85 @@ def get_weleakinfo_pub(self, api_key):
)
print(ex)

def get_leakcheck_pub(self):
try:
c.info_news("[" + self.target + "]>[leakcheck public]")
url = "https://leakcheck.io/api/public?check={query}".format(
query=self.target
)
req = self.make_request(url, timeout=30)
response = req.json()
if req.status_code != 200:
c.bad_news(f"Got LC API response code {req.status_code} (public)")
return
else:
c.good_news(
"Found {num} entries for {target} using LeakCheck (public)".format(
num=response["found"], target=self.target
)
)
if response["success"] is False:
c.bad_news(response["error"])
return
self.data.append(("LC_PUB_TOTAL", response["found"]))
if response["found"] == 0:
return
for src in response["sources"]:
self.data.append(("LC_PUB_SOURCE", src['name'] + " (" + src['date'] + ")"))
self.pwned += 1
except Exception as ex:
c.bad_news(
f"LeakCheck error with {self.target} (public)"
)
print(ex)

def get_leakcheck_priv(self, api_key, user_query):
if user_query == 'hash': user_query = 'phash'

if user_query not in LC_SUPPORTED:
c.bad_news(
f"LeakCheck does not support {user_query} search (yet)"
)
return
try:
c.info_news("[" + self.target + "]>[leakcheck pro]")
url = "https://leakcheck.io/api/v2/query/{query}?type={user_query}".format(
query=self.target,
user_query=user_query
)
self.headers.update({"X-API-KEY": api_key})
req = self.make_request(url, timeout=30)
response = req.json()
if req.status_code != 200:
c.bad_news(f"Got LC API response code {req.status_code} - {response.get('error')} (Pro)")
return
else:
c.good_news(
"Found {num} entries for {target} using LeakCheck (Pro)".format(
num=response["found"], target=self.target
)
)
self.data.append(("LC_PRIV_TOTAL", response["found"]))
if response["found"] == 0:
return
for result in response["result"]:
breach_name = result['source']['name'] or "N/A"
breach_date = result['source']['breach_date'] or "Unknown"
self.data.append(("LC_PRIV_SOURCE", breach_name + " (" + breach_date + ")"))
self.pwned += 1
result['fields'].remove(user_query)
for field in result['fields']:
field_name = field
if field == 'username': field_name = 'USER'
if field == 'password': field_name = 'PASS'

self.data.append(("LC_PRIV_" + field_name.upper(), result[field]))
except Exception as ex:
c.bad_news(
f"LeakCheck error with {self.target} (private)"
)
print(ex)

def get_dehashed(self, api_email, api_key, user_query):
try:
if user_query == "hash":
Expand Down
1 change: 1 addition & 0 deletions h8mail/utils/gen_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def gen_config_file():
;intelx_maxfile = 10
;breachdirectory_user =
;breachdirectory_pass =
;leakcheck_apikey =
"""
dest_config.write(config)
c.good_news(
Expand Down
2 changes: 2 additions & 0 deletions h8mail/utils/print_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def print_results(results, hide=False):
c.print_result(t.target, t.data[i][1], t.data[i][0])
if "WLI" in t.data[i][0]:
c.print_result(t.target, t.data[i][1], t.data[i][0])
if "LC" in t.data[i][0]:
c.print_result(t.target, t.data[i][1], t.data[i][0])
if "SCYLLA" in t.data[i][0]:
c.print_result(t.target, t.data[i][1], t.data[i][0])
if "DHASHD" in t.data[i][0]:
Expand Down
7 changes: 5 additions & 2 deletions h8mail/utils/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sys

from .breachcompilation import breachcomp_check
from .classes import target
from .classes import target, LC_SUPPORTED
from .colors import colors as c
from .helpers import (
fetch_emails,
Expand Down Expand Up @@ -64,6 +64,7 @@ def target_factory(targets, user_args):
current_target = target(t)
if not skip_default_queries:
if not user_args.skip_defaults:
current_target.get_leakcheck_pub()
current_target.get_hunterio_public()
## emailrep seems to insta-block h8mail user agent without a key
# if api_keys is None or "emailrep" not in api_keys:
Expand All @@ -83,6 +84,8 @@ def target_factory(targets, user_args):
)
if "hibp" in api_keys and query == "email":
current_target.get_hibp3(api_keys["hibp"])
if "leakcheck_apikey" in api_keys and query in LC_SUPPORTED:
current_target.get_leakcheck_priv(api_keys["leakcheck_apikey"], query)
if "emailrep" in api_keys and query == "email":
current_target.get_emailrepio(api_keys["emailrep"])
if "hunterio" in api_keys and query == "email":
Expand Down Expand Up @@ -284,7 +287,7 @@ def parse_args(args):
"-sk",
"--skip-defaults",
dest="skip_defaults",
help="Skips Scylla and HunterIO check. Ideal for local scans",
help="Skips Scylla, LeakCheck and HunterIO check. Ideal for local scans",
action="store_true",
default=False,
)
Expand Down