onecmd doesn't work without full session
theguly opened this issue · 1 comments
theguly commented
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
Line 106 in 0bae932
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:
- weevely.py http://127.0.0.1/weevely.php password
- run any command to fix default_shell at session file: weevely> ls
- exit weevely> ctrl+c
- weevely.py http://127.0.0.1/weevely.php password "ls"
- observe that ls command now returns expected output