Skip to content

Commit 93ce14e

Browse files
docs: revamp documentation
1 parent fba60d4 commit 93ce14e

File tree

1 file changed

+51
-11
lines changed

1 file changed

+51
-11
lines changed

README.md

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,87 @@
44

55
The security playground is an HTTP web server to simulate security breaches. It allows you to read, write, and execute commands in a containerized environment.
66

7+
8+
## Build
9+
10+
```
11+
$ docker build -t sysdiglabs/security-playground:latest .
12+
```
13+
14+
715
## Installation
816

9-
Deploy the docker image in your environment.
17+
Deploy the docker image in your environment, and setup the probe health check to the `/health:8080` endpoint if required.
18+
19+
You can also run the image locally:
1020

1121
```bash
1222
$ docker run --rm -p 8080:8080 sysdiglabs/security-playground
1323
```
1424

15-
Setup the health check to the `/health` endpoint if required.
16-
1725

1826
## Usage
1927

20-
The HTTP API exposes tree endpoints to interact with the system.
28+
The application provides endpoints for:
29+
- [Health checks](#health-checks)
30+
- [Reading file](#reading-a-file)
31+
- [Writing file](#writing-a-file)
32+
- [Executing commands](#executing-a-command)
33+
34+
35+
### Health checks
36+
37+
The health check endpoint is `/health` on port `8080` and returns the `200` HTTP status code.
38+
2139

2240
### Reading a file
2341

24-
You can read a file using just the URL.
42+
You can retrieve a file's contents by sending a `GET` request to the application's URL.
43+
44+
```bash
45+
$ curl <URL>:8080/<PATH>
46+
```
47+
48+
For example:
2549

2650
```bash
2751
$ curl localhost:8080/etc/shadow
2852
```
2953

30-
This will return the content of the /etc/shadow file.
54+
This will return the content of the `/etc/shadow` file in the container running locally.
55+
56+
3157

3258
### Writing a file
3359

34-
You can write to a file using the URL and POSTing the content.
60+
You can write data to a file by sending a `POST` request to the application's URL with the desired content.
61+
62+
```bash
63+
$ curl -X POST <URL>:8080/<PATH> -d 'content=<CONTENT>'
64+
```
65+
66+
For example:
3567

3668
```bash
3769
$ curl -X POST localhost:8080/bin/hello -d 'content=hello-world'
3870
```
3971

40-
This will write to /bin/hello the hello-world string
72+
This command writes the string hello-world to /bin/hello.
73+
74+
4175

4276
### Executing a command
4377

44-
You can execute a command using the `/exec` endpoint and POSTing the command.
78+
To execute a command, send a `POST` request to the `/exec` endpoint with the command as the payload.
79+
80+
```bash
81+
$ curl -X POST <URL>:8080/exec -d 'command=<CMD>'
82+
```
83+
84+
For example:
4585

4686
```bash
47-
$ curl -X POST localhost:8080/exec -d 'command=ls -la'
87+
$ curl -X POST localhost:8080/exec -d 'command=ls'
4888
```
4989

50-
This will capture and return the STDOUT of the executed command.
90+
This will run the command and return its STDOUT output.

0 commit comments

Comments
 (0)