Exemplo n.º 1
0
def main():
    signal.signal(signal.SIGINT, signal_handler)
    signal.signal(signal.SIGTERM, signal_handler)
    banner.banner()

    LOCAL_COMMAND_FLAG = True

    CONTEXT = reset_context()
    while True:
        command = (input("[%s]=> " % (color.red(CONTEXT))) or "help")
        if command == "h" or command == "help" or command == "?":
            main_help()
        elif command == "version":
            Log.Log.info("Version: 0.0.1")
        elif command == "show":
            print("%s" % (color.purple("------\t\t------")))
            print("%s" % (color.purple("Vendor\t\tModule")))
            print("%s" % (color.purple("------\t\t------")))
            exploit_path = "./exploit/"
            vendors = os.listdir(exploit_path)
            for vendor in vendors:
                full_path = exploit_path + vendor
                if os.path.isdir(full_path):
                    # Log.Log.info("%s" % ("-" * 0x20))
                    # Log.Log.info("Vendor: %s" % (vendor))
                    exploit_files = os.listdir(full_path)
                    number = 0
                    for exploit_file in exploit_files:
                        if exploit_file.endswith(".py") and exploit_file != "__init__.py":
                            # Log.Log.info("%s => exploit.%s.%s" % (exploit_file, vendor, exploit_file.replace(".py", "")))
                            if len(vendor) > 8:
                                print("%s" % (color.cyan("%s\t%s" % (vendor, exploit_file.replace(".py", "")))))
                            else:
                                print("%s" % (color.cyan("%s\t\t%s" % (vendor, exploit_file.replace(".py", "")))))
                            number += 1
                    # Log.Log.info("%d exploits" % (number))
            print("%s" % (color.purple("---------")))
            print("%s" % (color.purple(" Example")))
            print("%s" % (color.purple("---------")))
            print("%s" % (color.cyan("use exploit.%s.%s" % (vendor, exploit_file.replace(".py", "")))))
        elif command.startswith("use "):
            module_name = command.split(" ")[1]
            Log.Log.info("Loading module: %s" % (module_name))
            try:
                module = importlib.import_module(module_name)
            except Exception as e:
                Log.Log.error(str(e))
                continue
            CONTEXT = module_name
            exploit = module.Exploit()
            exploit.show_info()
            Log.Log.info("%s" % ("-" * 0x40))
            exploit.show_options()
            while True:
                module_command = (input("[%s]=> " % (color.red(CONTEXT))) or "help")
                if module_command == "help":
                    main_help()
                    continue
                if module_command.startswith("set "):
                    if len(module_command.split(" ")) == 3:
                        key = module_command.split(" ")[1]
                        value = module_command.split(" ")[2]
                        exploit.set_config(key, value)
                    else:
                        Log.Log.error("Check your input!")
                        Log.Log.info("Example: \n\tset [KEY] [VALUE]")
                elif module_command == "options":
                    exploit.show_options()
                elif module_command == "info":
                    exploit.show_info()
                elif module_command == "exploit":
                    try:
                        exploit.exploit()
                    except Exception as e:
                        Log.Log.error(str(e))
                elif module_command == "quit" or module_command == "q" or module_command == "exit" or module_command == "back":
                    break
                else:
                    main_help()
            CONTEXT = reset_context()
        elif command == "q" or command == "quit" or command == "exit":
            Log.Log.info("Quiting...")
            break
        else:
            Log.Log.error("Unsupported function!")
            if LOCAL_COMMAND_FLAG == True:
                Log.Log.info("Executing command on localhost...")
                os.system(command)
Exemplo n.º 2
0
 def success(word):
     Log._print("[+] %s\n" % color.purple(word))