How to use the h8mail.utils.colors.colors.good_news function in h8mail

To help you get started, we’ve selected a few h8mail examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github khast3x / h8mail / h8mail / utils / classes.py View on Github external
def get_hunterio_public(self):
        try:
            target_domain = self.target.split("@")[1]
            url = "https://api.hunter.io/v2/email-count?domain={}".format(target_domain)
            req = self.make_request(url)
            response = req.json()
            if response["data"]["total"] != 0:
                self.data.append(("HUNTER_PUB", response["data"]["total"]))
            c.good_news(
                "Found {num} related emails for {target} using hunter.io (public)".format(
                    num=response["data"]["total"], target=self.target
                )
            )
        except Exception as ex:
            c.bad_news("hunter.io (pubic API) error: " + self.target)
            print(ex)
github khast3x / h8mail / h8mail / utils / breachcompilation.py View on Github external
procfd = subprocess.run([query_bin, t.email], stdout=subprocess.PIPE)
            try:
                output = procfd.stdout.decode("cp437")
            except Exception as e:
                c.bad_news(f"Could not decode bytes for {t.email} results")
                output = procfd.stdout
                # print(output[:85], "[...]")
                print(output)
                continue
            if len(output) != 0:
                split_output = output.split("\n")
                for line in split_output:
                    if ":" in line:
                        t.pwned += 1
                        t.data.append(("BC_PASS", line.split(":")[1]))
                        c.good_news(
                            "Found BreachedCompilation entry {line}".format(line=line)
                        )
        return targets
    except Exception as e:
        c.bad_news("Breach compilation")
        print(e)
        return targets
github khast3x / h8mail / h8mail / utils / run.py View on Github external
def h8mail(user_args):
    """
    Handles most user arg logic. Creates a list() of targets from user input.
    Starts the target object factory loop; starts local searches after factory if in user inputs
    Prints results, saves to csv if in user inputs
    """
    if not user_args.user_targets:
        c.bad_news("Missing Target")
        exit(1)
    targets = []
    start_time = time.time()
    c.good_news("Targets:")

    # Find targets in user input or file
    for arg in user_args.user_targets:
        user_stdin_target = fetch_emails(arg, user_args)
        if user_stdin_target:
            targets.extend(user_stdin_target)
        elif os.path.isfile(arg):
            c.info_news("Reading from file " + arg)
            targets.extend(get_emails_from_file(arg, user_args))
        else:
            c.bad_news("No targets found in user input")
            exit(1)

    c.info_news("Removing duplicates")
    targets = list(set(targets))
github khast3x / h8mail / h8mail / utils / helpers.py View on Github external
def save_results_csv(dest_csv, target_obj_list):
    """
    Outputs CSV from target object list.
    Dumps the target.data object variable into CSV file.
    """
    with open(dest_csv, "w", newline="") as csvfile:
        try:
            writer = csv.writer(csvfile)

            writer.writerow(["Target", "Type", "Data"])
            c.good_news("Writing to CSV")
            for t in target_obj_list:
                for i in range(len(t.data)):
                    if len(t.data[i]) == 2:  # Contains data header + body
                        writer.writerow([t.target, t.data[i][0], t.data[i][1]])
        except Exception as ex:
            c.bad_news("Error writing to csv")
            print(ex)
github khast3x / h8mail / h8mail / utils / gen_config.py View on Github external
os.path.join(os.getcwd(), "h8mail_config.ini"), "w", newline=""
    ) as dest_config:
        config = """[h8mail]
; h8mail will automatically detect present keys & launch services accordingly
; Uncomment to activate
;hunterio = 
;snusbase_url = 
;snusbase_token = 
;weleakinfo_priv = 
;weleakinfo_pub = 
;hibp = 
;leak-lookup_pub = 1bf94ff907f68d511de9a610a6ff9263
;leak-lookup_priv =
"""
        dest_config.write(config)
        c.good_news(
            "Generated h8mail template configuration file ({})".format(
                os.path.join(os.getcwd(), "h8mail_config.ini")
            )
github khast3x / h8mail / h8mail / utils / chase.py View on Github external
def chase(target, user_args):
    """
    Takes the current target & returns adequate chase list
    to add to the current target list
    """
    new_targets = []
    chase_counter = 0
    if user_args.chase_limit:
        for d in target.data:
            if len(d) is not 2:
                continue
            if "HUNTER_RELATED" in d:
                c.good_news(
                    "Chasing {new_target} as new target".format(new_target=d[1])
                )
                new_targets.append(d[1])
                chase_counter += 1
            if chase_counter == user_args.chase_limit:
                return new_targets
    return new_targets
github khast3x / h8mail / h8mail / utils / localgzipsearch.py View on Github external
size = os.stat(file_to_parse).st_size
            c.info_news(
                "Searching for targets in {file_to_parse} ({size} bytes)".format(
                    file_to_parse=file_to_parse, size=size
                )
            )
            for cnt, line in enumerate(fp):
                progress_gzip(cnt)
                for t in target_list:
                    if t in str(line):
                        try:
                            decoded = str(line, "cp437")
                            found_list.append(
                                local_breach_target(t, file_to_parse, cnt, decoded)
                            )
                            c.good_news(
                                f"Found occurrence [{file_to_parse}] Line {cnt}: {decoded}"
                            )
                        except Exception as e:
                            c.bad_news(
                                f"Got a decoding error line {cnt} - file: {file_to_parse}"
                            )
                            c.good_news(
                                f"Found occurrence [{file_to_parse}] Line {cnt}: {line}"
                            )
                            found_list.append(
                                local_breach_target(t, file_to_parse, cnt, str(line))
                            )
    return found_list
github khast3x / h8mail / h8mail / utils / localsearch.py View on Github external
found_list = []
            size = os.stat(filepath).st_size
            c.info_news(
                "Worker [{PID}] is searching for targets in {filepath} ({size} bytes)".format(
                    PID=os.getpid(), filepath=filepath, size=size
                )
            )
            for cnt, line in enumerate(fp):
                for t in target_list:
                    if t in str(line):
                        try:
                            decoded = str(line, "cp437")
                            found_list.append(
                                local_breach_target(t, filepath, cnt, decoded)
                            )
                            c.good_news(
                                f"Found occurrence [{filepath}] Line {cnt}: {decoded}"
                            )
                        except Exception as e:
                            c.bad_news(
                                f"Got a decoding error line {cnt} - file: {filepath}"
                            )
                            c.good_news(
                                f"Found occurrence [{filepath}] Line {cnt}: {line}"
                            )
                            found_list.append(
                                local_breach_target(t, filepath, cnt, str(line))
                            )
        return found_list
    except Exception as e:
        c.bad_news("Something went wrong with worker")
        print(e)