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.intruder;
import opensuite.ui.Ui;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/**
* The payloads tab: a selector for the active payload set, the configuration
* of each set, and live payload/request counts. The number of sets is driven
* by the attack type and the number of payload positions.
*/
public class PayloadsPanel extends JPanel {
/** Maximum payload sets, matching the original. */
static final int MAX_SETS = 8;
private final PayloadSet[] sets = new PayloadSet[MAX_SETS];
private final JPanel cards = new JPanel(new CardLayout());
private final JComboBox<String> setCombo = new JComboBox<>();
private final JLabel payloadCount = Ui.label("0");
private final JLabel requestCount = Ui.label("0");
private final JButton start = Ui.primaryButton("start attack", "Launch the attack with the current configuration");
private AttackType attackType = AttackType.SNIPER;
private int positions = 0;
private int activeSetCount = 1;
/** Which set currently holds the shared count labels, or -1 for none. */
private int summaryAt = -1;
/** The width of the label column: the controls beside it all start 96px in. */
static final int LABEL_WIDTH = Ui.column(96, Ui.PLAIN, "Payload position:");
public PayloadsPanel() {
super(new BorderLayout());
setBackground(opensuite.ui.Theme.BG);
for (int i = 0; i < MAX_SETS; i++) {
sets[i] = new PayloadSet();
sets[i].onChange(this::refreshCounts);
cards.add(sets[i], String.valueOf(i));
}
cards.setOpaque(false);
setCombo.setFont(Ui.PLAIN);
setCombo.setToolTipText("Choose the payload set to configure; the attack type "
+ "determines the number of payload sets available");
setCombo.addActionListener(e -> {
int i = setCombo.getSelectedIndex();
if (i >= 0 && positions > 0) {
((CardLayout) cards.getLayout()).show(cards, String.valueOf(i));
refreshCounts();
}
});
// Everything scrolls as one column, as the reference's side panel does:
// the payload position, then the set in front (its type, the two
// counts and its sections).
JPanel top = opensuite.ui.Sections.column(0, Ui.labelled("Payload position:", LABEL_WIDTH, setCombo, 22));
top.setBorder(Ui.pad(10, 10, 5, 10));
JPanel column = opensuite.ui.Sections.column(0, opensuite.ui.Sections.fill(top), opensuite.ui.Sections.fill(cards));
column.setBackground(opensuite.ui.Theme.BG);
column.setOpaque(true);
JScrollPane sp = Ui.scrollColumn(column);
sp.getViewport().setBackground(opensuite.ui.Theme.BG);
sp.setBackground(opensuite.ui.Theme.BG);
add(sp, BorderLayout.CENTER);
setAttack(AttackType.SNIPER, 0);
}
public void setStartAction(Runnable r) {
for (java.awt.event.ActionListener l : start.getActionListeners()) start.removeActionListener(l);
start.addActionListener(e -> r.run());
}
/** Re-derive the number of payload sets from attack type and positions. */
public void setAttack(AttackType type, int positions) {
this.attackType = type;
this.positions = positions;
this.activeSetCount = Math.min(Math.max(1, type.setCount(positions)), MAX_SETS);
int keep = Math.max(0, Math.min(setCombo.getSelectedIndex(), activeSetCount - 1));
setCombo.removeAllItems();
if (positions == 0) {
// Nothing is marked yet, so say so rather than offering set 1.
setCombo.addItem("No payload positions configured");
} else {
// One set shared by every position (sniper, battering ram) is named
// for what it does, as in the reference; otherwise the sets are numbered.
if (activeSetCount == 1) setCombo.addItem("All payload positions");
else for (int i = 1; i <= activeSetCount; i++) setCombo.addItem(String.valueOf(i));
setCombo.setSelectedIndex(keep);
}
refreshCounts();
}
/** The payload sets this attack will draw from, in position order. */
public List<PayloadSet> activeSets() {
List<PayloadSet> out = new ArrayList<>();
for (int i = 0; i < activeSetCount; i++) out.add(sets[i]);
return out;
}
private void refreshCounts() {
int idx = positions == 0 ? 0 : setCombo.getSelectedIndex();
if (idx < 0 || idx >= MAX_SETS) idx = 0;
// One label cannot sit in two containers, so the count rows move into
// whichever set is on screen.
if (idx != summaryAt) {
sets[idx].setSummary(payloadCount, requestCount);
summaryAt = idx;
}
int c = sets[idx].count();
payloadCount.setText(c < 0 ? "unknown" : String.valueOf(c));
int[] sizes = new int[activeSetCount];
for (int i = 0; i < activeSetCount; i++) {
int n = sets[i].count();
sizes[i] = n < 0 ? 0 : n;
}
long reqs = attackType.requestCount(positions, sizes);
requestCount.setText(String.valueOf(reqs));
}
}