Exemplo n.º 1
0
class HatSploitCommand(HatSploitCommand):
    config = config()
    local_storage = local_storage()

    history = config.path_config['base_paths']['history_path']
    storage_path = config.path_config['base_paths']['storage_path']

    global_storage = global_storage(storage_path)

    usage = ""
    usage += "history <option>\n\n"
    usage += "  -l, --list   List all history.\n"
    usage += "  -c, --clear  Clear all history.\n"
    usage += "  on/off       Turn history on/off.\n"

    details = {
        'Category': "developer",
        'Name': "history",
        'Description': "Manage HatSploit history.",
        'Usage': usage,
        'MinArgs': 1
    }

    def run(self, argc, argv):
        option = argv[0]
        if option == "on":
            self.local_storage.set("history", True)
            self.global_storage.set("history", True)
            self.badges.output_information("HatSploit history: on")
        elif option == "off":
            self.local_storage.set("history", False)
            self.global_storage.set("history", False)
            self.badges.output_information("HatSploit history: off")
        elif option in ['-c', '--clear']:
            readline.clear_history()
            with open(self.history, 'w') as history:
                history.write("")
        elif option in ['-l', '--list']:
            using_history = self.local_storage.get("history")
            if using_history:
                if readline.get_current_history_length() > 0:
                    self.badges.output_information("HatSploit history:")

                    history_file = open(self.history, 'r')
                    history = [x.strip() for x in history_file.readlines()]
                    history_file.close()
                    for line in history:
                        self.badges.output_empty("    * " + line)

                    for index in range(1,
                                       readline.get_current_history_length()):
                        self.badges.output_empty(
                            "    * " + readline.get_history_item(index))
                else:
                    self.badges.output_warning("HatSploit history empty.")
            else:
                self.badges.output_warning("No history detected.")
        else:
            self.badges.output_usage(self.details['Usage'])
Exemplo n.º 2
0
    def __init__(self):
        self.exceptions = exceptions()
        self.tables = tables()
        self.badges = badges()
        self.local_storage = local_storage()
        self.modules = modules()

        self.job_process = None
Exemplo n.º 3
0
    def __init__(self):
        self.db = db()
        self.badges = badges()
        self.local_storage = local_storage()
        self.config = config()
        self.modules = modules()
        self.exceptions = exceptions()

        self.tcp = tcp()
Exemplo n.º 4
0
class HatSploitCommand(HatSploitCommand):
    local_storage = local_storage()
    modules = modules()
    jobs = jobs()

    details = {
        'Category': "module",
        'Name': "run",
        'Description': "Run current module.",
        'Usage': "run [-h|-j]",
        'MinArgs': 0
    }

    def entry_to_module(self, argc, argv, current_module):
        if argc > 0:
            if argv[0] == "-j":
                self.badges.output_process(
                    "Running module as a background job...")
                job_id = self.jobs.create_job(current_module.details['Name'],
                                              current_module.details['Module'],
                                              current_module.run)
                self.badges.output_information(
                    "Module started as a background job " + str(job_id) + ".")
                return
        current_module.run()

    def run(self, argc, argv):
        if argc > 0:
            if argv[0] == "-h":
                self.badges.output_usage(self.details['Usage'])
                return

        if self.modules.check_current_module():
            current_module = self.modules.get_current_module_object()
            count = 0
            if hasattr(current_module, "options"):
                for option in current_module.options.keys():
                    current_option = current_module.options[option]
                    if not current_option['Value'] and current_option[
                            'Value'] != 0 and current_option['Required']:
                        count += 1
                if count > 0:
                    self.badges.output_error("Missed some required options!")
                else:
                    try:
                        self.entry_to_module(argc, argv, current_module)
                    except Exception as e:
                        self.badges.output_error(
                            "An error occurred in module: " + str(e) + "!")
            else:
                try:
                    self.entry_to_module(argc, argv, current_module)
                except Exception as e:
                    self.badges.output_error("An error occurred in module: " +
                                             str(e) + "!")
        else:
            self.badges.output_warning("No module selected.")
Exemplo n.º 5
0
    def __init__(self):
        self.sessions = sessions()
        self.local_storage = local_storage()
        self.badges = badges()

        self.tcp = tcp()
        self.http = http()

        self.servers = dict()
Exemplo n.º 6
0
class HatSploitCommand(HatSploitCommand):
    plugins = plugins()
    local_storage = local_storage()
    importer = importer()

    details = {
        'Category': "plugin",
        'Name': "load",
        'Description': "Load specified plugin.",
        'Usage': "load <plugin>",
        'MinArgs': 1
    }

    def import_plugin(self, database, plugin):
        loaded_plugins = dict()
        plugins = self.local_storage.get("plugins")[database][plugin]
        try:
            loaded_plugins[plugin] = self.importer.import_plugin(plugins['Path'])
        except Exception:
            return None
        return loaded_plugins
        
    def add_plugin(self, database, plugin):
        plugins = self.local_storage.get("plugins")[database][plugin]
        not_installed = list()
        for dependence in plugins['Dependencies']:
            if not self.importer.import_check(dependence):
                not_installed.append(dependence)
        if not not_installed:
            plugin_object = self.import_plugin(database, plugin)
            if plugin_object:
                if self.local_storage.get("loaded_plugins"):
                    self.local_storage.update("loaded_plugins", plugin_object)
                else:
                    self.local_storage.set("loaded_plugins", plugin_object)
                self.local_storage.get("loaded_plugins")[plugin].run()
                self.badges.output_success("Successfully loaded " + plugin + " plugin!")
            else:
                self.badges.output_error("Failed to load plugin!")
        else:
            self.badges.output_error("Plugin depends this dependencies which is not installed:")
            for dependence in not_installed:
                self.badges.output_empty("    * " + dependence)
        
    def run(self, argc, argv):
        plugin = argv[0]
        self.badges.output_process("Loading " + plugin + " plugin...")
        
        if not self.plugins.check_loaded(plugin):
            if self.plugins.check_exist(plugin):
                database = self.plugins.get_database(plugin)
                self.add_plugin(database, plugin)
            else:
                self.badges.output_error("Invalid plugin!")
        else:
            self.badges.output_error("Already loaded!")
Exemplo n.º 7
0
 def __init__(self):
     self.badges = badges()
     self.local_storage = local_storage()
     
     self.base_path = '/opt/hsf/'
     self.config_path = self.base_path + 'config/'
     
     self.db_config_file = self.config_path + 'db_config.yml'
     self.path_config_file = self.config_path + 'path_config.yml'
     self.core_config_file = self.config_path + 'core_config.yml'
     
     self.db_config = self.local_storage.get("db_config")
     self.path_config = self.local_storage.get("path_config")
     self.core_config = self.local_storage.get("core_config")
Exemplo n.º 8
0
class HatSploitCommand(HatSploitCommand):
    db = db()
    local_storage = local_storage()

    usage = ""
    usage += "modules_db <option> [arguments]\n\n"
    usage += "  -l, --list                   List all connected modules databases.\n"
    usage += "  -d, --disconnect <name>      Disconnect specified modules database.\n"
    usage += "  -c, --connect <name> <path>  Connect new modules database.\n"

    details = {
        'Category': "database",
        'Name': "modules_db",
        'Description': "Manage modules databases.",
        'Usage': usage,
        'MinArgs': 1
    }

    def run(self, argc, argv):
        choice = argv[0]
        if choice in ['-l', '--list']:
            if self.local_storage.get("connected_modules_databases"):
                databases_data = list()
                number = 0
                headers = ("Number", "Name", "Path")
                databases = self.local_storage.get(
                    "connected_modules_databases")
                for name in databases.keys():
                    databases_data.append(
                        (number, name, databases[name]['path']))
                    number += 1
                self.badges.output_empty("")
                self.tables.print_table("Connected Modules Databases", headers,
                                        *databases_data)
                self.badges.output_empty("")
            else:
                self.badges.output_warning("No modules database connected.")
        elif choice in ['-d', '--disconnect']:
            if argc < 2:
                self.badges.output_usage(self.details['Usage'])
            else:
                self.db.disconnect_modules_database(argv[1])
        elif choice in ['-c', '--connect']:
            if argc < 3:
                self.badges.output_usage(self.details['Usage'])
            else:
                self.db.connect_modules_database(argv[1], argv[2])
        else:
            self.badges.output_usage(self.details['Usage'])
Exemplo n.º 9
0
    def __init__(self):
        self.io = io()
        self.tip = tip()
        self.jobs = jobs()
        self.execute = execute()
        self.loader = loader()
        self.config = config()
        self.badges = badges()
        self.banner = banner()
        self.colors = colors()
        self.local_storage = local_storage()
        self.modules = modules()
        self.exceptions = exceptions()

        self.history = self.config.path_config['base_paths']['history_path']
Exemplo n.º 10
0
class HatSploitCommand(HatSploitCommand):
    modules = modules()
    local_storage = local_storage()

    details = {
        'Category': "module",
        'Name': "back",
        'Description': "Return to the previous module.",
        'Usage': "back",
        'MinArgs': 0
    }

    def run(self, argc, argv):
        if self.modules.check_current_module():
            self.local_storage.set(
                "current_module_number",
                self.local_storage.get("current_module_number") - 1)
            self.local_storage.set(
                "current_module",
                self.local_storage.get("current_module")[0:-1])
            if not self.local_storage.get("current_module"):
                self.local_storage.set("current_module_number", 0)
Exemplo n.º 11
0
class HatSploitCommand(HatSploitCommand):
    jobs = jobs()
    local_storage = local_storage()

    usage = ""
    usage += "jobs <option> [arguments]\n\n"
    usage += "  -l, --list           List all active jobs.\n"
    usage += "  -k, --kill <job_id>  Kill specified job.\n"

    details = {
        'Category': "jobs",
        'Name': "jobs",
        'Description': "Manage active jobs.",
        'Usage': usage,
        'MinArgs': 1
    }

    def run(self, argc, argv):
        choice = argv[0]
        if choice in ['-l', '--list']:
            if self.local_storage.get("jobs"):
                jobs_data = list()
                headers = ("ID", "Name", "Module")
                jobs = self.local_storage.get("jobs")
                for job_id in jobs.keys():
                    jobs_data.append((job_id, jobs[job_id]['job_name'],
                                      jobs[job_id]['module_name']))
                self.badges.output_empty("")
                self.tables.print_table("Active Jobs", headers, *jobs_data)
                self.badges.output_empty("")
            else:
                self.badges.output_warning("No running jobs available.")
        elif choice in ['-k', '--kill']:
            if argc < 2:
                self.badges.output_usage(self.details['Usage'])
            else:
                self.jobs.delete_job(argv[1])
        else:
            self.badges.output_usage(self.details['Usage'])
Exemplo n.º 12
0
class HatSploitCommand(HatSploitCommand):
    local_storage = local_storage()
    plugins = plugins()

    details = {
        'Category': "plugin",
        'Name': "unload",
        'Description': "Unload specified loaded plugin.",
        'Usage': "unload <plugin>",
        'MinArgs': 1
    }

    def run(self, argc, argv):
        plugin = argv[0]
        self.badges.output_process("Unloading " + plugin + " plugin...")

        if self.plugins.check_loaded(plugin):
            self.local_storage.delete_element("loaded_plugins", plugin)
            self.badges.output_success("Successfully unloaded " + plugin +
                                       " plugin!")
        else:
            self.badges.output_error("Plugin not loaded!")
Exemplo n.º 13
0
class HatSploitCommand(HatSploitCommand):
    config = config()
        
    storage_path = config.path_config['base_paths']['storage_path']
        
    local_storage = local_storage()
    global_storage = global_storage(storage_path)
    
    usage = ""
    usage += "storage [global|local] <option> [arguments]\n\n"
    usage += "  -l, --list                List all storage variables.\n"
    usage += "  -v, --value <name>        Show specified storage variable value.\n"
    usage += "  -s, --set <name> <value>  Set storage veriable value.\n"
    usage += "  -d, --delete <name>       Delete storage variable.\n"

    details = {
        'Category': "developer",
        'Name': "storage",
        'Description': "Manage storage variables.",
        'Usage': usage,
        'MinArgs': 2
    }

    def run(self, argc, argv):
        type_of_storage = argv[0]
        if type_of_storage == "global":
            choice = argv[1]
            if choice in ['-l', '--list']:
                self.badges.output_information("Global storage variables:")
                for variable in self.global_storage.get_all():
                    if not str.startswith(variable, '__') and not str.endswith(variable, '__'):
                        self.badges.output_empty("    * " + variable)
            elif choice in ['-v', '--value']:
                if argc < 3:
                    self.badges.output_usage(self.details['Usage'])
                else:
                    if argv[2] in self.global_storage.get_all():
                        self.badges.output_information(argv[2] + " = " + str(
                            self.global_storage.get(argv[2])))
            elif choice in ['-s', '--set']:
                if argc < 4:
                    self.badges.output_usage(self.details['Usage'])
                else:
                    self.global_storage.set(argv[2], argv[3])
            elif choice in ['-d', '--delete']:
                if argc < 3:
                    self.badges.output_usage(self.details['Usage'])
                else:
                    if argv[2] in self.global_storage.get_all():
                        self.global_storage.delete(argv[2])
                    else:
                        self.badges.output_error("Invalid storage variable name!")
            else:
                self.badges.output_usage(self.details['Usage'])
        elif type_of_storage == "local":
            choice = argv[1]
            if choice in ['-l', '--list']:
                self.badges.output_information("Local storage variables:")
                for variable in self.local_storage.get_all():
                    if not str.startswith(variable, '__') and not str.endswith(variable, '__'):
                        self.badges.output_empty("    * " + variable)
            elif choice in ['-v', '--value']:
                if argc < 3:
                    self.badges.output_usage(self.details['Usage'])
                else:
                    if argv[2] in self.local_storage.get_all():
                        self.badges.output_information(argv[2] + " = " + str(
                            self.local_storage.get(argv[2])))
                    else:
                        self.badges.output_error("Invalid storage variable name!")
            elif choice in ['-s', '--set']:
                if argc < 4:
                    self.badges.output_usage(self.details['Usage'])
                else:
                    self.local_storage.set(argv[2], argv[3])
            elif choice in ['-d', '--delete']:
                if argc < 3:
                    self.badges.output_usage(self.details['Usage'])
                else:
                    if argv[2] in self.local_storage.get_all():
                        self.local_storage.delete(argv[2])
                    else:
                        self.badges.output_error("Invalid storage variable name!")
            else:
                self.badges.output_usage(self.details['Usage'])
        else:
            self.badges.output_usage(self.details['Usage'])
Exemplo n.º 14
0
class HatSploitCommand(HatSploitCommand):
    importer = importer()
    local_storage = local_storage()
    modules = modules()

    details = {
        'Category': "module",
        'Name': "use",
        'Description': "Use specified module.",
        'Usage': "use <module>",
        'MinArgs': 1
    }

    def import_module(self, category, platform, name):
        modules = self.modules.get_module_object(category, platform, name)
        try:
            module_object = self.importer.import_module(modules['Path'])
            if not self.local_storage.get("imported_modules"):
                self.local_storage.set("imported_modules", dict())
            self.local_storage.update(
                "imported_modules", {
                    self.modules.get_full_name(category, platform, name):
                    module_object
                })
        except Exception:
            return None
        return module_object

    def add_module(self, category, platform, name):
        modules = self.modules.get_module_object(category, platform, name)

        not_installed = list()
        for dependence in modules['Dependencies']:
            if not self.importer.import_check(dependence):
                not_installed.append(dependence)
        if not not_installed:
            imported_modules = self.local_storage.get("imported_modules")
            full_name = self.modules.get_full_name(category, platform, name)

            if self.modules.check_imported(full_name):
                module_object = imported_modules[full_name]
                self.add_to_global(module_object)
            else:
                module_object = self.import_module(category, platform, name)
                if module_object:
                    self.add_to_global(module_object)
                else:
                    self.badges.output_error(
                        "Failed to select module from database!")
        else:
            self.badges.output_error(
                "Module depends this dependencies which is not installed:")
            for dependence in not_installed:
                self.badges.output_empty("    * " + dependence)

    def add_to_global(self, module_object):
        if self.modules.check_current_module():
            self.local_storage.add_array("current_module", '')
            self.local_storage.set(
                "current_module_number",
                self.local_storage.get("current_module_number") + 1)
            self.local_storage.set_array(
                "current_module",
                self.local_storage.get("current_module_number"), module_object)
        else:
            self.local_storage.set("current_module", [])
            self.local_storage.set("current_module_number", 0)
            self.local_storage.add_array("current_module", '')
            self.local_storage.set_array(
                "current_module",
                self.local_storage.get("current_module_number"), module_object)

    def check_if_already_used(self, module):
        if self.modules.check_current_module():
            if module == self.modules.get_current_module_name():
                return True
        return False

    def run(self, argc, argv):
        module = argv[0]

        category = self.modules.get_category(module)
        platform = self.modules.get_platform(module)
        name = self.modules.get_name(module)

        if not self.check_if_already_used(module):
            if self.modules.check_exist(module):
                self.add_module(category, platform, name)
            else:
                self.badges.output_error("Invalid module!")
Exemplo n.º 15
0
    def __init__(self):
        self.badges = badges()
        self.local_storage = local_storage()

        self.pseudo_shell = pseudo_shell()
Exemplo n.º 16
0
 def __init__(self):
     self.badges = badges()
     self.local_storage = local_storage()
Exemplo n.º 17
0
class HatSploitCommand(HatSploitCommand):
    local_storage = local_storage()
    modules = modules()

    details = {
        'Category': "core",
        'Name': "show",
        'Description': "Show specified information.",
        'Usage': "show <information>",
        'MinArgs': 1
    }

    def show_plugins(self):
        plugins = self.local_storage.get("plugins")
        plugins_data = list()
        number = 0
        headers = ("Number", "Name", "Database", "Description")
        for database in plugins.keys():
            plugins = plugins[database]
            for plugin in sorted(plugins.keys()):
                plugins_data.append((number, plugin, database, plugins[plugin]['Description']))
                number += 1
        self.badges.output_empty("")
        self.tables.print_table("Plugins", headers, *plugins_data)
        self.badges.output_empty("")
        
    def show_modules(self, information):
        modules = self.local_storage.get("modules")
        modules_data = list()
        number = 0
        headers = ("Number", "Module", "Database", "Risk", "Description")
        for database in modules.keys():
            modules = modules[database][information]
            for platform in sorted(modules.keys()):
                for module in sorted(modules[platform].keys()):
                    full_name = self.modules.get_full_name(information, platform, module)
                    modules_data.append((number, full_name, database, modules[platform][module]['Risk'], modules[platform][module]['Description']))
                    number += 1
        self.badges.output_empty("")
        self.tables.print_table(information.title() + " Modules", headers, *modules_data)
        self.badges.output_empty("")
        
    def show_options(self):
        current_module = self.modules.get_current_module_object()
        options_data = list()
        headers = ("Option", "Value", "Required", "Description")
        options = current_module.options
        for option in sorted(options.keys()):
            value, required = options[option]['Value'], options[option]['Required']
            if required:
                required = "yes"
            else:
                required = "no"
            if not value and value != 0:
                value = ""
            options_data.append((option, value, required, options[option]['Description']))
        self.badges.output_empty("")
        self.tables.print_table("Module Options", headers, *options_data)
        self.badges.output_empty("")
        
    def print_usage(self, informations, plugins, options):
        if informations or plugins or options:
            usage = "Informations: "
            for information in informations:
                usage += information + ", "
            if plugins:
                usage += "plugins, "
            if options:
                usage += "options"
            else:
                usage = usage[:-2]
            self.badges.output_information(usage)
        else:
            self.badges.output_warning("No informations available!")

    def run(self, argc, argv):
        information = argv[0]
        
        if self.modules.check_current_module():
            current_module = self.modules.get_current_module_object()
        
            options = False
            if hasattr(current_module, "options"):
                options = True
        else:
            options = False
        
        modules = self.local_storage.get("modules")
        plugins = self.local_storage.get("plugins")
        
        informations = list()
        if modules:
            for database in sorted(modules.keys()):
                for category in sorted(modules[database].keys()):
                    informations.append(category)
        
        if plugins:
            if information == "plugins":
                self.show_plugins()
                return
        if options:
            if information == "options":
                self.show_options()
                return
        if information in informations:
            self.show_modules(information)
        else:
            self.print_usage(informations, plugins, options)
Exemplo n.º 18
0
 def __init__(self):
     self.colors = colors()
     self.local_storage = local_storage()
     self.fmt = fmt()
Exemplo n.º 19
0
class HatSploitCommand(HatSploitCommand):
    sessions = sessions()
    local_storage = local_storage()

    usage = ""
    usage += "sessions <option> [arguments]\n\n"
    usage += "  -l, --list [session_property]                   List all opened sessions\n"
    usage += "                                                  [for specified session property].\n"
    usage += "  -i, --interact <session_property> <session_id>  Interact with specified session.\n"
    usage += "  -p, --pseudo <session_property> <session_id>    Spawn Pseudo shell on specified session.\n"
    usage += "  -c, --close <session_property> <session_id>     Close specified session.\n"

    details = {
        'Category': "sessions",
        'Name': "sessions",
        'Description': "Manage opened sessions.",
        'Usage': usage,
        'MinArgs': 1
    }

    def run(self, argc, argv):
        if argv[0] in ['-l', '--list']:
            sessions = self.local_storage.get("sessions")
            if argc < 2:
                if sessions:
                    for session_property in sessions.keys():
                        sessions_data = list()
                        headers = ("ID", "Module", "Host", "Port")
                        for session_id in sessions[session_property].keys():
                            module = sessions[session_property][session_id][
                                'module']
                            host = sessions[session_property][session_id][
                                'host']
                            port = sessions[session_property][session_id][
                                'port']

                            sessions_data.append(
                                (session_id, module, host, port))
                        self.badges.output_empty("")
                        self.tables.print_table(
                            "Opened Sessions: " + session_property, headers,
                            *sessions_data)
                        self.badges.output_empty("")
                else:
                    self.badges.output_warning("No opened sessions available.")
            else:
                if argv[1] in sessions.keys():
                    session_property = argv[1]
                    sessions_data = list()
                    headers = ("ID", "Module", "Host", "Port")
                    for session_id in sessions[session_property].keys():
                        module = sessions[session_property][session_id][
                            'module']
                        host = sessions[session_property][session_id]['host']
                        port = sessions[session_property][session_id]['port']

                        sessions_data.append((session_id, module, host, port))
                    self.badges.output_empty("")
                    self.tables.print_table(
                        "Opened Sessions: " + session_property, headers,
                        *sessions_data)
                    self.badges.output_empty("")
                else:
                    self.badges.output_error("Invalid session property given!")
        elif argv[0] in ['-c', '--close']:
            if argc < 3:
                self.badges.output_usage(self.details['Usage'])
            else:
                self.sessions.close_session(argv[1], argv[2])
        elif argv[0] in ['-p', '--pseudo']:
            if argc < 3:
                self.badges.output_usage(self.details['Usage'])
            else:
                self.sessions.spawn_pseudo_shell(argv[1], argv[2])
        elif argv[0] in ['-i', '--interact']:
            if argc < 3:
                self.badges.output_usage(self.details['Usage'])
            else:
                self.sessions.spawn_interactive_connection(argv[1], argv[2])
        else:
            self.badges.output_usage(self.details['Usage'])
Exemplo n.º 20
0
 def __init__(self):
     self.fmt = fmt()
     self.badges = badges()
     self.local_storage = local_storage()
     self.modules = modules()
Exemplo n.º 21
0
class HatSploitCommand(HatSploitCommand):
    modules = modules()
    local_storage = local_storage()

    details = {
        'Category': "core",
        'Name': "help",
        'Description': "Show available commands.",
        'Usage': "help",
        'MinArgs': 0
    }

    def format_base_commands(self):
        commands_data = dict()
        headers = ("Command", "Description")
        commands = self.local_storage.get("commands")
        for command in sorted(commands.keys()):
            label = commands[command].details['Category']
            commands_data[label] = list()
        for command in sorted(commands.keys()):
            label = commands[command].details['Category']
            commands_data[label].append(
                (command, commands[command].details['Description']))
        self.badges.output_empty("")
        for label in sorted(commands_data.keys()):
            self.tables.print_table(label.title() + " Commands", headers,
                                    *commands_data[label])
            self.badges.output_empty("")

    def format_plugin_commands(self):
        for plugin in self.local_storage.get("loaded_plugins").keys():
            loaded_plugin = self.local_storage.get("loaded_plugins")[plugin]
            if hasattr(loaded_plugin, "commands"):
                commands_data = dict()
                headers = ("Command", "Description")
                commands = loaded_plugin.commands
                for label in sorted(commands.keys()):
                    commands_data[label] = list()
                    for command in sorted(commands[label].keys()):
                        commands_data[label].append(
                            (command, commands[label][command]['Description']))
                for label in sorted(commands_data.keys()):
                    self.tables.print_table(label.title() + " Commands",
                                            headers, *commands_data[label])
                    self.badges.output_empty("")

    def format_custom_commands(self):
        current_module = self.modules.get_current_module_object()
        if hasattr(current_module, "commands"):
            commands_data = list()
            headers = ("Command", "Description")
            commands = current_module.commands
            for command in sorted(commands.keys()):
                commands_data.append(
                    (command, commands[command]['Description']))
            self.tables.print_table("Custom Commands", headers, *commands_data)
            self.badges.output_empty("")

    def run(self, argc, argv):
        self.format_base_commands()
        if self.modules.check_current_module():
            self.format_custom_commands()
        if self.local_storage.get("loaded_plugins"):
            self.format_plugin_commands()
Exemplo n.º 22
0
 def __init__(self):
     self.badges = badges()
     self.importer = importer()
     self.local_storage = local_storage()
Exemplo n.º 23
0
 def __init__(self):
     self.local_storage = local_storage()