Skip to content

Latest commit

 

History

History
46 lines (46 loc) · 1.05 KB

README.md

File metadata and controls

46 lines (46 loc) · 1.05 KB

Simple Go-based webshell for Docker

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"}

Build Go binary

go build -o run run.go

Image build

docker build --tag webshell .

Docker image run

docker run -it --rm -p 9090:9090 --name webshell webshell

Usage

  1. 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\"\)\'
  1. 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\\\")\" "}'