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.engine;
import opensuite.core.Bytes;
import opensuite.core.HttpMessage;
import opensuite.testkit.Expect;
import opensuite.testkit.Harness;
import java.util.Set;
/** What a scan keeps of the sites outside it: calls its own pages made, and never the engine's refusals as answers. */
public final class SeenElsewhereTest {
public void run() {
Harness.suite("seen elsewhere");
Harness.test("a call made on behalf of a page of the scan is kept", () -> {
java.util.function.Predicate<String> scan = s -> s.equals("http://app.example");
Expect.isTrue(ZapScanner.calledByScan("http://app.example/page", null, scan, Set.of()), "its Referer is a page of the scan");
Expect.isTrue(ZapScanner.calledByScan(null, "http://app.example", scan, Set.of()), "its Origin is a site of the scan");
Expect.isTrue(ZapScanner.calledByScan("https://cdn.example/lib.js", null, scan, Set.of("https://cdn.example")),
"it comes from an outside site the scan was already seen to call");
});
Harness.test("the browser's own requests are not the application's", () -> {
java.util.function.Predicate<String> scan = s -> s.equals("http://app.example");
Expect.isTrue(!ZapScanner.calledByScan(null, null, scan, Set.of()), "no Referer and no Origin: an update check, say");
Expect.isTrue(!ZapScanner.calledByScan("https://other.example/", null, scan, Set.of()), "asked for by a site the scan never called");
});
Harness.test("the engine's refusal is not taken for the site's answer", () -> {
HttpMessage refused = new HttpMessage(Bytes.bytes(
"HTTP/1.1 403 Forbidden\r\ncontent-type: text/plain\r\ncontent-length: 40\r\n\r\n(403 Forbidden) Out of AJAX Spider scope"));
HttpMessage real = new HttpMessage(Bytes.bytes(
"HTTP/1.1 403 Forbidden\r\ncontent-type: text/html\r\ncontent-length: 9\r\n\r\nForbidden"));
Expect.isTrue(ZapScanner.refusedByEngine(refused), "the engine answered in the site's place: listed as seen, not requested");
Expect.isTrue(!ZapScanner.refusedByEngine(real), "a site's own 403 is a real answer");
});
Harness.test("a page's own call is told from a link that was followed", () -> {
HttpMessage data = new HttpMessage(Bytes.bytes("GET /api/items HTTP/1.1\r\nHost: api.example\r\nAccept: */*\r\nOrigin: http://app.example\r\n\r\n"));
HttpMessage link = new HttpMessage(Bytes.bytes("GET /partner HTTP/1.1\r\nHost: other.example\r\nAccept: text/html,application/xhtml+xml\r\nUpgrade-Insecure-Requests: 1\r\n\r\n"));
HttpMessage marked = new HttpMessage(Bytes.bytes("GET /x HTTP/1.1\r\nHost: other.example\r\nAccept: */*\r\nSec-Fetch-Mode: navigate\r\n\r\n"));
HttpMessage write = new HttpMessage(Bytes.bytes("POST /api/items HTTP/1.1\r\nHost: api.example\r\nAccept: */*\r\nContent-Length: 0\r\n\r\n"));
Expect.isTrue(ZapScanner.isResourceCall(data), "data a page calls for is fetched once");
Expect.isTrue(!ZapScanner.isResourceCall(link), "a page the browser was sent to is not");
Expect.isTrue(!ZapScanner.isResourceCall(marked), "nor anything the browser marks as navigation");
Expect.isTrue(!ZapScanner.isResourceCall(write), "nor a call that changes something");
});
}
}