# Plugins

Status: **available** (SDK 1: report formats, importers, body views;
Settings › Plugins; four example plugins).

A plugin adds something Phantom does not do itself: a report format your
client wants, an importer for another tool's export, a way to read a body
format. Plugins are small Python packages. Phantom runs each call in its
own process and hands the plugin only the data that call needs.

## What a plugin can add

| Kind | Where you use it | What the plugin gets | What it returns |
|---|---|---|---|
| Report format | report **Export** menu | the report, masked by your export policy | the file |
| Importer | **Import HAR** › Read as | the file you picked | HAR entries |
| Body view | under a captured request or response | the body and headers, masked by your export policy | plain text |

## Installing one

1. Open **Settings › Plugins** and choose **Install plugin**.
2. Pick the plugin's `.zip`. Nothing in it runs yet: Phantom checks the
   package and stores it disabled.
3. Read what it asks to do, then choose **Grant and enable**.

The row shows the version, the author and license from the manifest, and
the SHA-256 of the package you installed, so you can compare it with
what the author published.

## Using one

- **Report format:** in a report, open **Export**; plugin formats are
  listed under *Plugins* with the plugin's name. The report is validated
  first, exactly like a built-in export.
- **Importer:** in HTTP history, open **Import HAR** and pick the format
  under *Read as*. The preview shows what would be imported before
  anything is stored.
- **Body view:** open a request in history; when an enabled plugin reads
  that body's media type, its chip appears under the toolbar.

## Examples

The repository has four working plugins in `plugins/examples`, each a
folder you can zip and install:

| Plugin | Adds |
|---|---|
| `findings-csv` | a CSV of a report's findings, safe to open in a spreadsheet |
| `burp-xml-import` | an importer for Burp Suite *Save items* XML files |
| `jwt-view` | a body view that decodes JSON Web Tokens and their times |
| `redmine-issues` | a service adapter that sends reviewed findings to Redmine as issues |

## Writing your own

- [Manifest](./manifest.md): `phantom-plugin.json`, permissions and
  contributions.
- [Handler contracts](./contracts.md): what each kind of handler gets and
  returns, and the `phantom_plugin` helpers.
- [Lifecycle](./lifecycle.md): installing, updates, pinning, disabling,
  failures.
- [Security](./security.md): what isolation covers and what it does not.

A plugin is a folder like this:

```text
my-plugin/
  phantom-plugin.json
  plugin.py
```

Zip the folder (the folder itself or its contents) and install the zip.
