Skip to content

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.

1.5 KB
Raw Blame
package opensuite.oast;

import opensuite.testkit.Expect;
import opensuite.testkit.Harness;

import java.util.List;

/** Which Collaborator servers are tried: the public ones in turn, or the tester's own and no other. */
public final class CollaboratorServersTest {

    public void run() {
        Harness.suite("collaborator servers");

        Harness.test("with no server set, the public ones are tried in turn", () -> {
            List<String> tried = Collaborator.serversToTry("");
            Expect.equal(tried.get(0), Collaborator.DEFAULT_SERVER, "the usual one first");
            Expect.isTrue(tried.size() > 1, "and others after it");
            Expect.equal(Collaborator.serversToTry(null).size(), tried.size(), "nothing set is the same as blank");
        });

        Harness.test("a public server that is set goes first, the others stay behind it", () -> {
            List<String> tried = Collaborator.serversToTry("https://oast.fun/");
            Expect.equal(tried.get(0), "https://oast.fun", "the chosen one first");
            Expect.equal(tried.size(), Collaborator.PUBLIC_SERVERS.size(), "none tried twice");
        });

        Harness.test("a server of the tester's own is the only one tried", () -> {
            List<String> tried = Collaborator.serversToTry("https://oast.internal.example");
            Expect.equal(tried.size(), 1, "payloads never go to a server the tester did not choose");
            Expect.equal(tried.get(0), "https://oast.internal.example", "their server");
        });
    }
}