Ejemplo n.º 1
0
def run_hash_verification(hash_to_verify, hash_ver_file=None):
    """ Pointer to run the Hash Verification system"""
    if hash_ver_file is not None and hash_to_verify is None:
        try:
            total = len(open(hash_ver_file).readlines())
            LOGGER.info("Found a total of {} hashes in file..".format(total))
        except IOError:
            LOGGER.critical(
                "That file does not exist, check path and try again.")

        with open(hash_ver_file, "r+") as hashes:
            for h in hashes.readlines():
                question = prompt("Attempt to verify '{}'[y/N]: ".format(
                    h.strip()))
                if question.startswith("y"):
                    LOGGER.info("Analyzing hash: '{}'".format(h.strip()))
                    HashChecker(h.strip()).obtain_hash_type()
                    print("\n")
                else:
                    LOGGER.warning("Skipping '{}'..".format(h.strip()))
    else:
        LOGGER.info("Analyzing hash: '{}'".format(hash_to_verify))
        HashChecker(hash_to_verify).obtain_hash_type()
Ejemplo n.º 2
0
    try:
        integrity_check()
    except HTTPError:
        check_fail = "Integrity check failed to connect "
        check_fail += "you are running a non verified "
        check_fail += "Pybelt, this may or may not be insecure. "
        check_fail += "Suggestion would be to re-download Pybelt from "
        check_fail += "{}"
        LOGGER.error(check_fail.format(CLONE_LINK))
        answer = prompt("Would you like to continue anyways[y/N] ")
        if answer.upper().startswith("Y"):
            pass
        else:
            err_msg = "Please download the latest version from "
            err_msg += "{}"
            LOGGER.critical(err_msg.format(CLONE_LINK))

    try:
        if len(sys.argv) == 1:  # If you failed to provide an argument
            prompt = pybelt_shell.PybeltConsole()  # Launch the shell
            prompt.prompt = "{}@pybelt > ".format(getpass.getuser())
            info_message = "You have failed to provide a flag so you have been "
            info_message += "redirected to the Pybelt Console. For available "
            info_message += "flags type: 'run -hh', to see help type: 'help' "
            info_message += "to exit the console type: 'quit'"
            try:
                prompt.cmdloop(LOGGER.info(info_message))
            except TypeError as e:
                LOGGER.info("Terminating session...")
                exit(0)