Commit 7318a775 by Marcin Bury

Adding new command show devices.

parent e0393dff
...@@ -331,7 +331,7 @@ class RoutersploitInterpreter(BaseInterpreter): ...@@ -331,7 +331,7 @@ class RoutersploitInterpreter(BaseInterpreter):
@utils.module_required @utils.module_required
def command_show(self, *args, **kwargs): def command_show(self, *args, **kwargs):
info, options = 'info', 'options' info, options, devices = 'info', 'options', 'devices'
sub_command = args[0] sub_command = args[0]
if sub_command == info: if sub_command == info:
utils.pprint_dict_in_order( utils.pprint_dict_in_order(
...@@ -352,12 +352,27 @@ class RoutersploitInterpreter(BaseInterpreter): ...@@ -352,12 +352,27 @@ class RoutersploitInterpreter(BaseInterpreter):
utils.print_table(headers, *self.get_opts(*module_opts)) utils.print_table(headers, *self.get_opts(*module_opts))
utils.print_info() 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: else:
print("Unknown command 'show {}'. You want to 'show {}' or 'show {}'?".format(sub_command, info, options)) print("Unknown command 'show {}'. You want to 'show {}' or 'show {}'?".format(sub_command, info, options))
@utils.stop_after(2) @utils.stop_after(2)
def complete_show(self, text, *args, **kwargs): def complete_show(self, text, *args, **kwargs):
sub_commands = ['info', 'options'] sub_commands = ['info', 'options', 'devices']
if text: if text:
return filter(lambda command: command.startswith(text), sub_commands) return filter(lambda command: command.startswith(text), sub_commands)
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment