Skip to content

A free, open-source alternative to Burp Suite: an intercepting proxy and web app security testing suite with Repeater, Intruder, Collaborator and a built-in OWASP ZAP scanner. Linux, AGPL-3.0.

3.5 KB
Raw Blame
package opensuite.extensions;

import opensuite.core.SuiteContext;
import opensuite.core.ToolModule;
import opensuite.ui.SettingsDialog;
import opensuite.ui.SuiteFrame;

import javax.swing.*;

/**
 * Extensions tool: load and manage add-ons that customise the suite.
 * Six sub-tabs: Installed (what is loaded), Store (the engine's marketplace),
 * APIs (the module contract), Custom scan checks and Script library (user
 * scripts, one function or all), and the settings launcher.
 */
public class ExtensionsTool implements ToolModule {

    private final ExtensionLoader extensions;
    private SuiteContext ctx;

    /** @param extensions the loader that runs the extensions listed under Installed, made by the shell so it outlives this tool's tab. */
    public ExtensionsTool(ExtensionLoader extensions) { this.extensions = extensions; }

    @Override public String name() { return "extensions"; }

    @Override public boolean alwaysTabbed() { return true; }

    @Override public void init(SuiteContext ctx) {
        this.ctx = ctx;
        SettingsDialog.register("Extensions", () -> new CoreExtensionSettingsPanel(ctx.settings()));
    }

    @Override public Tab[] tabs() {
        JComponent settings = ctx == null ? new JPanel()
                : SettingsDialog.launcher(ctx, "Extensions", "Extensions settings",
                        "Startup and load behaviour for extensions, and the Java, Python and Ruby runtimes they use, are configured under Settings > Extensions.");
        ScriptLibraryPanel library = new ScriptLibraryPanel(null,
                "Script library",
                "Scripts are small pieces of Java that run from tools across Open Suite to carry out a range of tasks: "
                      + "filters, custom actions, custom columns and scan checks. Use the library to manage your scripts in one "
                      + "place, then load them directly in compatible tools when needed.",
                "Customize Open Suite with Java-based scripts",
                "To get started, create or import a new script. Looking for ideas? Use a built-in template to create "
                      + "your script or browse the project's GitHub repository for ready-to-use scripts.",
                ctx == null ? null : source -> ctx.scripts().compiler().compileCustomAction(source).errors());
        // "edit script" in a custom actions panel opens the script here.
        if (ctx != null) ctx.scripts().setLibraryOpener(script -> {
            if (ctx.frame() instanceof SuiteFrame frame) frame.selectTool(name());
            library.reveal(script);
        });
        return new Tab[]{
                new Tab("Installed", new InstalledPanel(extensions)),
                new Tab("Store", new StorePanel()),
                new Tab("APIs", new ApisPanel(ctx == null ? null : ctx.settings())),
                new Tab("Custom scan checks", new ScriptLibraryPanel(
                        ScriptLibraryPanel.Function.SCAN_CHECK,
                        "Custom scan checks",
                        "Extend the scanner with your own checks. A custom scan check is a script that inspects a request "
                      + "and its response and reports issues; the scanner runs every enabled check against each audit item.",
                        "Extend the scanner with custom scan checks",
                        "Write a check once and the scanner applies it to every audit item. To get started, create a new check or import one.")),
                new Tab("Script library", library),
                new Tab("Extensions settings", settings),
        };
    }
}