-
Notifications
You must be signed in to change notification settings - Fork 3
/
swagger.json
1 lines (1 loc) · 7.69 KB
/
swagger.json
1
{"info": {"description": "Capture the flag system", "title": "CTF System", "version": "1.0.0"}, "openapi": "3.0.2", "servers": [{"url": "http://localhost:{port}/", "description": "The development API server", "variables": {"port": {"enum": ["5000", "80", "443"], "default": "5000"}}}], "paths": {"/api/team": {"post": {"description": "Create a new Team", "parameters": [{"in": "header", "name": "token", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "successful", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Team"}}}}, "404": {"description": "Invalid token"}, "400": {"description": "Invalid description"}, "500": {"description": "SQL error"}}, "security": [{"api_key": []}]}, "get": {"description": "Fetch all the teams", "responses": {"200": {"description": "successful", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Team"}}}}, "404": {"description": "Invalid token"}}, "security": [{"api_key": []}]}}, "/api/team/{team_id}": {"delete": {"parameters": [{"in": "path", "name": "team_id", "required": true, "schema": {"type": "integer", "format": "int32"}}, {"in": "header", "name": "token", "required": true, "schema": {"type": "string"}}], "description": "Delete the team", "responses": {"200": {"description": "successful", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Team"}}}}, "404": {"description": "Invalid token"}, "400": {"description": "Invalid team"}}, "security": [{"api_key": []}]}, "get": {"parameters": [{"in": "path", "name": "team_id", "required": true, "schema": {"type": "integer", "format": "int32"}}], "description": "Fetch the team information", "responses": {"200": {"description": "successful", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Team"}}}}, "400": {"description": "Invalid team"}}}}, "/api/get_sessions_public": {"get": {"description": "Fetch all the sessions", "responses": {"200": {"description": "successful", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Session"}}}}}}}, "/api/get_sessions": {"get": {"parameters": [{"in": "header", "name": "token", "required": true, "schema": {"type": "string"}}], "description": "Fetch all the sessions", "responses": {"200": {"description": "successful", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Session"}}}}, "404": {"description": "Invalid token"}}, "security": [{"api_key": []}]}}, "/api/bof_form/get_schema": {"get": {"description": "Fetch the admin form for creating BOF session", "responses": {"200": {"description": "successful", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Session"}}}}}}}, "/api/team_form/get_schema": {"get": {"description": "Fetch the admin form for creating the team", "responses": {"200": {"description": "successful", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Session"}}}}}}}, "/api/team/{team_id}/session": {"post": {"parameters": [{"in": "header", "name": "token", "required": true, "schema": {"type": "string"}}, {"in": "path", "name": "team_id", "required": true, "schema": {"type": "integer", "format": "int32"}}], "description": "Create a session", "responses": {"200": {"description": "successful", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Session"}}}}, "404": {"description": "Invalid token"}, "400": {"description": "Missing buffer_high or buffer_low or address_mask"}, "500": {"description": "error starting bof server - code 4 - Container error"}}, "security": [{"api_key": []}]}}, "/api/team/session/{session_id}": {"delete": {"parameters": [{"in": "header", "name": "token", "required": true, "schema": {"type": "string"}}, {"in": "path", "name": "session_id", "required": true, "schema": {"type": "integer", "format": "int32"}}], "description": "Delete the session", "responses": {"200": {"description": "successful", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Session"}}}}, "404": {"description": "Invalid token"}, "400": {"description": "Invalid session"}}, "security": [{"api_key": []}]}, "get": {"parameters": [{"in": "path", "name": "session_id", "required": true, "schema": {"type": "integer", "format": "int32"}}], "description": "Fetch the session", "responses": {"200": {"description": "successful", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SessionPublic"}}}}, "400": {"description": "Invalid session"}}}}, "/api/team/session/{session_id}/docker": {"get": {"parameters": [{"in": "header", "name": "token", "required": true, "schema": {"type": "string"}}, {"in": "path", "name": "session_id", "required": true, "schema": {"type": "integer", "format": "int32"}}], "description": "Restart docker container for the current session", "responses": {"200": {"description": "successful", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Session"}}}}, "404": {"description": "Invalid token"}, "400": {"description": "Invalid session"}}, "security": [{"api_key": []}]}}, "/api/team/session/{session_id}/flag": {"delete": {"parameters": [{"in": "path", "name": "session_id", "required": true, "schema": {"type": "integer", "format": "int32"}}], "description": "Clear the session flag", "responses": {"200": {"description": "successful", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SessionPublic"}}}}, "400": {"description": "Invalid session"}}}}, "/api/team/session/{session_id}/answer": {"get": {"parameters": [{"in": "header", "name": "token", "required": true, "schema": {"type": "string"}}, {"in": "path", "name": "session_id", "required": true, "schema": {"type": "integer", "format": "int32"}}], "description": "Fetch the session answer", "responses": {"200": {"description": "successful", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Session"}}}}, "404": {"description": "Invalid token"}, "400": {"description": "Invalid session"}}, "security": [{"api_key": []}]}}}, "components": {"schemas": {"Team": {"type": "object", "properties": {"id": {"type": "integer", "format": "int32", "readOnly": true}, "flag": {"type": "string"}, "description": {"type": "string"}, "name": {"type": "string"}}}, "Team1": {"type": "object", "properties": {"id": {"type": "integer", "format": "int32", "readOnly": true}, "name": {"type": "string"}}}, "Session": {"type": "object", "properties": {"team_id": {"type": "integer", "format": "int32", "readOnly": true}, "level": {"type": "integer", "format": "int32"}, "running": {"type": "boolean"}, "team": {"$ref": "#/components/schemas/Team1"}, "trials": {"type": "integer", "format": "int32"}, "container_id": {"type": "string"}, "ans": {"type": "string"}, "successes": {"type": "integer", "format": "int32"}, "hints": {"type": "string"}, "id": {"type": "integer", "format": "int32", "readOnly": true}, "error": {"type": "boolean"}, "status": {"type": "string"}, "secret": {"type": "string"}, "port": {"type": "integer", "format": "int32"}, "flag_url": {"type": "string"}, "flag_status": {"type": "boolean"}}}, "SessionPublic": {"type": "object", "properties": {"team_id": {"type": "integer", "format": "int32", "readOnly": true}, "level": {"type": "integer", "format": "int32"}, "running": {"type": "boolean"}, "team": {"$ref": "#/components/schemas/Team1"}, "trials": {"type": "integer", "format": "int32"}, "container_id": {"type": "string"}, "successes": {"type": "integer", "format": "int32"}, "hints": {"type": "string"}, "id": {"type": "integer", "format": "int32", "readOnly": true}, "error": {"type": "boolean"}, "status": {"type": "string"}, "port": {"type": "integer", "format": "int32"}, "flag_url": {"type": "string"}, "flag_status": {"type": "boolean"}}}}, "securitySchemes": {"token": {"type": "apiKey", "in": "header", "name": "token"}}}}