Commit 1444f4f1 by fwkz

Differentiate CTRL+D and CTRL+C

parent 0a14e8bb
......@@ -83,10 +83,12 @@ class BaseInterpreter(object):
command_handler(args)
except RoutersploitException as err:
utils.print_error(err)
except (KeyboardInterrupt, EOFError):
except EOFError:
print()
utils.print_status("routersploit stopped")
break
except KeyboardInterrupt:
print()
def complete(self, text, state):
"""Return the next possible completion for 'text'.
......@@ -386,4 +388,4 @@ class RoutersploitInterpreter(BaseInterpreter):
os.system(args[0])
def command_exit(self, *args, **kwargs):
raise KeyboardInterrupt
raise EOFError
......@@ -152,8 +152,7 @@ class RoutersploitInterpreterTest(RoutersploitTestCase):
self.interpreter.current_module = None
self.assertEqual(self.raw_prompt_default, self.interpreter.prompt)
def test_custom_module_\
(self):
def test_custom_module_prompt(self):
self.prepare_prompt_env_variables(module_prompt="*{host}*{module} >>>")
module_name = "module_name"
self.interpreter.current_module._MagicMock__info__ = {'name': module_name}
......@@ -431,7 +430,7 @@ class RoutersploitInterpreterTest(RoutersploitTestCase):
)
def test_command_exit(self):
with self.assertRaises(KeyboardInterrupt):
with self.assertRaises(EOFError):
self.interpreter.command_exit()
@mock.patch('os.system')
......
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