This is a simple implementation for a command server. Don't use it for illegal actions.
gradle 7.1, jdk 11, screen, bash, curl
- Build
gradle build
- Run
./build/libs/command-server-1.0-SNAPSHOT.jar
- Open swagger ui: http://localhost:8889
curl -X 'GET' \
'http://localhost:8889/api/get-commands/123token123' \
-H 'accept: */*'
curl -X 'POST' \
'http://localhost:8889/api/send-command/123token123' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-d 'uname -a'
Important: run the
get-commands
method before thesend-command
method
Run command agent in background
screen -dmS command-agent ./command-agent.sh