Exemplo n.º 1
0
    def command_show(self, *args, **kwargs):
        info, options = 'info', 'options'
        sub_command = args[0]
        if sub_command == info:
            utils.pprint_dict_in_order(
                ("name", "description", "targets", "authors", "references"),
                self.module_metadata,
            )
            utils.print_info()
        elif sub_command == options:
            target_opts = {'port', 'target'}
            module_opts = set(self.current_module.options) - target_opts
            headers = ("Name", "Current settings", "Description")

            utils.print_info('\nTarget options:')
            utils.print_table(headers, *self.get_opts(*target_opts))

            if module_opts:
                utils.print_info('\nModule options:')
                utils.print_table(headers, *self.get_opts(*module_opts))

            utils.print_info()
        else:
            print(
                "Unknown command 'show {}'. You want to 'show {}' or 'show {}'?"
                .format(sub_command, info, options))
Exemplo n.º 2
0
    def command_show(self, *args, **kwargs):
        info, options, devices = 'info', 'options', 'devices'
        sub_command = args[0]
        if sub_command == info:
            utils.pprint_dict_in_order(
                self.module_metadata,
                ("name", "description", "devices", "authors", "references"),
            )
            utils.print_info()
        elif sub_command == options:
            target_opts = {'port', 'target'}
            module_opts = set(self.current_module.options) - target_opts
            headers = ("Name", "Current settings", "Description")

            utils.print_info('\nTarget options:')
            utils.print_table(headers, *self.get_opts(*target_opts))

            if module_opts:
                utils.print_info('\nModule options:')
                utils.print_table(headers, *self.get_opts(*module_opts))

            utils.print_info()
        elif sub_command == devices:
            if devices in self.current_module._Exploit__info__.keys():
                devices = self.current_module._Exploit__info__['devices']

                print("\nTarget devices:")
                i = 0
                for device in devices:
                    if isinstance(device, dict):
                        print("   {} - {}".format(i, device['name']))
                    else:
                        print("   {} - {}".format(i, device))
                    i += 1
                print()
            else:
                print("\nTarget devices are not defined")
        else:
            print(
                "Unknown command 'show {}'. You want to 'show {}' or 'show {}'?"
                .format(sub_command, info, options))
Exemplo n.º 3
0
    def command_show(self, *args, **kwargs):
        info, options, devices = 'info', 'options', 'devices'
        sub_command = args[0]
        if sub_command == info:
            utils.pprint_dict_in_order(
                self.module_metadata,
                ("name", "description", "devices", "authors", "references"),
            )
            utils.print_info()
        elif sub_command == options:
            target_opts = {'port', 'target'}
            module_opts = set(self.current_module.options) - target_opts
            headers = ("Name", "Current settings", "Description")

            utils.print_info('\nTarget options:')
            utils.print_table(headers, *self.get_opts(*target_opts))

            if module_opts:
                utils.print_info('\nModule options:')
                utils.print_table(headers, *self.get_opts(*module_opts))

            utils.print_info()
        elif sub_command == devices:
            if devices in self.current_module._Exploit__info__.keys():
                devices = self.current_module._Exploit__info__['devices']

                print("\nTarget devices:")
                i = 0
                for device in devices:
                    if isinstance(device, dict): 
                        print("   {} - {}".format(i, device['name']))
                    else:
                        print("   {} - {}".format(i, device))
                    i += 1
                print()
            else:
                print("\nTarget devices are not defined")
        else:
            print("Unknown command 'show {}'. You want to 'show {}' or 'show {}'?".format(sub_command, info, options))
Exemplo n.º 4
0
    def command_show(self, *args, **kwargs):
        info, options = 'info', 'options'
        sub_command = args[0]
        if sub_command == info:
            utils.pprint_dict_in_order(
                self.module_metadata,
                ("name", "description", "devices", "authors", "references"),
            )
            utils.print_info()
        elif sub_command == options:
            target_opts = {'port', 'target'}
            module_opts = set(self.current_module.options) - target_opts
            headers = ("Name", "Current settings", "Description")

            utils.print_info('\nTarget options:')
            utils.print_table(headers, *self.get_opts(*target_opts))

            if module_opts:
                utils.print_info('\nModule options:')
                utils.print_table(headers, *self.get_opts(*module_opts))

            utils.print_info()
        else:
            print("Unknown command 'show {}'. You want to 'show {}' or 'show {}'?".format(sub_command, info, options))
Exemplo n.º 5
0
 def _show_info(self, *args, **kwargs):
     utils.pprint_dict_in_order(
         self.module_metadata,
         ("name", "description", "devices", "authors", "references"),
     )
     utils.print_info()
Exemplo n.º 6
0
 def _show_info(self, *args, **kwargs):
     utils.pprint_dict_in_order(
         self.module_metadata,
         ("name", "description", "devices", "authors", "references"),
     )
     utils.print_info()
Exemplo n.º 7
0
 def show_info(self, args):
     utils.pprint_dict_in_order(
             self.module_metadata,
             ("name", "description", "targets", "authors", "references"),
         )