Skip to content
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

2.5.1 #66

Merged
merged 4 commits into from
Apr 24, 2020
Merged
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
50 changes: 38 additions & 12 deletions h8mail/utils/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def get_emailrepio(self, api_key=""):

if response.status_code == 429:
c.info_news(
"[warning] emailrep.io: Unauthenticated API requests limit reached. Get a free API key here: https://bit.ly/3b1e7Pw"
"[warning] Is your emailrep key working? Get a free API key here: https://bit.ly/3b1e7Pw"
)
elif response.status_code == 404:
c.info_news(
Expand All @@ -320,14 +320,15 @@ def get_emailrepio(self, api_key=""):
data = response.json()

self.data.append(
(
"EMAILREP_INFO",
"Reputation: {rep} | Deliverable: {deli}".format(
rep=data["reputation"].capitalize(), deli=data["details"]["deliverable"]
)
)
(
"EMAILREP_INFO",
"Reputation: {rep} | Deliverable: {deli}".format(
rep=data["reputation"].capitalize(),
deli=data["details"]["deliverable"],
),
)

)

if data["details"]["credentials_leaked"] is True:
self.pwned += int(data["references"]) # or inc num references
if data["references"] == 1:
Expand All @@ -352,11 +353,25 @@ def get_emailrepio(self, api_key=""):
if len(data["details"]["profiles"]) != 0:
for profile in data["details"]["profiles"]:
self.data.append(("EMAILREP_SOCIAL", profile.capitalize()))
c.good_news("Found social profils")
c.good_news(
"Found {num} social profiles linked to {target} using emailrep.io".format(
num=len(data["details"]["profiles"]), target=self.target
)
)
if "never" in data["details"]["last_seen"]:
return
self.data.append(("EMAILREP_1ST_SN", data["details"]["first_seen"]))
c.good_news(
"{target} was first seen on the {data}".format(
data=data["details"]["first_seen"], target=self.target
)
)
self.data.append(("EMAILREP_LASTSN", data["details"]["last_seen"]))
c.good_news(
"{target} was last seen on the {data}".format(
data=data["details"]["last_seen"], target=self.target
)
)
else:
c.bad_news(
"emailrep.io: got API response code {code} for {target}".format(
Expand Down Expand Up @@ -389,8 +404,15 @@ def get_scylla(self, user_query="email"):
url = "https://scylla.sh/search?q={}".format(
requests.utils.requote_uri(uri_scylla)
)
response = self.make_request(url, verify=False)

# https://github.com/khast3x/h8mail/issues/64
response = self.make_request(
url,
verify=False,
auth=requests.auth.HTTPBasicAuth("sammy", "BasicPassword!"),
)
self.headers.popitem()

if response.status_code not in [200, 404]:
c.bad_news("Could not contact scylla.sh for " + self.target)
print(response.status_code)
Expand All @@ -403,7 +425,7 @@ def get_scylla(self, user_query="email"):
if k is not None:
total += 1
c.good_news(
"Found {num} entries for {target} using Scylla.sh ".format(
"Found {num} entries for {target} using scylla.sh ".format(
num=total, target=self.target
)
)
Expand Down Expand Up @@ -742,6 +764,11 @@ def get_weleakinfo_pub(self, api_key):

def get_dehashed(self, api_email, api_key, user_query):
try:
# New Dehashed API needs fixing, waiting for devs to respond
c.bad_news("Dehashed is temporarily unavailable")
c.bad_news("This should be fixed in the next updated\n")
return

if user_query == "hash":
user_query == "hashed_password"
if user_query == "ip":
Expand Down Expand Up @@ -823,4 +850,3 @@ def get_dehashed(self, api_email, api_key, user_query):
except Exception as ex:
c.bad_news("Dehashed error with {target}".format(target=self.target))
print(ex)

8 changes: 5 additions & 3 deletions h8mail/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def print_banner(b_type="intro"):
print(
"\t",
c.fg.lightgrey,
"Version " + __version__ + ' - "ROCKSROCKSMASSON" ',
"Version " + __version__ + ' - "ROCKSMASSON.1" ',
c.reset,
)

Expand Down Expand Up @@ -191,14 +191,16 @@ def check_scylla_online():
Checks if scylla.sh is online
"""
# Supress SSL Warning on UI
# https://github.com/khast3x/h8mail/issues/64
try:
requests.packages.urllib3.disable_warnings()
re = requests.head(
url="https://scylla.sh", verify=False
url="https://scylla.sh", verify=False, auth=requests.auth.HTTPBasicAuth("sammy", "BasicPassword!")
)
if re.status_code == 200:
c.good_news("scylla.sh is up")
return True
else:
c.info_news("scylla.sh is down, skipping")
return False
except Exception:
c.info_news("scylla.sh is down, skipping")
21 changes: 14 additions & 7 deletions h8mail/utils/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ def target_factory(targets, user_args):
skip_default_queries = False
if user_args.user_query is not None:
query = user_args.user_query
skip_default_queries = True # ??
skip_default_queries = True # custom query skips default query automatically

scylla_up = False
if user_args.skip_defaults is False:
scylla_up = check_scylla_online()



for counter, t in enumerate(targets):
c.info_news("Target factory started for {target}".format(target=t))
if user_args.debug:
Expand All @@ -64,12 +66,13 @@ def target_factory(targets, user_args):
if not skip_default_queries:
if not user_args.skip_defaults:
current_target.get_hunterio_public()
if api_keys is None or "emailrep" not in api_keys:
current_target.get_emailrepio()
elif (
api_keys is not None and "emailrep" in api_keys and query == "email"
):
current_target.get_emailrepio(api_keys["emailrep"])
## emailrep seems to insta-block h8mail user agent without a key
# if api_keys is None or "emailrep" not in api_keys:
# current_target.get_emailrepio()
# elif (
# api_keys is not None and "emailrep" in api_keys and query == "email"
# ):
# current_target.get_emailrepio(api_keys["emailrep"])

if scylla_up:
current_target.get_scylla(query)
Expand Down Expand Up @@ -133,6 +136,10 @@ def h8mail(user_args):

start_time = time.time()

import warnings

warnings.filterwarnings('ignore', message='Unverified HTTPS request')

targets = []
if user_args.user_urls:
targets = target_urls(user_args)
Expand Down
2 changes: 1 addition & 1 deletion h8mail/utils/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def fetch_urls(target):

def get_urls_from_file(targets_file):
"""
For each line in file, check for URLs using fetch_urls()(todo).
For each line in file, check for URLs using fetch_urls().
Returns list of URLs.
"""
email_obj_list = []
Expand Down
2 changes: 1 addition & 1 deletion h8mail/utils/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.5"
__version__ = "2.5.1"