GPT SSH

GPT SSH · GPT アクション

Remote Command Execution API

API for executing commands on a remote server and retrieving their output.

  • GET /ssh/connectConnect to remote server
  • GET /ssh/execExecute a command on the server
  • GET /ssh/statusCheck server status, and if any current operation is running
元の API スキーマ
{
  "openapi": "3.0.0",
  "info": {
    "title": "Remote Command Execution API",
    "version": "1.0.0",
    "description": "API for executing commands on a remote server and retrieving their output."
  },
  "servers": [
    {
      "url": "https://ssh.bulkninja.com"
    }
  ],
  "paths": {
    "/ssh/connect": {
      "get": {
        "summary": "Connect to remote server",
        "operationId": "connect",
        "parameters": [
          {
            "name": "host",
            "in": "query",
            "description": "server hostname to connect to",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "username",
            "in": "query",
            "description": "username to use for connection",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "port",
            "in": "query",
            "description": "ssh port to connect",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Server status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/ssh/exec": {
      "get": {
        "summary": "Execute a command on the server",
        "operationId": "executeCommand",
        "parameters": [
          {
            "name": "stdin",
            "in": "query",
            "description": "The command to be executed on the server",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Command executed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "stdout": {
                      "type": "string",
                      "description": "The standard output of the executed command"
                    },
                    "stderr": {
                      "type": "string",
                      "description": "The standard error output of the executed command"
                    },
                    "error": {
                      "type": "string",
                      "description": "Error message in case of error"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/ssh/status": {
      "get": {
        "summary": "Check server status, and if any current operation is running",
        "operationId": "status",
        "parameters": [
          {
            "name": "sleep",
            "in": "query",
            "description": "The nb of ms to sleep",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Server status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ready": {
                      "type": "boolean",
                      "description": "Indicates if the server is ready"
                    },
                    "currentOperation": {
                      "type": "string",
                      "description": "The description of the current operation"
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "lastOperation": {
                          "type": "object",
                          "description": "Information about the last completed command",
                          "properties": {
                            "error": {
                              "type": "string",
                              "description": "Error message in case of error"
                            },
                            "stdin": {
                              "type": "string",
                              "description": "The standard input of the executed command"
                            },
                            "stdout": {
                              "type": "string",
                              "description": "The standard output of the executed command"
                            },
                            "stderr": {
                              "type": "string",
                              "description": "The standard error output of the executed command"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}