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.target;
import opensuite.core.Bytes;
import opensuite.core.HttpMessage;
import opensuite.core.HttpService;
import opensuite.core.LogEntry;
import opensuite.testkit.Expect;
import opensuite.testkit.Harness;
import java.util.List;
/** Comparing two site maps, and taking items out of one. */
public final class SiteMapDiffTest {
private static LogEntry item(String method, String path, int status, String body) {
HttpService s = HttpService.parse("http://app.example/");
LogEntry e = new LogEntry("proxy", s, new HttpMessage(Bytes.bytes(method + " " + path + " HTTP/1.1\r\nHost: app.example\r\n\r\n")));
e.setResponse(new HttpMessage(Bytes.bytes("HTTP/1.1 " + status + " X\r\nContent-Length: " + body.length() + "\r\n\r\n" + body)));
return e;
}
public void run() {
Harness.suite("site map comparison");
Harness.test("items are the same, modified, deleted or added", () -> {
List<LogEntry> one = List.of(item("GET", "/", 200, "home"), item("GET", "/admin", 200, "panel"), item("GET", "/old", 200, "x"));
List<LogEntry> two = List.of(item("GET", "/", 200, "home"), item("GET", "/admin", 403, "no"), item("GET", "/new", 200, "y"));
int[] n = SiteMapDiff.counts(SiteMapDiff.compare(one, two, new SiteMapDiff.Options()));
Expect.equal(n[SiteMapDiff.State.SAME.ordinal()], 1, "the home page did not change");
Expect.equal(n[SiteMapDiff.State.MODIFIED.ordinal()], 1, "the admin page answers differently");
Expect.equal(n[SiteMapDiff.State.DELETED.ordinal()], 1, "only in the first map");
Expect.equal(n[SiteMapDiff.State.ADDED.ordinal()], 1, "only in the second map");
});
Harness.test("the choices decide what matches and what differs", () -> {
SiteMapDiff.Options o = new SiteMapDiff.Options();
List<LogEntry> one = List.of(item("GET", "/p?id=1", 200, "a b"));
List<LogEntry> two = List.of(item("GET", "/p?id=2", 200, "a b"));
Expect.equal(SiteMapDiff.counts(SiteMapDiff.compare(one, two, o))[SiteMapDiff.State.SAME.ordinal()], 0, "the query is part of the match");
o.matchQuery = false;
Expect.equal(SiteMapDiff.counts(SiteMapDiff.compare(one, two, o))[SiteMapDiff.State.SAME.ordinal()], 1, "matched on the path; white space ignored");
o.ignoreWhitespace = false;
Expect.equal(SiteMapDiff.counts(SiteMapDiff.compare(one, two, o))[SiteMapDiff.State.MODIFIED.ordinal()], 1, "white space now counts");
});
Harness.test("deleting a folder takes its items and leaves the rest", () -> {
SiteMap m = new SiteMap();
m.add(item("GET", "/", 200, "h"));
m.add(item("GET", "/a/one", 200, "1"));
m.add(item("GET", "/a/two", 200, "2"));
m.add(item("GET", "/b", 200, "b"));
SiteMap.Node host = m.root().children.values().iterator().next();
Expect.equal(host.entries().size(), 4, "four items to begin with");
Expect.isTrue(m.remove(host.children.get("a")), "the folder was in the map");
Expect.equal(host.entries().size(), 2, "the two under the folder are gone");
Expect.isTrue(!host.children.containsKey("a") && host.children.containsKey("b"), "its neighbour stays");
Expect.isTrue(m.remove(host) && m.root().children.isEmpty(), "a host goes whole");
LogEntry old = item("GET", "/gone", 200, "g");
old.setOffSiteMap(true);
m.add(old);
Expect.isTrue(m.root().children.isEmpty(), "an item the user deleted stays out when the project is read again");
m.add(item("GET", "/gone", 200, "g"));
Expect.equal(m.root().children.size(), 1, "the same address requested afresh is a new item and returns");
});
}
}