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
Custom scan configuration: more of its options reach the engine
scottsturrock638b32d3811d
diff --git a/src/opensuite/dashboard/ScanConfigPanel.java b/src/opensuite/dashboard/ScanConfigPanel.javaindex 8732736..f7247ec 100644--- a/src/opensuite/dashboard/ScanConfigPanel.java+++ b/src/opensuite/dashboard/ScanConfigPanel.java@@ -556,7 +556,8 @@ public final class ScanConfigPanel extends JPanel {/** The settings Custom opens with: four steps deep, 150 minutes of crawling, normal speed and accuracy. */static ScanConfig customDefaults() {ScanConfig b = ScanConfig.preset("Balanced");- return new ScanConfig("Custom", 4, 150, true, true, 0, 10, 0, "MEDIUM", "MEDIUM", b.injectableMask(), b.rpcMask(), 0, 0);+ return new ScanConfig("Custom", 4, 150, true, true, 0, 10, 0, "MEDIUM", "MEDIUM", b.injectableMask(), b.rpcMask(), 0, 0,+ new ScanConfig.Options(true, true, true, true, "", -1, -1, 1500, 0, null));}/**@@ -601,6 +602,43 @@ public final class ScanConfigPanel extends JPanel {rpcFormats = c.rpcMask();ipEntireBody.setSelected(rpcFormats != 0);put(maxScanMin, c.scanDurationMin(), true);+ ScanConfig.Options o = c.more();+ requestRobots.setSelected(o.robots());+ requestSitemap.setSelected(o.sitemap());+ hiddenLinks.setSelected(o.hiddenLinks());+ clickAll.setSelected(o.clickAll());+ customAgent.setSelected(!o.userAgent().isEmpty());+ userAgent.setText(o.userAgent());+ // The engine has one timeout: it stands in the second box, the wait for the whole request.+ crawlConnectSecs.setText("");+ crawlRequestSecs.setText(o.crawlTimeoutSecs() < 0 ? "" : String.valueOf(o.crawlTimeoutSecs()));+ connectTimeout.setText("");+ requestTimeout.setText(o.auditTimeoutSecs() < 0 ? "" : String.valueOf(o.auditTimeoutSecs()));+ put(maxLocations, o.maxLocations(), true);+ put(maxRequests, o.maxRequests(), true);+ if (o.skips() != null) {+ List<SkipRule> some = new ArrayList<>(), all = new ArrayList<>();+ for (ScanConfig.Skip s : o.skips())+ (s.allTests() ? all : some).add(new SkipRule(true, s.parameter(), "Name", s.matchType(), s.expression()));+ skipInjection.setRules(some);+ skipAll.setRules(all);+ }+ }++ /** One timeout from two boxes: the longer of what is filled in, or -1 when both are empty. */+ static int timeoutOf(JTextField connect, JTextField request) {+ return Math.max(intOf(connect, -1), intOf(request, -1));+ }++ private ScanConfig.Options options() {+ List<ScanConfig.Skip> skips = new ArrayList<>();+ for (SkipRule r : skipInjection.rules()) if (r.enabled()) skips.add(new ScanConfig.Skip(r.parameter(), r.matchType(), r.expression(), false));+ for (SkipRule r : skipAll.rules()) if (r.enabled()) skips.add(new ScanConfig.Skip(r.parameter(), r.matchType(), r.expression(), true));+ return new ScanConfig.Options(+ requestRobots.isSelected(), requestSitemap.isSelected(), hiddenLinks.isSelected(), clickAll.isSelected(),+ customAgent.isSelected() ? userAgent.getText().strip() : "",+ timeoutOf(crawlConnectSecs, crawlRequestSecs), timeoutOf(connectTimeout, requestTimeout),+ intOf(maxLocations, 0), intOf(maxRequests, 0), skips);}/** The engine configuration the controls describe. */@@ -620,7 +658,7 @@ public final class ScanConfigPanel extends JPanel {return new ScanConfig(name,intOf(maxDepth, 0), intOf(maxCrawlMin, 0), submitForms.isSelected(),dyn, intOf(jsDynamicSecs, 30) / 60, (Integer) ajaxDepth.getValue(), (Integer) ajaxStates.getValue(),- strength, threshold, inj, rpc, 0, intOf(maxScanMin, 0));+ strength, threshold, inj, rpc, 0, intOf(maxScanMin, 0), options());}/** Live passive crawl choices, for the task description. */@@ -765,6 +803,8 @@ public final class ScanConfigPanel extends JPanel {if (c == 0) { SkipRule x = rules.get(r); rules.set(r, new SkipRule(Boolean.TRUE.equals(v), x.parameter(), x.item(), x.matchType(), x.expression())); }}};+ List<SkipRule> rules() { return List.copyOf(rules); }+ void setRules(List<SkipRule> to) { rules.clear(); rules.addAll(to); model.fireTableDataChanged(); }SkipTable(List<SkipRule> initial) {super(new BorderLayout(8, 0));setOpaque(false);@@ -783,7 +823,7 @@ public final class ScanConfigPanel extends JPanel {}private SkipRule dialog(SkipRule editing) {JComboBox<String> param = Ui.combo(new String[]{"Any parameter", "URL parameter", "Body parameter", "Cookie", "HTTP header", "XML attribute", "JSON parameter"});- JComboBox<String> item = Ui.combo(new String[]{"Name", "Value"});+ JComboBox<String> item = Ui.combo(new String[]{"Name"});JComboBox<String> match = Ui.combo(new String[]{"Is", "Matches regex"});JTextField expr = Ui.field(editing == null ? "" : editing.expression());if (editing != null) { param.setSelectedItem(editing.parameter()); item.setSelectedItem(editing.item()); match.setSelectedItem(editing.matchType()); }diff --git a/src/opensuite/engine/ScanConfig.java b/src/opensuite/engine/ScanConfig.javaindex 72e345c..71a7a88 100644--- a/src/opensuite/engine/ScanConfig.java+++ b/src/opensuite/engine/ScanConfig.java@@ -29,9 +29,77 @@ public record ScanConfig(int injectableMask, // where payloads are injected (see INJECT_* bits)int rpcMask, // request-body content types tested (see RPC_* bits)int delayMs, // throttle between active-scan requests (0 = fastest)- int scanDurationMin // active-scan time backstop (0 = none; not a tier dial)+ int scanDurationMin, // active-scan time backstop (0 = none; not a tier dial)+ Options more // what a custom configuration can also set) {+ /** A configuration with the engine's usual behaviour for everything in {@link Options}. */+ public ScanConfig(String name, int crawlDepth, int crawlDurationMin, boolean submitForms, boolean ajaxSpider,+ int ajaxMaxDurationMin, int ajaxMaxDepth, int ajaxMaxStates, String attackStrength, String alertThreshold,+ int injectableMask, int rpcMask, int delayMs, int scanDurationMin) {+ this(name, crawlDepth, crawlDurationMin, submitForms, ajaxSpider, ajaxMaxDurationMin, ajaxMaxDepth, ajaxMaxStates,+ attackStrength, alertThreshold, injectableMask, rpcMask, delayMs, scanDurationMin, Options.DEFAULT);+ }++ public ScanConfig {+ if (more == null) more = Options.DEFAULT;+ }++ /** The same configuration with other options. */+ public ScanConfig with(Options o) {+ return new ScanConfig(name, crawlDepth, crawlDurationMin, submitForms, ajaxSpider, ajaxMaxDurationMin, ajaxMaxDepth, ajaxMaxStates,+ attackStrength, alertThreshold, injectableMask, rpcMask, delayMs, scanDurationMin, o);+ }++ /**+ * A parameter the audit leaves alone: where it is ("Cookie", "Body parameter", ...),+ * how its name is matched ("Is" or "Matches regex") and the name or expression.+ * {@code allTests} tells the two lists of the configuration page apart; the engine+ * has one list, and sends no payload to a parameter on it.+ */+ public record Skip(String parameter, String matchType, String expression, boolean allTests) {+ /** The engine's number for the place: -1 is anywhere. */+ public int typeId() {+ return switch (parameter == null ? "" : parameter) {+ case "URL parameter" -> 1;+ case "Body parameter" -> 2;+ case "Cookie" -> 4;+ case "HTTP header" -> 8;+ case "JSON parameter" -> 37;+ default -> -1; // any parameter; the engine has no type of its own for an XML attribute+ };+ }+ /** The name as the engine matches it: a whole-name expression, whatever the case. */+ public String regex() {+ String e = expression == null ? "" : expression.strip();+ return "(?i)" + ("Matches regex".equals(matchType) ? e : java.util.regex.Pattern.quote(e));+ }+ }++ /**+ * The settings of a custom configuration beyond the tier dials.+ * A timeout of -1 leaves the engine's own; 0 turns it off. A limit of 0 is no limit.+ * An empty User-Agent leaves the engine's own. A null list of skipped parameters leaves the engine's own list.+ */+ public record Options(+ boolean robots, // read robots.txt for addresses+ boolean sitemap, // read sitemap.xml for addresses+ boolean hiddenLinks, // follow links found in comments+ boolean clickAll, // browser crawl: click every element, not only links, buttons and inputs+ String userAgent,+ int crawlTimeoutSecs,+ int auditTimeoutSecs,+ int maxLocations, // stop a site's crawl at this many unique locations+ int maxRequests, // stop a site's crawl at this many requests+ java.util.List<Skip> skips+ ) {+ public static final Options DEFAULT = new Options(true, true, true, false, "", -1, -1, 0, 0, null);+ public Options {+ if (userAgent == null) userAgent = "";+ if (skips != null) skips = java.util.List.copyOf(skips);+ }+ }+// Injection points (ZAP ScannerParam injectable bitmask).public static final int INJECT_QUERY = 1;public static final int INJECT_BODY = 2;diff --git a/src/opensuite/engine/ScanConfigStore.java b/src/opensuite/engine/ScanConfigStore.javaindex 78b75a8..eb1140f 100644--- a/src/opensuite/engine/ScanConfigStore.java+++ b/src/opensuite/engine/ScanConfigStore.java@@ -66,6 +66,23 @@ public final class ScanConfigStore {p.setProperty("rpcMask", String.valueOf(c.rpcMask()));p.setProperty("delayMs", String.valueOf(c.delayMs()));p.setProperty("scanDurationMin", String.valueOf(c.scanDurationMin()));+ ScanConfig.Options o = c.more();+ p.setProperty("robots", String.valueOf(o.robots()));+ p.setProperty("sitemap", String.valueOf(o.sitemap()));+ p.setProperty("hiddenLinks", String.valueOf(o.hiddenLinks()));+ p.setProperty("clickAll", String.valueOf(o.clickAll()));+ p.setProperty("userAgent", o.userAgent());+ p.setProperty("crawlTimeoutSecs", String.valueOf(o.crawlTimeoutSecs()));+ p.setProperty("auditTimeoutSecs", String.valueOf(o.auditTimeoutSecs()));+ p.setProperty("maxLocations", String.valueOf(o.maxLocations()));+ p.setProperty("maxRequests", String.valueOf(o.maxRequests()));+ if (o.skips() != null) {+ p.setProperty("skips", String.valueOf(o.skips().size()));+ for (int i = 0; i < o.skips().size(); i++) {+ ScanConfig.Skip s = o.skips().get(i);+ p.setProperty("skip." + i, s.allTests() + "\t" + s.parameter() + "\t" + s.matchType() + "\t" + s.expression());+ }+ }try (OutputStream out = Files.newOutputStream(dir().resolve(fileName(name)))) {p.store(out, "Open Suite scan configuration");}@@ -91,7 +108,25 @@ public final class ScanConfigStore {num(p, "injectableMask", d.injectableMask()),num(p, "rpcMask", d.rpcMask()),num(p, "delayMs", d.delayMs()),- num(p, "scanDurationMin", d.scanDurationMin()));+ num(p, "scanDurationMin", d.scanDurationMin()),+ options(p));+ }++ private static ScanConfig.Options options(Properties p) {+ ScanConfig.Options d = ScanConfig.Options.DEFAULT;+ List<ScanConfig.Skip> skips = null;+ if (p.getProperty("skips") != null) {+ skips = new ArrayList<>();+ for (int i = 0, n = num(p, "skips", 0); i < n; i++) {+ String[] f = p.getProperty("skip." + i, "").split("\t", 4);+ if (f.length == 4) skips.add(new ScanConfig.Skip(f[1], f[2], f[3], Boolean.parseBoolean(f[0])));+ }+ }+ return new ScanConfig.Options(+ bool(p, "robots", d.robots()), bool(p, "sitemap", d.sitemap()), bool(p, "hiddenLinks", d.hiddenLinks()),+ bool(p, "clickAll", d.clickAll()), p.getProperty("userAgent", d.userAgent()),+ num(p, "crawlTimeoutSecs", d.crawlTimeoutSecs()), num(p, "auditTimeoutSecs", d.auditTimeoutSecs()),+ num(p, "maxLocations", d.maxLocations()), num(p, "maxRequests", d.maxRequests()), skips);}public static boolean delete(String name) {diff --git a/src/opensuite/engine/ZapApi.java b/src/opensuite/engine/ZapApi.javaindex c7e82b6..46f714c 100644--- a/src/opensuite/engine/ZapApi.java+++ b/src/opensuite/engine/ZapApi.java@@ -327,6 +327,62 @@ public final class ZapApi {call("ajaxSpider", "action", "setOptionLogoutAvoidance", p("Boolean", String.valueOf(on)));}+ /** Where the crawler looks for addresses besides the links of a page: robots.txt, sitemap.xml and comments. */+ public void setSpiderSources(boolean robots, boolean sitemap, boolean comments) throws Exception {+ call("spider", "action", "setOptionParseRobotsTxt", p("Boolean", String.valueOf(robots)));+ call("spider", "action", "setOptionParseSitemapXml", p("Boolean", String.valueOf(sitemap)));+ call("spider", "action", "setOptionParseComments", p("Boolean", String.valueOf(comments)));+ }++ /** Whether the browser crawl clicks every element, or only the usual ones (links, buttons, inputs). */+ public void setAjaxClickAll(boolean all) throws Exception {+ call("ajaxSpider", "action", "setOptionClickDefaultElems", p("Boolean", String.valueOf(!all)));+ }++ private String ownAgent; // the engine's User-Agent before a scan first changed it+ private String browserAgent; // the User-Agent argument its browsers were last given++ /** The User-Agent of the engine's requests and of its browsers; empty puts back the engine's own. */+ public synchronized void setUserAgent(String agent) throws Exception {+ if (ownAgent == null) ownAgent = str(call("network", "view", "getDefaultUserAgent", null), "getDefaultUserAgent");+ boolean custom = agent != null && !agent.isBlank();+ call("network", "action", "setDefaultUserAgent", p("userAgent", custom ? agent.strip() : ownAgent == null ? "" : ownAgent));+ String arg = custom ? "--user-agent=" + agent.strip() : null;+ if (java.util.Objects.equals(arg, browserAgent)) return;+ if (browserAgent != null) setBrowserArgument(browserAgent, false);+ if (arg != null) setBrowserArgument(arg, true);+ browserAgent = arg;+ }++ private int ownTimeout = -1; // the engine's timeout before a scan first changed it++ /** How long the engine waits on a connection, in seconds: 0 is for ever, and below 0 puts back the engine's own. */+ public synchronized void setTimeoutSecs(int seconds) throws Exception {+ if (ownTimeout < 0) ownTimeout = Math.max(0, intOf(call("network", "view", "getConnectionTimeout", null), "getConnectionTimeout"));+ call("network", "action", "setConnectionTimeout", p("timeout", String.valueOf(seconds < 0 ? ownTimeout : seconds)));+ }++ private List<String[]> ownSkips; // the engine's list of parameters left alone, before a scan first changed it++ /** The parameters the audit sends no payload to; null puts back the engine's own list. */+ public synchronized void setSkippedParams(List<ScanConfig.Skip> skips) throws Exception {+ List<JsonValue> now = arr(call("ascan", "view", "excludedParams", null), "excludedParams");+ if (ownSkips == null) {+ ownSkips = new java.util.ArrayList<>();+ for (JsonValue e : now) ownSkips.add(new String[]{str(e, "parameter"), str(e.get("type"), "id"), str(e, "url")});+ }+ for (int i = now.size() - 1; i >= 0; i--) call("ascan", "action", "removeExcludedParam", p("idx", String.valueOf(i)));+ if (skips == null) {+ for (String[] e : ownSkips) call("ascan", "action", "addExcludedParam", p("name", e[0], "type", e[1], "url", e[2] == null ? "*" : e[2]));+ return;+ }+ java.util.Set<String> seen = new java.util.HashSet<>();+ for (ScanConfig.Skip s : skips) {+ if (s.expression() == null || s.expression().isBlank() || !seen.add(s.typeId() + " " + s.regex())) continue;+ call("ascan", "action", "addExcludedParam", p("name", s.regex(), "type", String.valueOf(s.typeId()), "url", "*"));+ }+ }+/** Whether the crawler keeps cookies it is sent; off while a session's own cookies are forced. */public void setSpiderAcceptCookies(boolean on) throws Exception {call("spider", "action", "setOptionAcceptCookies", p("Boolean", String.valueOf(on)));diff --git a/src/opensuite/engine/ZapScanner.java b/src/opensuite/engine/ZapScanner.javaindex ace83da..d6cd40f 100644--- a/src/opensuite/engine/ZapScanner.java+++ b/src/opensuite/engine/ZapScanner.java@@ -200,6 +200,7 @@ public final class ZapScanner {api.setInjectableRpc(cfg.rpcMask());api.setActiveDelayMs(cfg.delayMs());api.setActiveMaxScanDuration(cfg.scanDurationMin());+ applyAuditOptions(cfg);} catch (Exception ignore) { /* use the engine defaults */ }}Map<String, Issue.Severity> seen = new HashMap<>();@@ -358,6 +359,10 @@ public final class ZapScanner {api.setSpiderMaxDepth(cfg.crawlDepth());api.setSpiderMaxDuration(cfg.crawlDurationMin());api.setSpiderProcessForms(cfg.submitForms());+ ScanConfig.Options o = cfg.more();+ api.setSpiderSources(o.robots(), o.sitemap(), o.hiddenLinks());+ api.setUserAgent(o.userAgent());+ api.setTimeoutSecs(o.crawlTimeoutSecs());} catch (Exception ignore) { /* use the engine defaults */ }// Everything the engine does in this job stays inside the suite scope.@@ -482,9 +487,15 @@ public final class ZapScanner {stopQuietly(() -> api.spiderStop(id));atLimit = true;}- if (st >= 100 || atLimit) {+ // The limits of a custom configuration: how many locations, and how many requests.+ String capped = null;+ if (st < 100 && !atLimit) {+ capped = crawlCap(cfg.more(), own, cfg.more().maxRequests() > 0 ? requestsTo(site) : 0);+ if (capped != null) stopQuietly(() -> api.spiderStop(id));+ }+ if (st >= 100 || atLimit || capped != null) {c.over = true;- String cut = timeLimitNote("Crawl", cfg.crawlDurationMin(), atLimit, now - c.lastNew);+ String cut = capped != null ? capped : timeLimitNote("Crawl", cfg.crawlDurationMin(), atLimit, now - c.lastNew);if (cut != null) crawlTask.log(several ? label(c.seed) + ": " + cut : cut);try { for (String u : api.spiderOutOfScope(id)) noteSkipped(u); } catch (Exception ignore) { /* the list is then shorter */ }if (several && c.lastLoc <= 0) {@@ -662,6 +673,7 @@ public final class ZapScanner {api.setInjectableRpc(cfg.rpcMask());api.setActiveDelayMs(cfg.delayMs());api.setActiveMaxScanDuration(cfg.scanDurationMin());+ applyAuditOptions(cfg);// The thread setting is the scan's: sites audited together share it.if (several && crawlThreads > 0)api.setActiveThreadPerHost(Math.max(2, crawlThreads / Math.min(total, AUDITS_AT_ONCE)));@@ -793,6 +805,27 @@ public final class ZapScanner {}/** A site as a line of the log names it: its host, with its port when that is not the usual one. */+ /** The audit's own timeout, User-Agent and list of parameters to leave alone. */+ private void applyAuditOptions(ScanConfig cfg) throws Exception {+ ScanConfig.Options o = cfg.more();+ api.setUserAgent(o.userAgent());+ api.setTimeoutSecs(o.auditTimeoutSecs());+ api.setSkippedParams(o.skips());+ }++ /** What to say when a crawl has reached a limit of its configuration, or null while it is inside them. */+ public static String crawlCap(ScanConfig.Options o, int locations, int requests) {+ if (o.maxLocations() > 0 && locations >= o.maxLocations())+ return "Crawl stopped at its limit of " + o.maxLocations() + " unique locations";+ if (o.maxRequests() > 0 && requests >= o.maxRequests())+ return "Crawl stopped at its limit of " + o.maxRequests() + " requests";+ return null;+ }++ private int requestsTo(String site) {+ try { return api.messageCount(site); } catch (Exception e) { return 0; }+ }+private static String label(Seed seed) {String url = seed.service().url();int i = url.indexOf("://");@@ -934,6 +967,8 @@ public final class ZapScanner {api.setAjaxMaxDuration(cfg.ajaxMaxDurationMin() > 0 ? cfg.ajaxMaxDurationMin() + 1 : 0);api.setAjaxMaxCrawlDepth(cfg.ajaxMaxDepth());api.setAjaxMaxCrawlStates(cfg.ajaxMaxStates());+ api.setAjaxClickAll(cfg.more().clickAll());+ api.setUserAgent(cfg.more().userAgent());} catch (Exception ignore) { /* use the engine defaults */ }// A crawl that was just stopped (a deleted scan, a time limit) is still// closing its browsers, and the engine refuses another until it has.diff --git a/tests/opensuite/dashboard/ScanWizardTest.java b/tests/opensuite/dashboard/ScanWizardTest.javaindex 2026997..d41d379 100644--- a/tests/opensuite/dashboard/ScanWizardTest.java+++ b/tests/opensuite/dashboard/ScanWizardTest.java@@ -114,6 +114,36 @@ public final class ScanWizardTest {}});+ check("the options of a custom configuration reach the engine's settings and survive saving", () -> {+ ScanConfigPanel panel = new ScanConfigPanel(ScanConfigPanel.Mode.CRAWL_AND_AUDIT);+ panel.apply(ScanConfigPanel.customDefaults());+ opensuite.engine.ScanConfig.Options o = panel.config().more();+ Expect.isTrue(o.robots() && o.sitemap() && o.hiddenLinks() && o.clickAll(), "the discovery boxes are ticked");+ Expect.equal(o.maxLocations(), 1500, "locations limit");+ Expect.equal(o.maxRequests(), 0, "an empty box is no limit");+ Expect.equal(o.crawlTimeoutSecs(), -1, "an empty timeout leaves the engine's own");+ Expect.equal(o.userAgent(), "", "no User-Agent of its own");+ Expect.isTrue(o.skips() != null && !o.skips().isEmpty(), "the parameter lists are sent");+ javax.swing.JTextField a = new javax.swing.JTextField(""), b = new javax.swing.JTextField("0");+ Expect.equal(ScanConfigPanel.timeoutOf(a, b), 0, "0 turns the timeout off");+ b.setText("45"); a.setText("10");+ Expect.equal(ScanConfigPanel.timeoutOf(a, b), 45, "the longer of the two");++ opensuite.engine.ScanConfig.Skip is = new opensuite.engine.ScanConfig.Skip("Cookie", "Is", "asp.net_sessionid", false);+ Expect.equal(is.typeId(), 4, "a cookie");+ Expect.isTrue(java.util.regex.Pattern.matches(is.regex(), "ASP.NET_SessionId"), "a plain name matches whatever its case");+ Expect.isTrue(!java.util.regex.Pattern.matches(is.regex(), "aspXnet_sessionid"), "and its dot is a dot");+ opensuite.engine.ScanConfig.Skip re = new opensuite.engine.ScanConfig.Skip("XML attribute", "Matches regex", "xmlns.*", true);+ Expect.equal(re.typeId(), -1, "an XML attribute is matched anywhere");+ Expect.isTrue(java.util.regex.Pattern.matches(re.regex(), "xmlns:soap"), "an expression matches");++ opensuite.engine.ScanConfig.Options lim = new opensuite.engine.ScanConfig.Options(true, true, true, false, "", -1, -1, 100, 500, null);+ Expect.isTrue(opensuite.engine.ZapScanner.crawlCap(lim, 99, 499) == null, "inside both limits");+ Expect.isTrue(opensuite.engine.ZapScanner.crawlCap(lim, 100, 0).contains("100 unique locations"), "at the locations limit");+ Expect.isTrue(opensuite.engine.ZapScanner.crawlCap(lim, 5, 500).contains("500 requests"), "at the requests limit");+ Expect.isTrue(opensuite.engine.ZapScanner.crawlCap(opensuite.engine.ScanConfig.Options.DEFAULT, 99999, 99999) == null, "no limits set");+ });+check("the wizard itself can be constructed", () -> {SuiteContext ctx = new SuiteContext();NewScanWizard w = new NewScanWizard(ctx, null);diff --git a/tests/opensuite/engine/ScanConfigStoreTest.java b/tests/opensuite/engine/ScanConfigStoreTest.javaindex 6311e5a..22bc810 100644--- a/tests/opensuite/engine/ScanConfigStoreTest.java+++ b/tests/opensuite/engine/ScanConfigStoreTest.java@@ -30,6 +30,16 @@ public final class ScanConfigStoreTest {catch (Exception e) { throw new RuntimeException(e); }System.setProperty("user.home", tmp.toString());try {+ Harness.test("the options of a custom configuration are saved with it", () -> {+ ScanConfig.Options o = new ScanConfig.Options(false, true, false, true, "Probe/1.0 (test)", 0, 45, 1500, 20000,+ java.util.List.of(new ScanConfig.Skip("Cookie", "Is", "asp.net_sessionid", false),+ new ScanConfig.Skip("XML attribute", "Matches regex", "xmlns.*", true)));+ save("With options", ScanConfig.preset("Fast").with(o));+ Expect.equal(load("With options").more(), o, "every option, and both lists of parameters");+ save("Plain", ScanConfig.preset("Fast"));+ Expect.equal(load("Plain").more(), ScanConfig.Options.DEFAULT, "a configuration without them keeps the engine's own");+ });+Harness.test("a saved configuration loads back with every value intact", () -> {ScanConfig c = new ScanConfig("mine", 7, 15, false, true, 20, 4, 300,"HIGH", "LOW", ScanConfig.INJECT_QUERY | ScanConfig.INJECT_COOKIE,