diff options
author | maride <maride@darknebu.la> | 2018-09-11 11:40:21 +0200 |
---|---|---|
committer | maride <maride@darknebu.la> | 2018-09-11 11:40:21 +0200 |
commit | 0fb971d718deea61a8a498a360457c28f704d148 (patch) | |
tree | 01ea03859295ddc798e937902fba67e42d86ff8b | |
parent | 61dd0e66d0be7c94779f3ecf52eb12b23324df1a (diff) |
Update README with API endpoints
-rw-r--r-- | README.md | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/README.md b/README.md index bef50bc..7131b78 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,40 @@ The seed file should be of the following format: ] } ``` + +## API endpoints + +| Path | Method | Parameter | Description | +| - | - | - | - | +| `/` | GET | - | static hosting `/files/index.html` | +| `/files/{file}` | GET | - | static hosting `{file}`, from `hosted/` directory. *Path traversal*-safe | +| `/login` | GET | - | static hosting `/files/login.html` | +| `/login` | POST | `username`, `accesscode` | processing `username` and `accesscode`, giving the user a session if they are valid | +| `/logout` | GET | - | Invalidates the session | +| `/challenges` | GET | - | static hosting `/files/challenges.html` | +| `/access` | GET | - | static hosting `/files/access.html` | +| `/api/getChallenges` | GET | - | Returns all challenges, as JSON. For an example, see below. | +| `/api/submitFlag` | POST | `challengeName`, `flag` | Validates `flag` for `challengeName` | +| `/api/startContainer` | POST | `challengeName` | Starts the challenge container for `challengeName`, if it's not already started | +| `/api/stopContainer` | POST | `challengeName` | Stops the challenge container for `challengeName`, if it's running | +| `/api/getAccess` | GET | - | Returns | + +### Response: `/api/getChallenges` + +``` +{ + "categories": { + "Miscellaneous":1 // contains the amount of challenges in that category + }, + "challenges": [ + { + "name": "ChallengeName", + "description": "Some meaningful, interesting and funny description", + "category": "Miscellaneous", + "foundFlag": false, // whether the user found the flag + "ContainsLaunchable": true, // if set to true: there's a container which can be started/stopped + "IPAddress": "1.2.3.4" // contains the IP address if the container is running + } + ] +} +``` |