Commit 0ad33dc2 by fwkz

Introducing unsetg command

parent 4ef9e2f5
from __future__ import print_function from __future__ import print_function
import os import os
import sys import sys
import itertools
import traceback import traceback
import atexit import atexit
...@@ -316,6 +317,27 @@ class RoutersploitInterpreter(BaseInterpreter): ...@@ -316,6 +317,27 @@ class RoutersploitInterpreter(BaseInterpreter):
return self.complete_set(text, *args, **kwargs) return self.complete_set(text, *args, **kwargs)
@utils.module_required @utils.module_required
def command_unsetg(self, *args, **kwargs):
key, _, value = args[0].partition(' ')
if key in self.current_module.options:
try:
del GLOBAL_OPTS[key]
except KeyError:
utils.print_error("There is no such option set!")
else:
utils.print_success({key: value})
else:
utils.print_error("You can't unset global option '{}'.\n"
"Available global options: {}".format(key, GLOBAL_OPTS.keys()))
@utils.stop_after(2)
def complete_unsetg(self, text, *args, **kwargs):
if text:
return [' '.join((attr, "")) for attr in GLOBAL_OPTS.keys() if attr.startswith(text)]
else:
return GLOBAL_OPTS.keys()
@utils.module_required
def get_opts(self, *args): def get_opts(self, *args):
""" Generator returning module's Option attributes (option_name, option_value, option_description) """ Generator returning module's Option attributes (option_name, option_value, option_description)
......
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