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.core;
import opensuite.testkit.Expect;
import opensuite.testkit.Harness;
import java.util.List;
/** A scan of several sites keeps every one of them, each with its own progress, and scans an address once. */
public final class SiteProgressTest {
public void run() {
Harness.suite("SiteProgress");
Harness.test("an address given twice is kept once, in the order given", () -> {
List<String> out = SiteProgress.withoutRepeats(List.of(
"http://testphp.example/", "http://other.example/", "http://testphp.example/", " ", "http://third.example/"));
Expect.equal(out, List.of("http://testphp.example/", "http://other.example/", "http://third.example/"), "the repeat and the blank are gone");
});
Harness.test("the same address written differently is still the same", () -> {
Expect.equal(SiteProgress.withoutRepeats(List.of("http://Site.Example", "HTTP://site.example/", "http://site.example:80/")).size(), 1,
"capitals, a closing slash and the default port");
Expect.equal(SiteProgress.withoutRepeats(List.of("https://site.example/", "https://site.example:443")).size(), 1, "the default https port");
});
Harness.test("a different scheme, port or path is a different address", () -> {
Expect.equal(SiteProgress.withoutRepeats(List.of(
"http://site.example/", "https://site.example/", "http://site.example:8080/", "http://site.example/app")).size(), 4, "all four kept");
});
Harness.test("every site is there from the start, waiting", () -> {
SiteProgress p = new SiteProgress();
p.add("http://a.example", "http://a.example/");
p.add("http://b.example", "http://b.example/");
p.add("http://a.example", "http://a.example/again");
Expect.equal(p.size(), 2, "a site is listed once");
Expect.equal(p.get("http://b.example").status(), SiteProgress.Status.WAITING, "not yet reached");
Expect.isTrue(p.several(), "a scan of several sites");
});
Harness.test("the summary lists every state with its count, and the counts add up to the sites", () -> {
SiteProgress p = new SiteProgress();
for (String h : new String[] {"a", "b", "c", "d", "e"}) p.add("http://" + h + ".example", null);
Expect.equal(p.summary(), "5 sites: 5 waiting", "none started yet");
for (String h : new String[] {"a", "b", "c", "d", "e"}) p.set("http://" + h + ".example", SiteProgress.Status.CRAWLING);
Expect.equal(p.summary(), "5 sites: 5 crawling", "all crawled together");
p.set("http://a.example", SiteProgress.Status.AUDITING);
p.set("http://b.example", SiteProgress.Status.FAILED, "refused");
p.set("http://c.example", SiteProgress.Status.FAILED, "refused");
p.set("http://e.example", SiteProgress.Status.QUEUED);
Expect.equal(p.summary(), "5 sites: 1 auditing, 1 crawling, 1 queued, 2 failed", "every site is counted once, a failed one as failed");
Expect.equal(p.summaryParts()[1], "2 failed", "what went wrong is given apart, for another colour");
p.set("http://a.example", SiteProgress.Status.FINISHED);
p.set("http://d.example", SiteProgress.Status.FINISHED);
p.set("http://e.example", SiteProgress.Status.SKIPPED);
Expect.equal(p.summary(), "5 sites: 2 finished, 1 skipped, 2 failed", "all over, each by its own word");
});
Harness.test("a scan where every site failed says so", () -> {
SiteProgress p = new SiteProgress();
p.add("http://a.example", null);
p.add("http://b.example", null);
p.set("http://a.example", SiteProgress.Status.FAILED);
p.set("http://b.example", SiteProgress.Status.FAILED);
Expect.equal(p.summary(), "2 sites: 2 failed", "nothing finished");
});
Harness.test("a scan of one site has no summary of its own", () -> {
SiteProgress p = new SiteProgress();
p.add("http://a.example", null);
p.set("http://a.example", SiteProgress.Status.CRAWLING);
Expect.equal(p.summary(), "", "the card already says what one site is doing");
});
Harness.test("a site can be skipped until it is over", () -> {
SiteProgress p = new SiteProgress();
p.add("http://a.example", null);
p.add("http://b.example", null);
p.set("http://a.example", SiteProgress.Status.FINISHED);
Expect.isTrue(!p.skip("http://a.example"), "a finished site is not skipped");
Expect.isTrue(p.skip("http://b.example"), "a waiting site is");
Expect.isTrue(p.get("http://b.example").skipAsked(), "and says so");
Expect.equal(p.get("http://b.example").status(), SiteProgress.Status.SKIPPED, "one only waiting is skipped at once");
p.add("http://c.example", null);
p.set("http://c.example", SiteProgress.Status.AUDITING);
Expect.isTrue(p.skip("http://c.example"), "one being audited can be skipped too");
Expect.equal(p.get("http://c.example").status(), SiteProgress.Status.AUDITING, "and stays as it is until the scan has stopped it");
});
Harness.test("sites are kept in a project, and none is left under way", () -> {
SiteProgress p = new SiteProgress();
p.add("http://a.example", "http://a.example/start");
p.add("http://b.example:8080", null);
p.set("http://a.example", SiteProgress.Status.FAILED, "connection\trefused");
p.locations("http://b.example:8080", 42);
p.set("http://b.example:8080", SiteProgress.Status.AUDITING);
SiteProgress q = new SiteProgress();
q.load(p.save());
Expect.equal(q.size(), 2, "both sites");
Expect.equal(q.get("http://a.example").status(), SiteProgress.Status.FAILED, "a site that was over stays as it was");
Expect.equal(q.get("http://a.example").note(), "connection refused", "with its reason");
Expect.equal(q.get("http://a.example").start(), "http://a.example/start", "and where it started");
Expect.equal(q.get("http://b.example:8080").status(), SiteProgress.Status.STOPPED, "one under way is stopped");
Expect.equal(q.get("http://b.example:8080").locations(), 42, "with what it had found");
Expect.equal(q.get("http://b.example:8080").host(), "b.example:8080", "shown without its scheme");
q.load(null);
Expect.equal(q.size(), 0, "a project saved before sites were kept has none");
});
Harness.test("a task carries its sites through a save", () -> {
ScanTask t = new ScanTask(ScanTask.Type.AUDIT, "t", "c");
t.sites().add("http://a.example", null);
t.sites().add("http://b.example", null);
t.sites().set("http://a.example", SiteProgress.Status.FINISHED);
ScanTask back = ScanTask.fromSnapshot(t.snapshot());
Expect.equal(back.sites().size(), 2, "both sites");
Expect.equal(back.sites().get("http://a.example").status(), SiteProgress.Status.FINISHED, "as they were");
});
}
}