epinna/weevely3

onecmd doesn't work without full session

theguly opened this issue · 1 comments

running weevely in the "onecmd" mode as per https://github.com/epinna/weevely3/blob/master/weevely.py#L59 doesn't run anything if the session has not been established beforehands.

i guess the self.default() called at

return self.default(line)
after no do_ or do_alias_ commands are found doesn't support an session with empty default_shell

to reproduce:

  • clean up all sessions: rm -rf ~/.weevely/sessions
  • add a webshell to a remote target
  • run a single command: weevely.py http://127.0.0.1/weevely.php password "ls"
  • observe that no output is returned

now force a shell_sh:

  • run a single command: weevely.py http://127.0.0.1/weevely.php password "shell_sh ls"
  • observe that shell_sh is executed and returns expected output

open a session and run a single command: