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.

12.3 KB
Raw Blame

Open Suite module contract

Source root src in the repository root. Compile check, from the repository root: javac -d build -cp "lib/*:build" $(find src -name '*.java')

Java 25, the version tools/versions pins. Swing. No external deps beyond the BouncyCastle and Brotli jars vendored under lib/.

Implement this

package opensuite.core;
public interface ToolModule {
    String name();                       // lower-case tab caption; read once when an extension loads
    ToolModule.Tab[] tabs();             // one entry = no inner tab bar
    default JMenu[] menus() { return null; }
    default boolean alwaysTabbed() { return false; }
    default SuiteContext.MessageSink sink() { return null; }   // "send to <name>" for an extension; see below
    default void init(SuiteContext ctx) {}
    default void shutdown() {}
    default java.io.Serializable saveState() { return null; }   // saved with the project, under name()
    default void restoreState(java.io.Serializable state) {}
    record Tab(String title, javax.swing.JComponent component) {}
}

opensuite.core.SuiteContext (passed to init)

MessageStore store();        Scope scope();       Settings settings();
Frame frame();               void setFrame(Frame f);
void registerSink(String toolName, MessageSink sink);   // enables "send to <toolName>"
void unregisterSink(String toolName);
List<String> sinkNames();    boolean hasSink(String n);
void sendTo(String tool, HttpService svc, HttpMessage req, HttpMessage resp, String caption);
LogEntry record(String tool, HttpService svc, HttpMessage req);  // adds to history
void siteMapChanged(LogEntry e);   void addSiteMapListener(SiteMapListener l);   void removeSiteMapListener(SiteMapListener l);
void alert(String tool, String message);   List<Alert> alerts();
void scopeChanged();         void addScopeListener(ScopeListener l);   void removeScopeListener(ScopeListener l);

interface MessageSink { void receive(HttpService svc, HttpMessage req, HttpMessage resp, String caption);
                        /** True for a tool that takes one item per send (the comparer). */ default boolean singleItem() { return false; } }
interface SiteMapListener { void siteMapChanged(LogEntry e); }
interface ScopeListener { void scopeChanged(); }

Every add...Listener (addIssueListener, addTaskListener, addAlertListener, addSendListener, and MessageStore.addListener, WebSocketStore.addListener, Settings.addListener) has a remove...Listener beside it.

Loaded at run time

A jar added under Extensions > Installed runs the same contract, with one more rule: none of its methods is called on the event thread. It gets a thread of its own, opensuite-ext-<name>, and every call into it, and every event the suite raises for it, is made there, one at a time.

  • The entry point is the one class that implements ToolModule with a public constructor with no arguments; of several, META-INF/services/opensuite.core.ToolModule names the one to run. Its package is outside opensuite.
  • tabs() and menus() build their components before anything is on screen. Anything that has to happen on the event thread is posted there with SwingUtilities.invokeLater.
  • sink() is read once, on the extension's thread, and registered under name(). A tool built into the suite calls ctx.registerSink in init instead.
  • A listener the extension registers is never called on the thread that raised the event: a stand-in offers each event to the extension's thread from a queue of 256, and returns at once. A full queue drops the event and says so in the event log. A listener that runs for more than five seconds has the extension marked unresponsive and new events paused, until it is removed or resumed.
  • init and restoreState may take ten seconds, saveState two, shutdown five. Past them the extension is disabled, the state is left out, or the wait simply ends.
  • saveState() may hold only the JDK's value and collection types and the suite's own classes. It is checked when it is saved, and one that holds a class of the extension's own is left out.
  • The extension has a class loader of its own, which tries its own jar and the library folder before the suite; java.* and opensuite.* always come from the suite.
  • Remove unregisters what the extension registered, interrupts its thread, waits five seconds and closes its loader. A thread that will not stop is left running, with its loader kept, until the suite restarts; its row stays to say so until the thread has ended.
  • The list of extensions is ~/.opensuite/extensions.tsv; they load again at startup when "Automatically reload extensions on startup" and the row's Auto-reload box are both ticked.

opensuite.core.HttpMessage

Always retains raw bytes; parsing is advisory.

new HttpMessage(byte[]);  byte[] raw();  void setRaw(byte[]);  int length();  HttpMessage copy();
int bodyOffset();  byte[] body();  void setBody(byte[]);  String bodyText();
String headerText();  List<String> headerLines();  String startLine();
String header(String name);  boolean hasHeader(String);  void setHeader(String,String);  void removeHeader(String);
void updateContentLength();   boolean isRequest();
String method();  void setMethod(String);  String requestTarget();  void setRequestTarget(String);
String path();  String query();  String fileExtension();
int statusCode();  String statusText();  String contentType();  String mimeType();  String htmlTitle();
List<Param> parameters();  boolean hasParameters();

opensuite.core.Param: String name(); String value(); Param.Type type(); int nameStart(); int nameEnd(); int valueStart(); int valueEnd(); String typeLabel(); Param.Type = URL, BODY, COOKIE, MULTIPART, XML, JSON, HEADER.

opensuite.core.HttpService

new HttpService(String host,int port,boolean secure); host() port() secure() protocol() url(); HttpService.parse(String url).

opensuite.core.HttpClient

HttpClient.Options o = new HttpClient.Options();
  // connectTimeoutMs readTimeoutMs updateContentLength unpackGzip followRedirects maxRedirects
HttpClient.Result r = new HttpClient().send(svc, requestMessage, o);
  // r.ok() r.response (HttpMessage) r.error (String) r.millis r.remoteIp r.redirectsFollowed

opensuite.core.LogEntry

number() tool() service() request() response() time() url() pathAndQuery() status() responseLen() mimeType() title() error() durationMillis() notes() highlight() edited() remoteIp() setters: setResponse setRequest setError setDurationMillis setNotes setHighlight setEdited setRemoteIp. Construct: new LogEntry(String tool, HttpService svc, HttpMessage request).

opensuite.core.MessageStore

add(LogEntry) all() size() get(i) clear() remove(e) replaceAll(list) addListener(MessageStore.Listener) interface Listener { void entryAdded(LogEntry e); void entryUpdated(LogEntry e); }

opensuite.core.WebSocketStore

add(WebSocketMessage) all() recent(n) size() get(i) clear() replaceAll(list) addListener(WebSocketStore.Listener) interface Listener { void messageAdded(WebSocketMessage m); default messageRemoved(m) reloaded(list) }

opensuite.core.Scope

boolean isInScope(HttpService svc, String path), isInScope(LogEntry), include(), exclude() (List<Scope.Rule>), includeUrl(svc,path,wholeHost), excludeUrl(...).

opensuite.core.Bytes

indexOf concat slice str(byte[]) bytes(String) lines(String) isPrintableText toHex Bytes.str / Bytes.bytes use ISO-8859-1 so byte round-trips are lossless. Use them, never new String(b).

opensuite.ui.Ui (use these so everything looks consistent)

Ui.PLAIN Ui.BOLD Ui.MONO Ui.HEADING            // fonts
Ui.ACCENT Ui.GRID Ui.ERROR_RED Ui.ZEBRA        // colours
Ui.heading(s) Ui.label(s) Ui.bold(s) Ui.check(s,sel) Ui.radio(s,sel)
Ui.button(s) Ui.button(s,tooltip) Ui.field(s,cols) Ui.combo(T[]) Ui.note(s)
Ui.pad(t,l,b,r) Ui.row(comps...) Ui.vbox(comps...)
Ui.form("label:", field, "label:", field, ...)   // aligned form; see the rules below
Ui.filterBar(JButton, comps...)                  // shared-height filter or search strip
Ui.styleTable(JTable) Ui.setWidths(JTable,int...) Ui.scroll(Component) Ui.truncate(s,max)

opensuite.ui.MessageEditor

new MessageEditor(ctx, MessageEditor.REQUEST, editable)    // views: raw params headers hex
new MessageEditor(ctx, MessageEditor.RESPONSE, editable)   // views: raw headers hex render
void setMessage(HttpService svc, HttpMessage m)
void setMessage(HttpService svc, HttpMessage m, HttpMessage relatedRequest)
HttpMessage message();  byte[] bytes();  void setChangeListener(Runnable)
void addActionProvider(ActionProvider p);  JPopupMenu buildMenu();  void selectView(String)

It already provides the "send to " menu from ctx.sinkNames().

opensuite.ui.OptionsPage

OptionsPage p = new OptionsPage();
p.section("heading", component1, component2, ...);   // stacked, rule between sections
p.addSection(component);
OptionsPage.fieldRow("label", jTextField, "suffix");
OptionsPage.indent(component, px);

opensuite.ui.ScopeEditor

new ScopeEditor(ctx, ctx.scope()) or any other Scope instance.

Scripts (opensuite.script.api)

Scripts are Java method bodies kept under ~/.opensuite/scripts/<function>/<name>.java and managed in Extensions > Script library. A custom action runs from Repeater's Custom actions panel with this signature; its body is the whole file:

void action(HttpRequestResponse requestResponse, Utilities utilities)
HttpRequestResponse  request()  response() (null when none)  hasResponse()  setRequest(HttpRequest)
HttpRequest          method() path() query() url() header(n) headers() body() bodyText() parameters() service()
                     withHeader(n,v) withRemovedHeader(n) withBody(byte[]) withBody(String) withMethod(m) withPath(p)
                                                     // each returns a new request; the original is never changed
HttpResponse         statusCode() header(n) headers() body() bodyText() mimeType()
Utilities            log(o) clipboard(s) bytes(s) concat(byte[]...) hex(b) base64Encode/Decode urlEncode/Decode
                     sha256(b) md5(b) hmacSha256(key, data)   // hashes take and return bytes
  • body() is the exact bytes; bodyText() and withBody(String) use the declared charset, or UTF-8 when none is declared. Sign bytes, not text.
  • A request handed to setRequest replaces the one being edited only when the action ends without an error, as one change that a single undo takes back. An action never sends anything.
  • The script API, java.util.* and java.nio.charset.* are imported. Only opensuite.script.api is a supported surface; the suite's other classes can change.
  • Runs happen one at a time on a thread of their own, with a 10 second limit; Run turns into Stop while one is under way. A script that ignores interruption cannot be ended and is left running until Open Suite restarts; with three of those, runs are refused. A script that calls System.exit, Runtime.exit or Runtime.halt is refused when it is compiled.
  • Output is capped at 1,000 lines or 64 KB per run. Errors are reported at the script's own line numbers.
  • Scripts run with the user's own permissions. There is no sandbox: load only code you trust.

Rules

  • Package per tool: opensuite.decoder, opensuite.comparer, etc. One public class implementing ToolModule.
  • No System.exit, no static mutable singletons, no printing to stdout.
  • Long work goes on a background thread; touch Swing only via SwingUtilities.invokeLater.
  • Register a sink in init if your tool can receive messages: ctx.registerSink("decoder", (svc,req,resp,cap) -> {...}).
  • Remove in shutdown() every listener and sink you registered: ctx.removeIssueListener(l), ctx.unregisterSink(name), and so on. A listener must return promptly; hand long work to a thread of your own.
  • British spelling in user-visible text. Lower-case tab and control labels, as the original used.
  • Lay out cleanly and align. Whenever a panel has more than one labelled input, build it with Ui.form("label:", field, "label:", field, ...) so the labels are right-aligned in one column and every field shares a left edge. For a filter or search strip use Ui.filterBar(...) so the controls share one height. Do not hand-place labelled fields with FlowLayout or padded-string labels; they never line up. Neat alignment is a requirement, not a nicety.