{
    "$meta": {
        "description": "A `shell` object can be acquired by either using [get_shell](#GENERAL_GET_SHELL), [connect_service](#SHELL_CONNECT_SERVICE) or [overflow](#META_LIB_OVERFLOW). The `classID` used for this object is `\"shell\"`. In case you want to use [connect_service](#SHELL_CONNECT_SERVICE) to connect to a SSH port it will be usually at port `22`."
    },
    "host_computer": {
        "description": "Returns a `computer` related to the `shell`.",
        "example": [
            "shell = get_shell",
            "computer = shell.host_computer",
            "print(\"Computer public IP is: \" + computer.public_ip)"
        ]
    },
    "start_terminal": {
        "description": "Launches an active terminal. The terminal's color will change, displaying the IP of the connected shell. Script execution will be stopped upon starting a new terminal, unless this is called from another script that was executed via `shell.launch`. In that case, you will enter the shell after closing your root-level script within that terminal window. Using this method within an SSH encryption process will cause an error to be thrown, preventing further script execution.",
        "example": [
            "shell = get_shell",
            "shell.start_terminal"
        ]
    },
    "build": {
        "description": "Compiles a plain code file provided in the arguments to a binary. On success, the new binary will be available under the provided build folder. The binary name will be the same as the source file just without the file extension. Optionally, an allowImport flag can be set which enables the use of `import_code` on the binary. All provided paths must be absolute. Returns an empty string on success. On failure, it will return a string containing details about the reason for failure. In case any provided values deviate from the defined signature a runtime exception will be thrown.",
        "example": [
            "shell = get_shell",
            "computer = shell.host_computer",
            "computer.touch(home_dir, \"test.src\")",
            "computer.File(home_dir + \"/test.src\").set_content(\"print(\"\"hello world\"\")\")",
            "buildResult = shell.build(home_dir + \"/test.src\", home_dir + \"/Desktop\")",
            "if buildResult != \"\" then",
            "   print(\"There was an error while compiling: \" + buildResult)",
            "else",
            "   print(\"File has been compiled.\")",
            "end if"
        ]
    },
    "connect_service": {
        "description": "Returns a `shell` if the connection attempt to the provided IP was successful. This method can only connect to ports running an SSH or FTP service. SSH services usually run on port 22 and FTP services usually on port 21. Keep in mind to pass the right service value depending on which service is going to be used. By default, it will use SSH as the service. Please note that connecting will leave a log entry. In case of failure, a string is returned containing details. If any provided arguments deviate from the method signature, if this method is run in an SSH encryption process, or if the computer is not connected to the internet, a runtime exception will be thrown.",
        "example": [
            "shell = get_shell",
            "connectionResult = shell.connect_service(\"1.1.1.1\", 22, \"test\", \"test\")",
            "if typeof(connectionResult) != \"shell\" then",
            "   print(\"There was an error while connecting: \" + connectionResult)",
            "else",
            "   print(\"Connected!\")",
            "end if"
        ]
    },
    "launch": {
        "description": "Launches the binary located at the provided path. Optionally, parameters can be passed. Returns a `number`. If the launch was successful, the value will be one; otherwise, it will be zero. In some cases, a `string` will be returned containing an error message. If you need to share variables between a launched script and the current process, consider using `get_custom_object`. Note that launching a script is not asynchronous, meaning that the current script will pause its execution until the launched script finishes. If any provided values deviate from the method signature or it is used within an SSH encryption process, a runtime exception will be thrown. There is a cooldown of 2 seconds between launches to prevent abuse. If you attempt to launch a script during this cooldown period, the method will return zero.",
        "example": [
            "shell = get_shell(\"root\", \"test\")",
            "shell.launch(\"/bin/cat\", \"/etc/passwd\")"
        ]
    },
    "ping": {
        "description": "Returns a `number`. If the remote address could be reached the value will be one, zero otherwise. Firewalls do not block ping requests. Passing an invalid ip will cause the method to return a `string` with an error message. If any provided arguments deviate from the method signature a runtime exception will be thrown.",
        "example": [
            "shell = get_shell",
            "isPingable = shell.ping(\"1.1.1.1\")",
            "if isPingable then",
            "   print(\"Ping was successful!\")",
            "else",
            "   print(\"Ping failed!\")",
            "end if"
        ]
    },
    "scp": {
        "description": "Send a `file` to the `computer` related to the provided `shell`. You require permission to read the `file` on the `computer` from which you are uploading and write permissions in the folder of the `computer` you are trying to upload to. Via the optional isUpload parameter you can define the direction. In case of failure, this method will return a `string` with the cause. Otherwise, a `number` with the value one gets returned. If any of the passed arguments deviates from the types of the method signature, `null` will be returned. In case the `string` for sourceFile or destinationFolder is empty, an error will be thrown, preventing further script execution. Utilizing this method in an SSH encryption process will trigger an error, halting further script execution.",
        "example": [
            "shell = get_shell",
            "remoteShell = shell.connect_service(\"1.1.1.1\", 22, \"test\", \"test\")",
            "result = remoteShell.scp(\"/bin/ls\", \"/etc/\", shell)",
            "if typeof(result) == \"string\" then",
            "   print(\"There was an error while sending file: \" + result)",
            "else",
            "   print(\"File got sent successfully.\")",
            "end if"
        ]
    }
}
