> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upio.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Plugin API

> Documentation for the Plugin API

The Plugin API is a set of functions & data that are available to plugins. It is used to interact with RocketCore and its features. This API is provided as the first argument to the `initialize` function.

<Warning>
  **WARNING** some documentation is incomplete or may be wrong as draco has not shown how to all the functions in the plugin api. However if you want to see and reverse engineer a part of the plugin api, the structure is provided [here](#plugin-api-structure)
</Warning>

# Node Modules Path

The Node Modules path is the path to the folder where the `node_modules` folder is located (RocketCore\resources\app.asar\node\_modules). Inside there are very useful modules that you can require in your plugin.

* `ws` - WebSocket
* `tcp-port-used` - Check if a port is in use (asynchronous)

Example:

```js theme={null}
const ws = require(PluginApi.NodeModulesPath + "/ws");
const tcpPortUsed = require(PluginApi.NodeModulesPath + "/tcp-port-used");

const isPortInUse = await tcpPortUsed.check(8080);
```

# Exploit API

The Exploit API is used to handle logic related to injection & execution of code into Roblox.

### Getting all registered exploits

You can access the current registered exploits via the `registeredExploits` property in the Exploit API.

<ResponseField name="PluginAPI.ExploitApi.registeredExploits" type="array">
  <Expandable title="registeredExploitProperties">
    <ResponseField name="name" type="string">
      The name of the exploit, will be used for the custom executor option in the settings tab. (**unfortunately executing still shows "SynapseZ" as not being injected while having another exploit selected**)
    </ResponseField>

    <ResponseField name="execute" type="function">
      This is the function that will be executed when the user presses the execute button while being injected.

      <Expandable title="arguments">
        <ResponseField name="script" type="string">
          This is the script that will be executed.
        </ResponseField>

        <ResponseField name="PID" type="number?">
          This is the PID of the roblox process where the script will be executed in. Can be `undefined` in some cases (i think).
        </ResponseField>

        Example:

        ```js theme={null}
        PluginAPI.ExploitApi.registeredExploits[0].execute("print('Hello World!')");
        ```
      </Expandable>
    </ResponseField>

    <ResponseField name="inject" type="function">
      The function that runs when the user presses the inject button. RocketCore should show a notification that the exploit is injected after the exploit has executed the Execution Server script.

      Example:

      ```js theme={null}
      PluginAPI.ExploitApi.registeredExploits[0].inject();
      ```
    </ResponseField>

    <ResponseField name="getDllName" type="function">
      This function should return the path (like C:\Users\Admin...) to the dll file. **The file does not actually need to exist.**

      Example:

      ```js theme={null}
      PluginAPI.ExploitApi.registeredExploits[0].getDllName();
      ```
    </ResponseField>
  </Expandable>
</ResponseField>

### Getting the current exploit

To get the current exploit, use the `currentExploit` property in the Exploit API.

<ResponseField name="PluginAPI.ExploitApi.currentExploit" type="object">
  <Expandable title="currentExploitProperties">
    <ResponseField name="name" type="string">
      The name of the exploit, will be used for the custom executor option in the settings tab. (**unfortunately executing still shows "SynapseZ" as not being injected while having another exploit selected**)
    </ResponseField>

    <ResponseField name="execute" type="function">
      This is the function that will be executed when the user presses the execute button while being injected.

      <Expandable title="arguments">
        <ResponseField name="script" type="string">
          This is the script that will be executed.
        </ResponseField>

        <ResponseField name="PID" type="number?">
          This is the PID of the roblox process where the script will be executed in. Can be `undefined` in some cases (i think).
        </ResponseField>

        Example:

        ```js theme={null}
        PluginAPI.ExploitApi.currentExploit.execute("print('Hello World!')");
        ```
      </Expandable>
    </ResponseField>

    <ResponseField name="inject" type="function">
      The function that runs when the user presses the inject button. RocketCore should show a notification that the exploit is injected after the exploit has executed the Execution Server script.

      Example:

      ```js theme={null}
      PluginAPI.ExploitApi.currentExploit.inject();
      ```
    </ResponseField>

    <ResponseField name="getDllName" type="function">
      This function should return the path (like C:\Users\Admin...) to the dll file. **The file does not actually need to exist.**

      Example:

      ```js theme={null}
      PluginAPI.ExploitApi.currentExploit.getDllName();
      ```
    </ResponseField>
  </Expandable>
</ResponseField>

### Registering a new custom exploit

Registering a custom exploit is done via the `registerExploit` function in the Exploit API.
Keep in mind that `execute`, `inject` & `getDllName` **can be asynchronous & synchronous**. (grh is scared of async real)

<ResponseField name="PluginAPI.ExploitApi.registerExploit" type="function">
  <Expandable title="exploitProperties">
    <ResponseField name="name" type="string" required>
      The name of the exploit, will be used for the custom executor option in the settings tab. (**unfortunately executing still shows "SynapseZ" as not being injected while having another exploit selected**)
    </ResponseField>

    <ResponseField name="execute" type="function" required>
      This is the function that will be executed when the user presses the execute button while being injected.

      <Expandable title="arguments">
        <ResponseField name="script" type="string">
          This is the script that will be executed.
        </ResponseField>

        <ResponseField name="PID" type="number?">
          This is the PID of the roblox process where the script will be executed in. Can be `undefined` in some cases (i think).
        </ResponseField>

        Example:

        ```js theme={null}
        PluginAPI.ExploitApi.registerExploit({
          name: "ExampleExploit",
          execute: function(script, pid) {
            // do something with the script
          }
        });
        ```
      </Expandable>
    </ResponseField>

    <ResponseField name="inject" type="function" required>
      The function that runs when the user presses the inject button. RocketCore should show a notification that the exploit is injected after the exploit has executed the Execution Server script.

      Example:

      ```js theme={null}
      PluginAPI.ExploitApi.registerExploit({
        name: "ExampleExploit",
        inject: function() {
          // do something with injection
        }
      });
      ```
    </ResponseField>

    <ResponseField name="getDllName" type="function" required>
      This function should return the path (like C:\Users\Admin...) to the dll file. **The file does not actually need to exist.**

      Example:

      ```js theme={null}
      PluginAPI.ExploitApi.registerExploit({
        name: "ExampleExploit",
        getDllName: function() {
          // the dll does not have to exist.
          return "LoremIpsum.dll";
        }
      });
      ```
    </ResponseField>
  </Expandable>
</ResponseField>

# Notification API

The Notification API is used to send notifications to the user.

### Sending Notifications

Sending Notifications can be acheived via the `send` function in the Notification API.

<ResponseField name="PluginAPI.NotificationApi.send" type="function">
  <Expandable title="properties">
    <ResponseField name="Title" type="string" required>
      The **title** of the notification
    </ResponseField>

    <ResponseField name="Message" type="string" required>
      The **message** of the notification
    </ResponseField>

    <ResponseField name="Type" type="number">
      The **type of notification**, defaults to **0**. Can be one of the following:

      `0` - Info

      `1` - Error
    </ResponseField>

    <ResponseField name="Size" type="number">
      The size of the notification (**width in pixels**), defaults to **400**
    </ResponseField>

    <ResponseField name="Duration" type="number">
      The **duration of the notification (in milliseconds)**, defaults to **infinity**. (infinity will remove the tweening animation when the notification get created, this is probably a bug in RocketCore)
    </ResponseField>
  </Expandable>
</ResponseField>

Example:

```js theme={null}
PluginAPI.NotificationApi.send("Awesome Plugin", "RocketCore is awesome!", 0, 400, 5000);
PluginAPI.NotificationApi.send("Awesome Plugin", "Oops, something went wrong!", 1, 400, 5000);
```

# Plugin API structure

Here is the raw structure of the Plugin API. This is not meant to be used, it is only for reference.

```json PluginAPIDump.json theme={null}
{
    "NodeModulesPath": "C:\\Users\\Admin\\Desktop\\RocketCore\\resources\\app.asar\\node_modules",
    "ExploitApi": {
        "registeredExploits": [
            {
                "name": "Seliware",
                "execute": "[function]",
                "inject": "[function]",
                "getDllName": "[function]"
            },
            {
                "name": "SynapseZ",
                "execute": "[function]",
                "inject": "[function]",
                "getDllName": "[function]"
            }
        ],
        "currentExploit": {
            "name": "Seliware",
            "execute": "[function]",
            "inject": "[function]",
            "getDllName": "[function]"
        },
        "GetLatestErrorMessage": "[function]",
        "GetRobloxProcesses": "[function]",
        "getLoadedModules": "[function]",
        "GetInjectedRobloxProcesses": "[function]",
        "Execute": "[function]",
        "Inject": "[function]",
        "IsInjected": "[function]",
        "IsInjectedIntoAllInstances": "[function]",
        "registerExploit": "[function]",
        "setCurrentExploit": "[function]"
    },
    "RendererApi": {
        "Events": {},
        "setWindow": "[function]",
        "RegisterServerConnection": "[function]",
        "RunOnRenderer": "[function]",
        "RunFileOnRenderer": "[function]"
    },
    "NotificationApi": {
        "send": "[function]"
    }
}
```
