By default http server listens port 9090.
If using GET commands have to be seperated by comma symbol i.e. ls,-al,|,grep,Dockerfile
If using POST format:
{"command" : "ls -al | grep Dockerfile"}go build -o run run.godocker build --tag webshell .docker run -it --rm -p 9090:9090 --name webshell webshell- GET
- Shell command output:
curl -XGET <localhost>:9090/cat,run.py- Python3 script execution
curl -XGET <localhost>:9090/python3,run.py- Python3 direct command execution
curl -XGET <localhost>:9090/python3,-c,\'print\(\"foo\"\)\'- POST
- Shell command output:
curl -XPOST <localhost>:9090/ -d '{"command" : "cat run.py"}'- Python3 script execution
curl -XPOST <localhost>:9090/ -d '{"command" : "python3 run.py"}'- Python3 direct command execution
curl -XPOST <localhost>:9090/ -d '{"command":"python3 -c \"print(\\\"foo\\\")\" "}'