diff --git a/routersploit/interpreter.py b/routersploit/interpreter.py index 7a7f032..f39f701 100644 --- a/routersploit/interpreter.py +++ b/routersploit/interpreter.py @@ -3,7 +3,6 @@ import os import sys import traceback import atexit -from subprocess import call from routersploit.exceptions import RoutersploitException from routersploit import utils @@ -384,8 +383,7 @@ class RoutersploitInterpreter(BaseInterpreter): print("\n", self.module_help) def command_exec(self, *args, **kwargs): - print(' '.join(args)) - call(' '.join(args)) + os.system(args[0]) def command_exit(self, *args, **kwargs): raise KeyboardInterrupt diff --git a/routersploit/test/test_interpreter.py b/routersploit/test/test_interpreter.py index 47c366a..2664a1a 100644 --- a/routersploit/test/test_interpreter.py +++ b/routersploit/test/test_interpreter.py @@ -434,5 +434,10 @@ class RoutersploitInterpreterTest(RoutersploitTestCase): with self.assertRaises(KeyboardInterrupt): self.interpreter.command_exit() + @mock.patch('os.system') + def test_command_exec(self, mock_system): + self.interpreter.command_exec("foo -bar") + mock_system.assert_called_once_with("foo -bar") + if __name__ == '__main__': unittest.main()