weevely3
weevely3 copied to clipboard
onecmd doesn't work without full session
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 https://github.com/epinna/weevely3/blob/0bae932d5cb0e96370e1b76fbdb6ca84bd42c0ed/core/terminal.py#L106 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:
- 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