コード例 #1
0
 def setUp(self):
     IcssploitInterpreter.setup = mock.Mock()
     self.interpreter = IcssploitInterpreter()
     self.interpreter.current_module = mock.MagicMock()
     self.raw_prompt_default = "\001\033[4m\002isf\001\033[0m\002 > "
     self.module_prompt_default = lambda x: "\001\033[4m\002isf\001\033[0m\002 (\001\033[91m\002{}\001\033[0m\002) > ".format(x)
     GLOBAL_OPTS.clear()
コード例 #2
0
 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()
コード例 #3
0
ファイル: interpreter.py プロジェクト: tijldeneut/icssploit
 def command_unsetg(self, *args, **kwargs):
     key, _, value = args[0].partition(' ')
     try:
         del GLOBAL_OPTS[key]
     except KeyError:
         utils.print_error("You can't unset global option '{}'.\n"
                           "Available global options: {}".format(key, GLOBAL_OPTS.keys()))
     else:
         utils.print_success({key: value})
コード例 #4
0
 def setUp(self):
     self.exploit_foo = TestExploitFoo()
     self.exploit_bar = TestExploitBar()
     self.exploit_with_validators = TestExploitWithValidators()
     GLOBAL_OPTS.clear()
コード例 #5
0
 def test_command_unsetg(self, mock_print_success):
     GLOBAL_OPTS['foo'] = 'bar'
     self.interpreter.command_unsetg('foo')
     self.assertNotIn('foo', GLOBAL_OPTS.keys())
     mock_print_success.assert_called_once_with({'foo': ''})