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.testkit.Expect;
import opensuite.testkit.Harness;
import java.util.List;
import java.util.Set;
/** The report: what is included, how messages are cut down, and what is marked. */
public final class ReportTest {
private static Issue issue(String title, Issue.Severity s, String path, String evidence) {
String body = "x".repeat(2000) + " before " + evidence + " after " + "y".repeat(2000);
return Issue.builder(title).severity(s).certain().service(HttpService.parse("http://app.example/")).path(path)
.detail("Detail of " + title).background("Background of " + title).remediation("Fix " + title)
.references("https://example.org/ref").cwe(79).tags("OWASP_2021_A03").evidence(evidence)
.request(new HttpMessage(Bytes.bytes("GET " + path + " HTTP/1.1\r\nHost: app.example\r\n\r\n")))
.response(new HttpMessage(Bytes.bytes("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n" + body))).build();
}
public void run() {
Harness.suite("report");
Harness.test("it has a summary, contents, and each issue with its parts", () -> {
String html = Report.html(List.of(issue("SQL injection", Issue.Severity.HIGH, "/a", "syntax error"),
issue("SQL injection", Issue.Severity.HIGH, "/b", "syntax error"),
issue("Cookie without flag", Issue.Severity.LOW, "/", "Set-Cookie")), new Report.Options());
for (String part : new String[]{">Summary<", ">Contents<", "1. SQL injection", "There are 2 instances of this issue", "Issue background",
"Issue remediation", "References", "Vulnerability classifications", "CWE-79: Improper", "OWASP Top 10 A03:2021 Injection",
">Issue detail<", ">Request<", ">Response<", "<mark>syntax error</mark>", "...[SNIP]..."}) {
Expect.isTrue(html.contains(part), "the report has: " + part);
}
Expect.isTrue(!html.contains("x".repeat(600)), "the relevant extract leaves most of a long body out");
Expect.isTrue(!html.contains("src=\"http") && !html.contains("<script"), "one self-contained file");
});
Harness.test("the choices decide what is left out", () -> {
Issue real = issue("SQL injection", Issue.Severity.HIGH, "/a", "syntax error");
Issue wrong = issue("Cookie without flag", Issue.Severity.LOW, "/", "Set-Cookie");
wrong.setFalsePositive(true);
Report.Options o = new Report.Options();
Expect.equal(Report.chosen(List.of(real, wrong), o).size(), 1, "false positives are left out unless asked for");
o.falsePositives = true;
Expect.equal(Report.chosen(List.of(real, wrong), o).size(), 2, "and included when asked for");
o.types = Set.of("Cookie without flag");
Expect.equal(Report.chosen(List.of(real, wrong), o).size(), 1, "an unticked type is left out");
o = new Report.Options();
o.background = false; o.classifications = false; o.requests = Report.Messages.NONE; o.responses = Report.Messages.FULL; o.responseLimit = 100;
String html = Report.html(List.of(real), o);
Expect.isTrue(!html.contains("Issue background") && !html.contains("Vulnerability classifications") && !html.contains(">Request<"), "unticked parts are gone");
Expect.isTrue(html.contains(">Response<") && !html.contains("x".repeat(200)), "the response is cut at the limit");
});
Harness.test("issue data as XML carries the messages, Base64-encoded when asked", () -> {
Report.Options o = new Report.Options();
String xml = Report.xml(List.of(issue("SQL injection", Issue.Severity.HIGH, "/a", "syntax error")), o);
Expect.isTrue(xml.contains("<name>SQL injection</name>") && xml.contains("<request base64=\"true\">R0VUIC9h"), "encoded request");
o.base64 = false;
Expect.isTrue(Report.xml(List.of(issue("x", Issue.Severity.LOW, "/a", "e")), o).contains("<request base64=\"false\">GET /a HTTP/1.1"), "plain request");
});
}
}