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.List;
/**
* One payload set: a generator-type combo, the selected generator's
* configuration panel, and a payload-processing panel beneath.
*/
public class PayloadSet extends JPanel {
private final PayloadGenerator[] generators = {
new SimpleListGenerator(),
new RuntimeFileGenerator(),
new NumbersGenerator(),
new DatesGenerator(),
new BruteForcerGenerator(),
new NullPayloadsGenerator(),
new CharacterSubstitutionGenerator(),
new CaseSubstitutionGenerator(),
new CustomIteratorGenerator(),
new CharacterBlocksGenerator(),
new CharacterFrobberGenerator(),
new BitFlipperGenerator(),
};
private final JComboBox<String> typeCombo;
/** The "Payload type" row, so the panel can put the counts under it. */
private JPanel typeRow;
private final JPanel cards = new JPanel(new CardLayout());
private final PayloadProcessor processor = new PayloadProcessor();
private Runnable onChange;
public PayloadSet() {
super();
setOpaque(false);
String[] labels = new String[generators.length];
for (int i = 0; i < generators.length; i++) {
labels[i] = generators[i].label().trim();
final int idx = i;
generators[i].onChange(() -> { if (onChange != null) onChange.run(); });
cards.add(generators[i].config(), String.valueOf(idx));
}
cards.setOpaque(false);
typeCombo = Ui.combo(labels);
typeCombo.addActionListener(e -> {
showCard(typeCombo.getSelectedIndex());
if (onChange != null) onChange.run();
});
this.typeRow = summary(Ui.label("0"), Ui.label("0"));
JPanel config = Ui.section("Payload configuration",
"This payload type lets you configure a simple list of strings that are used as payloads.",
cards);
setLayout(new BorderLayout());
body = opensuite.ui.Sections.column(0, opensuite.ui.Sections.fill(typeRow), opensuite.ui.Sections.fill(config),
opensuite.ui.Sections.fill(processor));
add(body, BorderLayout.CENTER);
showCard(0);
}
private JPanel body;
/** Type, then the two counts: a 22px row and two of 20, 5px apart, 10px above the first rule. */
private JPanel summary(javax.swing.JLabel payloadCount, javax.swing.JLabel requestCount) {
JPanel p = opensuite.ui.Sections.column(5,
Ui.labelled("Payload type:", PayloadsPanel.LABEL_WIDTH, typeCombo, 22),
Ui.labelled("Payload count:", PayloadsPanel.LABEL_WIDTH, payloadCount, 20),
Ui.labelled("Request count:", PayloadsPanel.LABEL_WIDTH, requestCount, 20));
p.setBorder(Ui.pad(0, 10, 10, 10));
return p;
}
/**
* Put the panel's count rows directly under the type row, which is the
* order the reference uses: position, type, then the two counts.
*/
void setSummary(javax.swing.JLabel payloadCount, javax.swing.JLabel requestCount) {
body.remove(typeRow);
typeRow = summary(payloadCount, requestCount);
body.add(opensuite.ui.Sections.fill(typeRow), 0);
revalidate();
}
private void showCard(int i) {
((CardLayout) cards.getLayout()).show(cards, String.valueOf(i));
}
private PayloadGenerator current() { return generators[typeCombo.getSelectedIndex()]; }
public void onChange(Runnable r) { this.onChange = r; }
public void setBase(List<String> base) { for (PayloadGenerator g : generators) g.setBase(base); }
/** Raw payload count for this set, or -1 when unbounded. */
public int count() { return current().count(); }
/** Each payload as it will be sent, against what it was before the request's URL-encoding, where the two differ. */
public java.util.Map<String, String> originals() { return originals(""); }
public java.util.Map<String, String> originals(String base) {
java.util.Map<String, String> out = new java.util.HashMap<>();
for (String p : current().generate()) {
String sent = processor.process(p, base), plain = processor.processPlain(p, base);
if (sent != null && plain != null && !sent.equals(plain)) out.putIfAbsent(sent, plain);
}
return out;
}
/** Whether the payloads depend on the value of the position they go into. */
public boolean usesBase() { return processor.usesBase(); }
/** The processed payloads this set will contribute to an attack. */
public List<String> payloads() { return payloads(""); }
/** The processed payloads for a position whose own value in the request is {@code base}. */
public List<String> payloads(String base) {
List<String> raw = current().generate();
java.util.List<String> out = new java.util.ArrayList<>(raw.size());
for (String p : raw) {
String processed = processor.process(p, base);
if (processed != null) out.add(processed); // null = a skip rule dropped it
}
return out;
}
}