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.
Java application-securityappsecbug-bountyburp-alternativeburp-suitedasthttp-proxyinfosecintercepting-proxyjavaowaspowasp-zappenetration-testingpentestingsecuritysecurity-toolsvulnerability-scannerweb-application-securityweb-security
package opensuite.ui.settings;
import opensuite.core.ResourcePool;
import opensuite.core.Settings;
import opensuite.core.SuiteContext;
import opensuite.oast.Collaborator;
import opensuite.ui.OptionsPage;
import opensuite.ui.ScopeEditor;
import opensuite.ui.Ui;
import javax.swing.*;
import javax.swing.table.AbstractTableModel;
import java.awt.*;
import java.util.List;
/** Settings > Project pages: Scope, Collaborator, Tasks, Automatic backup, Logging. */
public final class ProjectPages {
private ProjectPages() {}
public static SettingsPage scope(SuiteContext ctx) {
Settings s = ctx.settings();
SettingsPage p = new SettingsPage();
p.block("Target scope", SettingsPage.Kind.PROJECT,
"Target scope is a key configuration setting. It controls which hosts and URLs the tools treat as in scope: "
+ "the site map, the proxy history and the scanner can all be limited to it.",
null, new ScopeEditor(ctx, ctx.scope()));
JRadioButton[] r = SettingsPage.radios(s, "scope.outOfScope.mode", "suite", new String[]{"suite", "custom"},
"Use suite scope [defined above]", "Use custom scope");
JCheckBox drop = SettingsPage.check(s, "scope.dropOutOfScope", false, "Drop all out-of-scope requests");
// The custom scope has its own tables, shown only while it is the one in use.
ScopeEditor custom = new ScopeEditor(ctx, ctx.dropScope(), "scope.outOfScope.advanced", false);
JPanel customHolder = new JPanel(new BorderLayout());
customHolder.setOpaque(false);
customHolder.setBorder(Ui.pad(10, 12, 0, 0));
customHolder.add(custom, BorderLayout.CENTER);
ctx.addScopeListener(ctx::saveDropScope);
Runnable show = () -> {
for (JRadioButton b : r) b.setEnabled(drop.isSelected());
customHolder.setVisible(drop.isSelected() && r[1].isSelected());
customHolder.revalidate();
};
drop.addItemListener(e -> show.run());
for (JRadioButton b : r) b.addItemListener(e -> show.run());
show.run();
p.block("Out-of-scope request handling", SettingsPage.Kind.PROJECT,
"Use these settings to prevent the tools from sending any requests to out-of-scope hosts, by dropping them at the proxy.",
() -> { s.setBool("scope.dropOutOfScope", false); s.set("scope.outOfScope.mode", "suite"); r[0].setSelected(true); },
drop, opensuite.ui.Sections.gap(4),
OptionsPage.indent(Ui.vbox(r[0], Box.createVerticalStrut(3), r[1]), 12),
customHolder);
ProjectExtras.history(p, ctx);
return p;
}
public static SettingsPage collaborator(SuiteContext ctx) {
Settings s = ctx.settings();
Collaborator collab = ctx.collaborator();
SettingsPage p = new SettingsPage();
String mode = s.get(Collaborator.SERVER_KEY, "").isEmpty() ? "default" : s.get("oast.mode", "private");
JRadioButton useDefault = Ui.radio("Use the default Collaborator server", "default".equals(mode));
JRadioButton none = Ui.radio("Don't use Collaborator", "none".equals(mode));
JRadioButton priv = Ui.radio("Use a private Collaborator server:", "private".equals(mode));
ButtonGroup g = new ButtonGroup();
g.add(useDefault); g.add(none); g.add(priv);
JTextField server = Ui.field("private".equals(mode) ? s.get(Collaborator.SERVER_KEY, "") : "");
JTextField polling = Ui.field(s.get("oast.polling", ""));
JTextField token = Ui.field(s.get(Collaborator.TOKEN_KEY, ""));
JCheckBox unencrypted = SettingsPage.check(s, "oast.pollHttp", false, "Poll over unencrypted HTTP");
Runnable apply = () -> {
String m = none.isSelected() ? "none" : priv.isSelected() ? "private" : "default";
s.set("oast.mode", m);
s.set(Collaborator.SERVER_KEY, priv.isSelected() ? server.getText().strip() : "");
s.set("oast.polling", polling.getText().strip());
s.set(Collaborator.TOKEN_KEY, token.getText().strip());
boolean on = !none.isSelected();
server.setEnabled(priv.isSelected()); polling.setEnabled(priv.isSelected()); token.setEnabled(priv.isSelected());
unencrypted.setEnabled(on);
};
for (AbstractButton b : new AbstractButton[]{useDefault, none, priv}) b.addItemListener(e -> apply.run());
for (JTextField f : new JTextField[]{server, polling, token}) f.getDocument().addDocumentListener(new javax.swing.event.DocumentListener() {
public void insertUpdate(javax.swing.event.DocumentEvent e) { apply.run(); }
public void removeUpdate(javax.swing.event.DocumentEvent e) { apply.run(); }
public void changedUpdate(javax.swing.event.DocumentEvent e) { apply.run(); }
});
apply.run();
JButton health = Ui.button("Run health check ...", "restart the Collaborator client and report whether it registered");
health.addActionListener(e -> {
String err = collab.start();
JOptionPane.showMessageDialog(health, err == null
? "Health check passed. Registered with " + collab.serverUrl() + "\nPayload host: " + collab.payloadHost()
: "Health check failed: " + err, "Collaborator health check", err == null ? JOptionPane.INFORMATION_MESSAGE : JOptionPane.WARNING_MESSAGE);
});
Ui.sizedAlike(316, server, polling, token);
JLabel[] labels = { opensuite.ui.Sections.caption("Server location:"), opensuite.ui.Sections.caption("Polling location (optional):"),
opensuite.ui.Sections.caption("Auth token (optional):") };
int labelColumn = Ui.column(142, Ui.PLAIN, "Polling location (optional):");
for (JLabel l : labels) l.setPreferredSize(new Dimension(labelColumn, Ui.tall(18)));
JPanel block = p.block("Collaborator server", SettingsPage.Kind.BOTH,
"The Collaborator server is an external service that Open Suite can use to help discover many kinds of vulnerabilities, by capturing "
+ "the out-of-band interactions (DNS, HTTP, SMTP) that a target makes with hostnames injected by the scanner. You can use the default "
+ "public server, or deploy your own instance and use that.",
() -> { useDefault.setSelected(true); server.setText(""); polling.setText(""); token.setText(""); s.setBool("oast.pollHttp", false); },
SettingsPage.overrideRow(s, "oast.overrideProject"),
useDefault, none, priv,
opensuite.ui.Sections.gap(0),
OptionsPage.indent(Ui.vbox(SettingsPage.line(22, labels[0], server), Box.createVerticalStrut(5),
SettingsPage.line(22, labels[1], polling), Box.createVerticalStrut(5),
SettingsPage.line(22, labels[2], token)), 20),
opensuite.ui.Sections.gap(5),
unencrypted, opensuite.ui.Sections.gap(5), health);
block.setBorder(BorderFactory.createCompoundBorder(Ui.pad(Math.max(0, 4 - Ui.fontGrowth()), 0, 0, 0), block.getBorder()));
return p;
}
public static SettingsPage tasks(SuiteContext ctx) {
Settings s = ctx.settings();
SettingsPage p = new SettingsPage();
p.block("Resource pools", SettingsPage.Kind.PROJECT,
"A resource pool is a grouping of tasks that share a quota of network resources. Each resource pool can have its own throttling "
+ "settings, controlling the number of concurrent requests that can be made, the rate at which those requests can be made, or both.",
null, new PoolsTable());
JRadioButton[] r = SettingsPage.radios(s, "tasks.autostart", "start", new String[]{"start", "pause"}, "Start tasks", "Pause tasks");
JPanel pause = OptionsPage.indent(r[1], 0);
pause.setBorder(Ui.pad(4, 2, 0, 0));
pause.setPreferredSize(new Dimension(r[1].getPreferredSize().width + 2, r[1].getPreferredSize().height + 4)); // room for the inset, or the label is cut
p.block("New task auto-start", SettingsPage.Kind.PROJECT,
"Use this setting to control whether tasks automatically start when they are created.",
() -> { s.set("tasks.autostart", "start"); r[0].setSelected(true); }, r[0], pause);
p.block("Schedule tasks", SettingsPage.Kind.PROJECT,
"Use these settings to specify defined times at which tasks are performed. Specify a time as HH:mm, or yyyy-MM-dd HH:mm for a single date. Specify a task as Pause tasks, Resume tasks, or a URL to scan.",
null, new KeyedTable(s, "tasks.schedule", new String[]{"Time", "Repeat", "Task"}, 150, "Add", "Edit", "Remove")
.size(450, 150).widths(Ui.unwide(75), Ui.unwide(75), 450 - 2 * Ui.unwide(75) - 2) /* Time and Repeat stay 75 wide */.choices("Repeat", opensuite.core.TaskSchedule.ONCE, opensuite.core.TaskSchedule.DAILY));
return p;
}
/** The project's resource pools with New / Edit / Delete. */
private static final class PoolsTable extends JPanel {
private final AbstractTableModel model = new AbstractTableModel() {
private final String[] cols = {"Resource pool", "Running tasks", "Concurrent requests", "Request delay", "Random delay", "Delay increment", "Auto throttle"};
@Override public int getRowCount() { return ResourcePool.all().size(); }
@Override public int getColumnCount() { return cols.length; }
@Override public String getColumnName(int c) { return cols[c]; }
@Override public Object getValueAt(int r, int c) {
ResourcePool x = ResourcePool.all().get(r);
return switch (c) { case 0 -> x.name(); case 1 -> "0"; case 2 -> x.limitConcurrent() ? String.valueOf(x.concurrent()) : "Unlimited";
case 3 -> x.requestDelayText(); case 4 -> x.randomDelayText(); case 5 -> x.delayIncrementText(); default -> x.autoThrottleText(); };
}
};
PoolsTable() {
super(new BorderLayout(5, 0));
setOpaque(false);
JTable t = new JTable(model);
Ui.styleTable(t);
t.putClientProperty(Ui.KEEP_WIDTHS, Boolean.TRUE);
t.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
Ui.exactWidths(t, 119, 84, 113, 84, 84, 95, 79);
JButton neu = Ui.button("New..."), edit = Ui.button("Edit"), del = Ui.button("Delete");
neu.addActionListener(e -> { ResourcePool x = dialog(null); if (x != null) ResourcePool.add(x); });
edit.addActionListener(e -> { int i = t.getSelectedRow(); if (i >= 0) { ResourcePool x = ResourcePool.all().get(i); if (dialog(x) != null) ResourcePool.changed(); } });
del.addActionListener(e -> { int i = t.getSelectedRow(); if (i >= 0) ResourcePool.remove(ResourcePool.all().get(i)); });
ResourcePool.addListener(() -> SwingUtilities.invokeLater(model::fireTableDataChanged));
Ui.sizedAlike(79, neu, edit, del);
add(Ui.buttonColumn(neu, edit, del), BorderLayout.WEST);
add(opensuite.ui.Sections.withArrow(Ui.scroll(t), 660, 150), BorderLayout.CENTER);
}
private ResourcePool dialog(ResourcePool editing) {
ResourcePool x = editing == null ? new ResourcePool("") : editing;
JTextField name = Ui.field(x.name());
JCheckBox limit = Ui.check("Maximum concurrent requests:", x.limitConcurrent());
JSpinner conc = new JSpinner(new SpinnerNumberModel(x.concurrent(), 1, 100, 1));
JCheckBox delayOn = Ui.check("Delay between requests:", x.delayOn());
JSpinner delay = new JSpinner(new SpinnerNumberModel(x.delayMs(), 0, 60000, 50));
JRadioButton fixed = Ui.radio("Fixed", x.delayMode() == ResourcePool.DelayMode.FIXED);
JRadioButton random = Ui.radio("With random variations", x.delayMode() == ResourcePool.DelayMode.RANDOM);
JRadioButton inc = Ui.radio("Increase delay in increments of:", x.delayMode() == ResourcePool.DelayMode.INCREMENT);
ButtonGroup g = new ButtonGroup(); g.add(fixed); g.add(random); g.add(inc);
JSpinner incMs = new JSpinner(new SpinnerNumberModel(x.incrementMs(), 0, 60000, 50));
JCheckBox throttle = Ui.check("Automatic throttling", x.throttleOn());
JCheckBox t429 = Ui.check("429", x.throttle429()), t503 = Ui.check("503", x.throttle503());
JTextField other = Ui.field(x.throttleOther());
JPanel form = Ui.vbox(Ui.row(Ui.label("Name:"), name), Ui.row(limit, conc), Ui.row(delayOn, delay, Ui.label("ms")),
OptionsPage.indent(Ui.vbox(fixed, random, Ui.row(inc, incMs, Ui.label("ms"))), 24),
throttle, OptionsPage.indent(Ui.row(t429, t503, Ui.label("Other:"), other), 24));
form.setBorder(Ui.pad(10, 10, 10, 10));
int ok = JOptionPane.showConfirmDialog(this, form, editing == null ? "New resource pool" : "Edit resource pool", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
if (ok != JOptionPane.OK_OPTION) return null;
if (editing == null || !ResourcePool.DEFAULT_NAME.equals(x.name())) x.setName(name.getText().strip().isEmpty() ? "Resource pool" : name.getText().strip());
x.setLimitConcurrent(limit.isSelected()); x.setConcurrent((Integer) conc.getValue());
x.setDelayOn(delayOn.isSelected()); x.setDelayMs((Integer) delay.getValue());
x.setDelayMode(random.isSelected() ? ResourcePool.DelayMode.RANDOM : inc.isSelected() ? ResourcePool.DelayMode.INCREMENT : ResourcePool.DelayMode.FIXED);
x.setIncrementMs((Integer) incMs.getValue());
x.setThrottleOn(throttle.isSelected()); x.setThrottle429(t429.isSelected()); x.setThrottle503(t503.isSelected()); x.setThrottleOther(other.getText().strip());
return x;
}
}
public static SettingsPage backup(SuiteContext ctx) {
Settings s = ctx.settings();
SettingsPage p = new SettingsPage();
boolean disk = ctx.projectFile() != null;
JCheckBox auto = SettingsPage.check(s, "backup.auto", false, "Automatically back up the project every");
JTextField mins = SettingsPage.number(s, "backup.minutes", 30, 5);
JCheckBox inScope = SettingsPage.check(s, "backup.inScopeOnly", false, "Include in-scope items only");
JCheckBox progress = SettingsPage.check(s, "backup.progress", false, "Show progress dialog during backups");
JCheckBox delete = SettingsPage.check(s, "backup.deleteOnExit", false, "Delete backup file on clean shutdown of Open Suite");
Ui.sized(mins, 54);
auto.setBorder(Ui.pad(0, 2, 0, 0));
for (JCheckBox c : new JCheckBox[]{inScope, progress, delete}) c.setPreferredSize(new Dimension(c.getPreferredSize().width, 20));
String why = "This is a temporary project, which is never written to disk. Open or create a disk project to enable backups.";
for (JComponent c : new JComponent[]{auto, mins, inScope, progress, delete}) {
c.setEnabled(disk);
if (!disk) c.setToolTipText(why);
}
// The copy goes beside the project file, with .bak added to its name.
JPanel block = p.block("Automatic backup [disk projects only]", SettingsPage.Kind.USER,
"Automatic project backup saves a copy of the Open Suite project file periodically in the background. Use these settings to "
+ "configure automatic project backups in Open Suite.",
() -> SettingsPage.clearPrefix(s, "backup."),
Ui.vbox(SettingsPage.line(22, auto, 7, mins, 5, opensuite.ui.Sections.caption("minutes")), Box.createVerticalStrut(5 + Ui.fontGrowth()),
OptionsPage.indent(inScope, 19), Box.createVerticalStrut(5 + Ui.fontGrowth()), OptionsPage.indent(progress, 19),
Box.createVerticalStrut(5 + Ui.fontGrowth()), OptionsPage.indent(delete, 19)));
block.setBorder(BorderFactory.createCompoundBorder(Ui.pad(4, 0, 0, 0), block.getBorder()));
return p;
}
public static SettingsPage logging(SuiteContext ctx) {
Settings s = ctx.settings();
SettingsPage p = new SettingsPage();
String[] names = {"All tools:", "Proxy:", "Scanner:", "Intruder:", "Repeater:", "Sequencer:", "Extensions:"};
String[] tools = opensuite.core.TrafficLog.TOOLS;
// Measured: the name column is 82 wide and the first tick column 84, 87 and 94 at the usual 13px.
int g = Ui.fontGrowth(), nameW = 82 + Math.round(2.5f * g), reqW = 84 + 5 * g, rowH = Ui.tall(18);
java.util.List<JCheckBox> boxes = new java.util.ArrayList<>();
java.util.List<Component> rows = new java.util.ArrayList<>();
for (int i = 0; i < tools.length; i++) {
JLabel label = opensuite.ui.Sections.caption(names[i]);
label.setPreferredSize(new Dimension(nameW, rowH));
JCheckBox req = logBox(s, tools[i], false), resp = logBox(s, tools[i], true);
req.setPreferredSize(new Dimension(reqW, rowH));
boxes.add(req); boxes.add(resp);
JPanel row = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
row.setOpaque(false);
resp.setPreferredSize(new Dimension(resp.getPreferredSize().width, rowH));
row.add(label); row.add(req); row.add(resp);
row.setBorder(Ui.pad(1, 0, 0, 0)); // FlowLayout centres its row, so 1 above is 1 below as well
row.setPreferredSize(new Dimension(nameW + reqW + resp.getPreferredSize().width, rowH + 2));
rows.add(row);
if (i == 0) rows.add(opensuite.ui.Sections.gap(0)); // "All tools" stands apart from the tools themselves
}
p.block("Logging", SettingsPage.Kind.PROJECT,
"Use these settings to control logging of HTTP requests and responses to log files.",
() -> { SettingsPage.clearPrefix(s, "logging."); for (JCheckBox b : boxes) b.setSelected(false); },
rows.toArray(new Component[0]));
ProjectExtras.file(p, ctx);
return p;
}
/**
* A logging tick box. Ticking it asks which file to log to, as each box
* has a file of its own; backing out of the question leaves it unticked.
*/
private static JCheckBox logBox(Settings s, String tool, boolean response) {
String key = opensuite.core.TrafficLog.key(tool, response), fileKey = opensuite.core.TrafficLog.fileKey(tool, response);
JCheckBox box = Ui.check(response ? "Responses" : "Requests", "true".equals(s.get(key, "false")));
Runnable tip = () -> box.setToolTipText(box.isSelected() ? "Logging to " + s.get(fileKey, "") : null);
tip.run();
box.addActionListener(e -> {
if (!box.isSelected()) { s.set(key, "false"); tip.run(); return; }
JFileChooser fc = new opensuite.ui.FileChooser();
fc.setDialogTitle("Select a log file");
String before = s.get(fileKey, "");
if (!before.isBlank()) fc.setSelectedFile(new java.io.File(before));
if (fc.showSaveDialog(SwingUtilities.getWindowAncestor(box)) != JFileChooser.APPROVE_OPTION) { box.setSelected(false); return; }
s.set(fileKey, fc.getSelectedFile().getAbsolutePath());
s.set(key, "true");
tip.run();
});
return box;
}
}