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.proxy;
import opensuite.core.Bytes;
import opensuite.core.HttpMessage;
import opensuite.core.HttpService;
import opensuite.testkit.Expect;
import opensuite.testkit.Harness;
import java.util.ArrayList;
import java.util.List;
/** Tests the proxy "Don't intercept requests" quick rules. */
public final class InterceptExclusionTest {
private static final HttpService SVC = new HttpService("shop.test", 443, true);
private static HttpMessage req(String target) {
return new HttpMessage(Bytes.bytes("GET " + target + " HTTP/1.1\r\nHost: shop.test\r\n\r\n"));
}
public void run() {
Harness.suite("intercept exclusion");
Harness.test("a host rule excludes only that host and is added as an AND clause", () -> {
ProxyRule r = InterceptExclusion.rule(InterceptExclusion.Kind.HOST, SVC, req("/a"));
Expect.equal(r.matchItem, "domain name", "matches on the domain");
Expect.equal(r.booleanOp, "and", "folded as an AND clause");
Expect.equal(r.relationship, "does not match", "negated");
Expect.isFalse(r.test(SVC, req("/a"), null, "", false, false, null), "the request's own host is excluded");
Expect.isTrue(r.test(new HttpService("other.test", 443, true), req("/a"), null, "", false, false, null),
"a different host is still intercepted");
});
Harness.test("an extension rule matches the extension exactly and only when there is one", () -> {
Expect.isFalse(InterceptExclusion.applies(InterceptExclusion.Kind.EXTENSION, req("/page")), "no extension");
Expect.isNull(InterceptExclusion.rule(InterceptExclusion.Kind.EXTENSION, SVC, req("/page")), "no rule without one");
ProxyRule r = InterceptExclusion.rule(InterceptExclusion.Kind.EXTENSION, SVC, req("/app.js"));
Expect.isFalse(r.test(SVC, req("/x.js"), null, "", false, false, null), "a .js request is excluded");
Expect.isTrue(r.test(SVC, req("/x.json"), null, "", false, false, null), "a .json request is not");
});
Harness.test("a directory rule covers the folder and below but not a sibling", () -> {
ProxyRule r = InterceptExclusion.rule(InterceptExclusion.Kind.DIRECTORY, SVC, req("/admin/users?id=1"));
Expect.equal(InterceptExclusion.directory(req("/admin/users?id=1")), "/admin/", "directory of the target");
Expect.isFalse(r.test(SVC, req("/admin/roles"), null, "", false, false, null), "a file in the folder is excluded");
Expect.isTrue(r.test(SVC, req("/administrator"), null, "", false, false, null), "a sibling is not excluded");
});
Harness.test("adding to the chain skips a rule already present", () -> {
List<ProxyRule> chain = new ArrayList<>();
Expect.isTrue(InterceptExclusion.add(chain, InterceptExclusion.Kind.HOST, SVC, req("/a")), "added");
Expect.isFalse(InterceptExclusion.add(chain, InterceptExclusion.Kind.HOST, SVC, req("/b")), "same host, not added twice");
Expect.equal(chain.size(), 1, "one rule");
});
}
}