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.report;
import opensuite.core.Bytes;
import opensuite.core.HttpMessage;
import opensuite.core.HttpService;
import opensuite.core.Issue;
import opensuite.core.LogEntry;
import opensuite.spider.Cdp.JsonValue;
import opensuite.testkit.Expect;
import opensuite.testkit.Harness;
import java.util.List;
/**
* Tests the exporters: the issue report (HTML/XML) carries and escapes the
* findings, and the traffic exports produce valid CSV and parseable HAR JSON.
*/
public final class ExportTest {
private static Issue sample() {
return Issue.builder("Reflected <XSS>")
.high().certain()
.service(new HttpService("app.example.com", 443, true))
.path("/search").param("q")
.detail("User input reflected unencoded.")
.remediation("Encode on output.")
.evidence("<script>alert(1)</script>")
.cwe(79)
.build();
}
private static LogEntry entry() {
HttpService svc = new HttpService("app.example.com", 443, true);
LogEntry e = new LogEntry("proxy", svc,
new HttpMessage(Bytes.bytes("GET /x?a=1 HTTP/1.1\r\nHost: app.example.com\r\n\r\n")));
e.setResponse(new HttpMessage(Bytes.bytes("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nContent-Length: 2\r\n\r\nhi")));
e.setDurationMillis(42);
return e;
}
public void run() {
Harness.suite("export");
Harness.test("findings at several sites are reported site by site", () -> {
Issue a1 = Issue.builder("First at A").high().certain().service(new HttpService("a.example.com", 443, true)).path("/one").build();
Issue b1 = Issue.builder("Only at B").high().certain().service(new HttpService("b.example.com", 80, false)).path("/two").build();
Issue a2 = Issue.builder("Second at A").high().certain().service(new HttpService("a.example.com", 443, true)).path("/three").build();
String html = Export.issuesHtml(List.of(a1, b1, a2));
Expect.isTrue(html.contains("<h2>Sites</h2>"), "a list of the sites first");
Expect.isTrue(html.contains(">https://a.example.com</h1>") && html.contains(">http://b.example.com</h1>"), "a heading for each site");
int first = html.indexOf("First at A"), second = html.indexOf("Second at A"), other = html.indexOf("Only at B");
Expect.isTrue(first < second && second < other, "a site's findings are together, sites in the order first seen");
});
Harness.test("findings at one site have no site headings", () -> {
String html = Export.issuesHtml(List.of(sample()));
Expect.isTrue(!html.contains("<h2>Sites</h2>"), "nothing to group");
});
Harness.test("the HTML report includes the finding and escapes markup", () -> {
String html = Export.issuesHtml(List.of(sample()));
Expect.isTrue(html.contains("Reflected <XSS>"), "title escaped");
Expect.isTrue(html.contains("CWE-79"), "cwe present");
Expect.isTrue(html.contains("Encode on output."), "remediation present");
Expect.isFalse(html.contains("<script>alert(1)</script>"), "evidence markup not left raw");
});
Harness.test("the XML report is well-formed-ish and escapes entities", () -> {
String xml = Export.issuesXml(List.of(sample()));
Expect.isTrue(xml.startsWith("<?xml"), "xml prolog");
Expect.isTrue(xml.contains("<title>Reflected <XSS></title>"), "escaped title element");
Expect.isTrue(xml.contains("<cwe>79</cwe>"), "cwe element");
});
Harness.test("traffic CSV has a header and one row per entry", () -> {
String csv = Export.trafficCsv(List.of(entry(), entry()));
String[] lines = csv.split("\n");
Expect.isTrue(lines[0].startsWith("number,time,tool,method,url"), "header");
Expect.equal(lines.length, 3, "header + two rows");
});
Harness.test("traffic HAR is valid JSON with an entries array", () -> {
String har = Export.trafficHar(List.of(entry()));
JsonValue v = JsonValue.parse(har); // throws / returns null if malformed
Expect.notNull(v, "HAR parsed as JSON");
Expect.isTrue(har.contains("\"entries\""), "has entries");
Expect.isTrue(har.contains("\"status\":200"), "response status recorded");
});
}
}