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.

New scan: custom configuration laid out as the reference has it

scottsturrocka70ca566c20b
diff --git a/src/opensuite/dashboard/ScanConfigPanel.java b/src/opensuite/dashboard/ScanConfigPanel.java
index a440068..8732736 100644
--- a/src/opensuite/dashboard/ScanConfigPanel.java
+++ b/src/opensuite/dashboard/ScanConfigPanel.java
@@ -48,32 +48,48 @@ public final class ScanConfigPanel extends JPanel {
private final JPanel pages = new JPanel(pageCards);
private final Map<String, JComponent> pageByName = new LinkedHashMap<>();
- // ---- Crawl optimization
+ // ---- Crawl behaviour
+ private final JTextField maxDepth = num("4", 126);
private final JComboBox<String> crawlStrategy = Ui.combo(new String[]{"Fastest", "Faster", "Normal", "More complete", "Most complete"});
+ private final JLabel strategyNote = Ui.label("");
+ private final JTextField maxCrawlMin = num("150", 74);
+ private final JTextField maxLocations = num("1500", 74);
+ private final JTextField maxRequests = num("", 74);
+ private final JTextField crawlConnectSecs = num("", 86);
+ private final JTextField crawlRequestSecs = num("", 86);
+ private final JTextField crawlTimeouts = num("15", 62);
+ private final JTextField crawlTimeoutPct = num("", 62);
+ private final JTextField crawlAuthFailures = num("2", 62);
+ private final JTextField crawlRetries = num("1", 82);
+ // Advanced crawl settings, behind the button.
private final JComboBox<String> crawlSpeed = Ui.combo(new String[]{"Fast", "Normal", "Slow"});
- private final JCheckBox submitForms = Ui.check("Submit forms while crawling", true);
- private final JCheckBox crawlDynamic = Ui.check("Use dynamic analysis (drive a browser to crawl JavaScript applications)", true);
- // ---- Crawl limits
- private final JSpinner maxDepth = spin(10, 0, 100, 1);
- private final JSpinner maxCrawlMin = spin(0, 0, 1440, 5);
- private final JSpinner maxLocations = spin(0, 0, 100000, 100);
- private final JSpinner maxRequests = spin(0, 0, 1000000, 1000);
private final JSpinner ajaxDepth = spin(10, 0, 100, 1);
private final JSpinner ajaxStates = spin(0, 0, 10000, 10);
- // ---- Login functions
- private final JCheckBox selfRegister = Ui.check("Attempt to self-register a user", true);
- private final JCheckBox triggerFailures = Ui.check("Trigger login failures", true);
- private final JCheckBox useRecorded = Ui.check("Use recorded login sequences", false);
- // ---- Handling application errors during crawl
- private final JSpinner crawlTimeouts = spin(2, 1, 100, 1);
- private final JSpinner crawlErrors = spin(5, 1, 100, 1);
- private final JSpinner crawlErrorPct = spin(50, 0, 100, 5);
- private final JSpinner crawlRetries = spin(1, 0, 10, 1);
- // ---- Crawl project option overrides
- private final JCheckBox overrideProject = Ui.check("Override project settings for this crawl", false);
- private final JCheckBox ovFollowRedirects = Ui.check("Follow redirections", true);
- private final JCheckBox ovKeepAlive = Ui.check("Use HTTP/1 keep-alive", true);
- private final JCheckBox ovHttp2 = Ui.check("Default to HTTP/2 if the server supports it", true);
+ // ---- Login behaviour
+ private final JCheckBox authenticatedOnly = Ui.check("Only perform an authenticated crawl using the provided credentials", false);
+ private final JCheckBox selfRegister = Ui.check("Try to self-register a user", true);
+ private final JCheckBox triggerFailures = Ui.check("Use invalid usernames to trigger login failures", true);
+ // ---- API crawling
+ private final JCheckBox apiDefinitions = Ui.check("Parse API definitions", true);
+ private final JCheckBox apiWsdl = Ui.check("Parse SOAP WSDL definitions", true);
+ private final JCheckBox apiGraphql = Ui.check("Perform GraphQL introspection", true);
+ private final JCheckBox apiGraphqlCommon = Ui.check("Test common GraphQL endpoints", false);
+ // ---- Browser behaviour
+ private final JComboBox<String> browserUse = Ui.combo(new String[]{"Use if my hardware appears to support it", "Always", "Never"});
+ private final JCheckBox customAgent = Ui.check("Customize User-Agent header", false);
+ private final JTextField userAgent = num("", 358);
+ private final JCheckBox fetchOutOfScope = Ui.check("Fetch required resources and data from out-of-scope hosts", true);
+ private final JTextField resourceTimeout = num("10", 280);
+ // ---- Discovery logic
+ private final JCheckBox submitForms = Ui.check("Submit forms", true);
+ private final JCheckBox requestRobots = Ui.check("Request robots.txt", true);
+ private final JCheckBox requestSitemap = Ui.check("Request site map", true);
+ private final JTextField sitemapItems = num("1000", 134);
+ private final JCheckBox hiddenLinks = Ui.check("Follow hidden links in comments and JavaScript", true);
+ private final JTextField hiddenLinkCount = num("1000", 134);
+ private final JCheckBox clickAll = Ui.check("Click all clickable elements", true);
+ private final JCheckBox clickPointer = Ui.check("Click all pointer clickable elements", false);
+ private final JComboBox<String> fragments = Ui.combo(new String[]{"Unsure", "Yes", "No"});
// ---- Audit behaviour
private final JComboBox<String> auditSpeed = Ui.combo(new String[]{"Fast", "Normal", "Thorough"});
private final JComboBox<String> auditAccuracy = Ui.combo(new String[]{"Minimize false negatives", "Normal", "Minimize false positives"});
@@ -81,39 +97,39 @@ public final class ScanConfigPanel extends JPanel {
private final JCheckBox maintainSession = Ui.check("Automatically maintain session (doesn't apply to audit-only scans)", true);
private final JCheckBox followRedirects = Ui.check("Follow redirections when necessary", true);
private final JCheckBox parallelPhases = Ui.check("Allow crawl and audit phases to run in parallel", true);
- private final JSpinner maxScanMin = spin(0, 0, 10080, 10);
+ private final JTextField maxScanMin = num("", 86);
private final JCheckBox consolidatePassive = Ui.check("Consolidate frequently occurring passive issues", true);
- private final JSpinner connectTimeout = spin(10, 1, 600, 1);
- private final JSpinner requestTimeout = spin(120, 1, 3600, 10);
- private final JSpinner failChecks = spin(2, 1, 100, 1);
- private final JSpinner failPoints = spin(2, 1, 100, 1);
- private final JSpinner failItems = spin(60, 1, 10000, 10);
- private final JCheckBox failPctOn = Ui.check("", false);
- private final JSpinner failPct = spin(10, 0, 100, 5);
- private final JSpinner followUpPasses = spin(1, 0, 10, 1);
+ private final JTextField connectTimeout = num("", 86);
+ private final JTextField requestTimeout = num("", 86);
+ private final JTextField failChecks = num("2", 62);
+ private final JTextField failPoints = num("2", 62);
+ private final JTextField failItems = num("60", 62);
+ private final JTextField failPct = num("", 62);
+ private final JTextField followUpPasses = num("1", 62);
// ---- JavaScript analysis
private final JCheckBox jsDynamic = Ui.check("Use dynamic analysis techniques", true);
private final JCheckBox jsStatic = Ui.check("Use static analysis techniques", false);
private final JCheckBox jsMissing = Ui.check("Make requests for missing site resources", true);
private final JCheckBox jsOutOfScope = Ui.check("Fetch previously undiscovered resources and data from out-of-scope hosts", true);
- private final JSpinner jsDynamicSecs = spin(30, 1, 3600, 5);
- private final JSpinner jsStaticSecs = spin(30, 1, 3600, 5);
+ private final JTextField jsDynamicSecs = num("30", 110);
+ private final JTextField jsStaticSecs = num("30", 110);
// ---- Insertion points
- private final JCheckBox ipQuery = Ui.check("URL parameter values", true);
- private final JCheckBox ipBody = Ui.check("Body parameter values", true);
- private final JCheckBox ipCookie = Ui.check("Cookie parameter values", true);
- private final JCheckBox ipName = Ui.check("Parameter name", true);
- private final JCheckBox ipHeaders = Ui.check("HTTP headers", true);
- private final JCheckBox ipEntireBody = Ui.check("Entire body (for relevant content types)", true);
- private final JCheckBox ipFilename = Ui.check("URL path filename", true);
- private final JCheckBox ipFolders = Ui.check("URL path folders", true);
- private final JCheckBox rpcMultipart = Ui.check("Multipart", true);
- private final JCheckBox rpcXml = Ui.check("XML", true);
- private final JCheckBox rpcJson = Ui.check("JSON", true);
- private final JCheckBox rpcGwt = Ui.check("GWT", true);
- private final JCheckBox rpcOdata = Ui.check("OData", true);
+ private static final String[] POINT_TYPES = {"URL parameter values", "Body parameter values", "Cookie parameter values",
+ "Parameter name", "HTTP headers", "Entire body (for relevant content types)", "URL path filename", "URL path folders"};
+ private final JCheckBox ipQuery = Ui.check(POINT_TYPES[0], true);
+ private final JCheckBox ipBody = Ui.check(POINT_TYPES[1], true);
+ private final JCheckBox ipCookie = Ui.check(POINT_TYPES[2], true);
+ private final JCheckBox ipName = Ui.check(POINT_TYPES[3], true);
+ private final JCheckBox ipHeaders = Ui.check(POINT_TYPES[4], true);
+ private final JCheckBox ipEntireBody = Ui.check(POINT_TYPES[5], true);
+ private final JCheckBox ipFilename = Ui.check(POINT_TYPES[6], true);
+ private final JCheckBox ipFolders = Ui.check(POINT_TYPES[7], true);
+ private final JCheckBox[] frequent = new JCheckBox[POINT_TYPES.length];
+ /** The structured body formats the entire-body insertion point covers; a loaded configuration can narrow them. */
+ private int rpcFormats = ScanConfig.RPC_MULTIPART | ScanConfig.RPC_XML | ScanConfig.RPC_JSON | ScanConfig.RPC_GWT | ScanConfig.RPC_ODATA;
private final JCheckBox nested = Ui.check("Use nested insertion points", true);
- private final JSpinner maxPoints = spin(30, 1, 1000, 5);
+ private final JCheckBox arrayPoints = Ui.check("Create insertion points for all array elements", false);
+ private final JTextField maxPoints = num("30", 74);
private final JCheckBox[] relocate = {
Ui.check("URL to body", false), Ui.check("URL to cookie", false), Ui.check("Body to URL", false),
Ui.check("Body to cookie", false), Ui.check("Cookie to URL", false), Ui.check("Cookie to body", false)};
@@ -190,11 +206,11 @@ public final class ScanConfigPanel extends JPanel {
} else {
if (mode != Mode.AUDIT) {
DefaultMutableTreeNode crawl = node(root, "Crawl configuration");
- leaf(crawl, "Crawl optimization", crawlOptimizationPage());
- leaf(crawl, "Crawl limits", crawlLimitsPage());
- leaf(crawl, "Login functions", loginFunctionsPage());
- leaf(crawl, "Handling application errors during crawl", crawlErrorsPage());
- leaf(crawl, "Crawl project option overrides", crawlOverridesPage());
+ leaf(crawl, "Crawl behaviour", crawlBehaviourPage());
+ leaf(crawl, "Login behaviour", loginBehaviourPage());
+ leaf(crawl, "API crawling", apiCrawlingPage());
+ leaf(crawl, "Browser behaviour", browserBehaviourPage());
+ leaf(crawl, "Discovery logic", discoveryLogicPage());
}
if (mode != Mode.CRAWL) {
DefaultMutableTreeNode audit = node(root, "Audit configuration");
@@ -204,10 +220,16 @@ public final class ScanConfigPanel extends JPanel {
leaf(audit, "Insertion points strategy", insertionPointsPage());
}
}
- JTree tree = new JTree(new DefaultTreeModel(root));
+ // The page list: plain names, no icons, the chosen one on a rounded band.
+ opensuite.ui.RowTree tree = new opensuite.ui.RowTree(new DefaultTreeModel(root));
tree.setRootVisible(false);
tree.setShowsRootHandles(true);
- tree.setFont(Ui.PLAIN);
+ tree.setRowHeight(28);
+ tree.setBand(2, 2);
+ tree.setBorder(Ui.pad(2, 6, 2, 2));
+ javax.swing.tree.DefaultTreeCellRenderer names = new javax.swing.tree.DefaultTreeCellRenderer();
+ names.setLeafIcon(null); names.setOpenIcon(null); names.setClosedIcon(null);
+ tree.setCellRenderer(names);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
for (int i = 0; i < tree.getRowCount(); i++) tree.expandRow(i);
tree.addTreeSelectionListener(e -> {
@@ -215,10 +237,15 @@ public final class ScanConfigPanel extends JPanel {
if (o instanceof DefaultMutableTreeNode n && pageByName.containsKey(String.valueOf(n.getUserObject())))
pageCards.show(pages, String.valueOf(n.getUserObject()));
});
- JScrollPane ts = Ui.scroll(tree);
- ts.setPreferredSize(new Dimension(250, 10));
+ JScrollPane ts = new JScrollPane(tree);
+ ts.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, Ui.GRID));
+ ts.getViewport().setBackground(Theme.BG);
+ ts.setPreferredSize(new Dimension(mode == Mode.PASSIVE_CRAWL ? 250 : 300, 10));
pages.setOpaque(false);
+ // One box holds the list and the page, with a line between them.
+ custom.setLayout(new BorderLayout());
custom.setOpaque(false);
+ custom.setBorder(BorderFactory.createLineBorder(Ui.GRID));
custom.add(ts, BorderLayout.WEST);
custom.add(pages, BorderLayout.CENTER);
add(custom, BorderLayout.CENTER);
@@ -251,63 +278,154 @@ public final class ScanConfigPanel extends JPanel {
return s;
}
+ /** A plain box for a number, as the reference has them: no arrows, and empty where a limit is not set. */
+ private static JTextField num(String value, int width) {
+ JTextField f = Ui.field(value);
+ f.setColumns(0);
+ f.setPreferredSize(new Dimension(width + 4 * Ui.fontGrowth(), Ui.tall(24)));
+ return f;
+ }
+
+ /** The whole number in a box, or {@code blank} when it is empty or is not one. */
+ static int intOf(JTextField f, int blank) {
+ try { return Math.max(0, Integer.parseInt(f.getText().strip())); }
+ catch (NumberFormatException e) { return blank; }
+ }
+
+ private static void put(JTextField f, int value, boolean zeroIsBlank) {
+ f.setText(value == 0 && zeroIsBlank ? "" : String.valueOf(value));
+ }
+
private static JPanel row(Component... c) { return Ui.row(c); }
+ private static JTextArea para(String s) { return opensuite.ui.Sections.text(s); }
+
+ /** Words that follow a box, in the case they are written: Ui.label would start them with a capital. */
+ private static JLabel plain(String s) {
+ JLabel l = new JLabel(s);
+ l.setFont(Ui.PLAIN);
+ l.setForeground(Theme.TEXT);
+ return l;
+ }
+
// ---- pages ----
- private JComponent crawlOptimizationPage() {
+ private static final Map<String, String> STRATEGY_NOTES = Map.of(
+ "Fastest", "This strategy is the quickest. It suits applications whose pages are reached by plain links and hold no state.",
+ "Faster", "This strategy favours speed over coverage, and suits simple applications.",
+ "Normal", "This strategy represents a trade-off between coverage and speed that is appropriate for typical applications.",
+ "More complete", "This strategy favours coverage over speed, and suits applications with more state or more complex navigation.",
+ "Most complete", "This strategy gives the fullest coverage and takes the longest. It suits applications where the same address can show different content.");
+
+ private JComponent crawlBehaviourPage() {
OptionsPage p = new OptionsPage();
- p.section("Crawl optimization",
- Ui.note("Controls how thoroughly and how quickly the crawler explores the site."),
- OptionsPage.labelRow("Crawl strategy:", crawlStrategy),
- OptionsPage.labelRow("Crawl speed:", crawlSpeed),
- submitForms, crawlDynamic);
crawlStrategy.setSelectedItem("Normal");
crawlSpeed.setSelectedItem("Normal");
+ Ui.sized(crawlStrategy, 126);
+ Runnable note = () -> strategyNote.setText(STRATEGY_NOTES.getOrDefault(String.valueOf(crawlStrategy.getSelectedItem()), ""));
+ crawlStrategy.addActionListener(e -> note.run());
+ note.run();
+ JButton advanced = Ui.button("View advanced settings", "Crawl speed and the limits of the browser's exploring");
+ advanced.addActionListener(e -> JOptionPane.showMessageDialog(this,
+ Ui.form("Crawl speed:", Ui.natural(crawlSpeed), "Maximum click depth:", Ui.natural(ajaxDepth), "Maximum page states explored (0 for no limit):", Ui.natural(ajaxStates)),
+ "Advanced crawl settings", JOptionPane.PLAIN_MESSAGE));
+ JLabel depthLabel = Ui.label("Maximum crawl depth:"), strategyLabel = Ui.label("Crawl strategy:");
+ strategyLabel.setPreferredSize(depthLabel.getPreferredSize());
+ p.section("Crawl strategy",
+ Ui.note("Choose a strategy and crawl depth to balance crawl coverage and speed based on your application's structure."),
+ row(depthLabel, maxDepth, plain("steps from start URL")),
+ row(strategyLabel, crawlStrategy),
+ OptionsPage.indent(strategyNote, depthLabel.getPreferredSize().width + 5),
+ Box.createVerticalStrut(4),
+ row(advanced),
+ para("We recommend that you only change the advanced settings when an application needs it."));
+ p.section("Crawl limits",
+ Ui.note("Control how long Open Suite crawls your site and how much content it explores. Unique content is found early, so limits help reduce scan time and overhead."),
+ para("To disable a limit, leave it blank."),
+ Box.createVerticalStrut(3),
+ OptionsPage.fieldRow("Maximum crawl time:", maxCrawlMin, "minutes"),
+ OptionsPage.fieldRow("Maximum unique locations discovered:", maxLocations, ""),
+ OptionsPage.fieldRow("Maximum request count:", maxRequests, ""),
+ para("These settings only impact the crawl phase. For crawl and audit scans, you can also set an overall scan time. The scan stops when this limit is reached, even if crawling or auditing is in progress. Configure this under Audit behaviour > Total scan time."));
+ p.section("Crawl network timeouts",
+ Ui.note("Set time limits for network tasks during the crawl. These override your global timeouts under Settings > Network > Connections > Timeouts."),
+ para("To turn off a timeout, set it to 0. To use your global settings, leave blank."),
+ Box.createVerticalStrut(3),
+ OptionsPage.fieldRow("Maximum wait to establish a connection:", crawlConnectSecs, "seconds"),
+ OptionsPage.fieldRow("Maximum wait to complete the request after connecting:", crawlRequestSecs, "seconds"));
+ p.section("Handling repeated timeouts during crawl",
+ Ui.note("Control how Open Suite responds to repeated request timeouts during the crawl."),
+ para("Pause the crawl if:"),
+ Box.createVerticalStrut(3),
+ OptionsPage.indent(row(crawlTimeouts, plain("consecutive requests time out")), 5),
+ OptionsPage.indent(row(crawlTimeoutPct, plain("% of all requests time out")), 5),
+ OptionsPage.indent(row(crawlAuthFailures, plain("consecutive authentication failures")), 5),
+ Box.createVerticalStrut(4),
+ row(Ui.label("After the crawl, do"), crawlRetries, plain("follow-up passes to retry requests that timed out.")));
return p;
}
- private JComponent crawlLimitsPage() {
+ private JComponent loginBehaviourPage() {
OptionsPage p = new OptionsPage();
- p.section("Crawl limits",
- Ui.note("Stop the crawl when any of these limits is reached. 0 means no limit."),
- OptionsPage.fieldRow("Maximum link depth:", asField(maxDepth), ""),
- OptionsPage.fieldRow("Maximum crawl time:", asField(maxCrawlMin), "minutes"),
- OptionsPage.fieldRow("Maximum unique locations discovered:", asField(maxLocations), ""),
- OptionsPage.fieldRow("Maximum request count:", asField(maxRequests), ""));
- p.section("Dynamic analysis limits",
- OptionsPage.fieldRow("Maximum click depth:", asField(ajaxDepth), ""),
- OptionsPage.fieldRow("Maximum UI states explored:", asField(ajaxStates), ""));
+ p.section("Authenticated crawl only",
+ Ui.note("Choose whether Open Suite only runs an authenticated crawl, using credentials that you set in the Application login tab. If no credentials are set, Open Suite runs an unauthenticated crawl instead."),
+ para("If you set credentials but don't enable this setting, Open Suite crawls the site both logged out and logged in. In some cases, this means the authenticated crawl may not find much extra content."),
+ Box.createVerticalStrut(3),
+ authenticatedOnly);
+ p.section("Testing login functions",
+ Ui.note("Choose how Open Suite tests login functionality during the unauthenticated crawl phase."),
+ para("These settings are ignored if you use a recorded login sequence or enable Authenticated crawl only."),
+ Box.createVerticalStrut(3),
+ selfRegister, triggerFailures);
return p;
}
- private JComponent loginFunctionsPage() {
+ private JComponent apiCrawlingPage() {
OptionsPage p = new OptionsPage();
- p.section("Login functions",
- Ui.note("Controls how the crawler handles login and registration forms."),
- selfRegister, triggerFailures, useRecorded);
+ apiGraphql.addItemListener(e -> apiGraphqlCommon.setEnabled(apiGraphql.isSelected()));
+ p.section("API crawling",
+ Ui.note("Configure how Open Suite detects and explores APIs when crawling your site."),
+ apiDefinitions, apiWsdl, apiGraphql, OptionsPage.indent(apiGraphqlCommon, 21));
return p;
}
- private JComponent crawlErrorsPage() {
+ private JComponent browserBehaviourPage() {
OptionsPage p = new OptionsPage();
- p.section("Handling application errors during crawl",
- Ui.note("Pause the crawl when the application stops responding normally, to avoid overloading it."),
- row(Ui.label("If"), crawlTimeouts, Ui.label("consecutive requests time out, pause the crawl")),
- row(Ui.label("If"), crawlErrors, Ui.label("consecutive requests fail, pause the crawl")),
- row(Ui.label("Pause the crawl if"), crawlErrorPct, Ui.label("% of requests fail")),
- row(Ui.label("On completion of each crawl phase do"), crawlRetries, Ui.label("follow-up passes to retry failed operations")));
+ Ui.sized(browserUse, 280);
+ userAgent.setEnabled(false);
+ JLabel agentLabel = Ui.label("User-Agent:"), timeoutLabel = Ui.label("Read timeout for site resources:");
+ agentLabel.setPreferredSize(new Dimension(timeoutLabel.getPreferredSize().width + 22, agentLabel.getPreferredSize().height));
+ timeoutLabel.setPreferredSize(agentLabel.getPreferredSize());
+ agentLabel.setEnabled(false);
+ customAgent.addItemListener(e -> { userAgent.setEnabled(customAgent.isSelected()); agentLabel.setEnabled(customAgent.isSelected()); });
+ p.section("Browser behaviour",
+ Ui.note("Configure how Open Suite loads and interacts with websites when crawling your site."),
+ row(Ui.label("Use the browser for Crawl and Audit"), browserUse),
+ Box.createVerticalStrut(4),
+ customAgent,
+ OptionsPage.indent(row(agentLabel, userAgent), 21),
+ fetchOutOfScope,
+ OptionsPage.indent(row(timeoutLabel, resourceTimeout, plain("milliseconds")), 21));
return p;
}
- private JComponent crawlOverridesPage() {
+ private JComponent discoveryLogicPage() {
OptionsPage p = new OptionsPage();
- JPanel inner = Ui.vbox(ovFollowRedirects, ovKeepAlive, ovHttp2);
- overrideProject.addItemListener(e -> { for (Component c : inner.getComponents()) c.setEnabled(overrideProject.isSelected()); });
- for (Component c : inner.getComponents()) c.setEnabled(false);
- p.section("Crawl project option overrides",
- Ui.note("The crawl normally uses the project's connection and HTTP settings. Override them here for this crawl only."),
- overrideProject, OptionsPage.indent(inner, 24));
+ Ui.sized(fragments, 134);
+ JLabel a = Ui.label("Maximum items to request from site map:"), b = Ui.label("Maximum hidden links to follow:"),
+ c = Ui.label("Application uses fragments for routing");
+ b.setPreferredSize(a.getPreferredSize());
+ c.setPreferredSize(new Dimension(a.getPreferredSize().width + 21, c.getPreferredSize().height));
+ requestSitemap.addItemListener(e -> sitemapItems.setEnabled(requestSitemap.isSelected()));
+ hiddenLinks.addItemListener(e -> hiddenLinkCount.setEnabled(hiddenLinks.isSelected()));
+ p.section("Discovery logic",
+ Ui.note("Configure how Open Suite discovers and interacts with different types of content when crawling your site."),
+ submitForms, requestRobots, requestSitemap,
+ OptionsPage.indent(row(a, sitemapItems), 21),
+ hiddenLinks,
+ OptionsPage.indent(row(b, hiddenLinkCount), 21),
+ clickAll, clickPointer,
+ row(c, fragments));
return p;
}
@@ -315,53 +433,96 @@ public final class ScanConfigPanel extends JPanel {
OptionsPage p = new OptionsPage();
auditSpeed.setSelectedItem("Normal");
auditAccuracy.setSelectedItem("Normal");
+ Ui.sized(auditSpeed, 180); Ui.sized(auditAccuracy, 180);
+ JLabel speed = Ui.label("Audit speed:"), accuracy = Ui.label("Audit accuracy:");
+ speed.setPreferredSize(accuracy.getPreferredSize());
p.section("Audit strategy",
- OptionsPage.labelRow("Audit speed:", auditSpeed),
- OptionsPage.labelRow("Audit accuracy:", auditAccuracy),
+ Ui.note("These settings enable you to control audit coverage and speed based on your application's structure."),
+ para("Control how many requests Open Suite sends and how deeply it checks for vulnerabilities."),
+ Box.createVerticalStrut(3),
+ row(speed, auditSpeed),
+ para("Control how many times Open Suite retries tests to confirm issues. Minimizing false negatives means fewer retries; minimizing false positives means more retries."),
+ Box.createVerticalStrut(3),
+ row(accuracy, auditAccuracy),
+ Box.createVerticalStrut(4),
skipIneffective, maintainSession, followRedirects, parallelPhases);
p.section("Total scan time",
- OptionsPage.fieldRow("Maximum scan time:", asField(maxScanMin), "minutes (0 = no limit)"));
- p.section("Issue noise reduction", consolidatePassive);
+ Ui.note("Limit the total run time for a scan. When the time limit is reached, the scan stops immediately, even if the crawl or audit isn't finished."),
+ para("This doesn't apply to audit-only scans."),
+ Box.createVerticalStrut(3),
+ OptionsPage.fieldRow("Maximum scan time:", maxScanMin, "minutes"));
+ p.section("Issue noise reduction",
+ Ui.note("Reduce noise by grouping repeated passive issues in the scan results."),
+ consolidatePassive);
p.section("Audit network timeouts",
- OptionsPage.fieldRow("Maximum time to establish a connection:", asField(connectTimeout), "s"),
- OptionsPage.fieldRow("Maximum time to complete the request after connecting:", asField(requestTimeout), "s"));
- failPctOn.setText("");
+ Ui.note("Set time limits for network tasks during the audit. These override your global timeout settings under Settings > Network > Connections > Timeouts."),
+ para("To turn off a timeout, set it to 0. To use your global settings, leave blank."),
+ Box.createVerticalStrut(3),
+ OptionsPage.fieldRow("Maximum time to establish a connection:", connectTimeout, "seconds"),
+ OptionsPage.fieldRow("Maximum time to complete the request after connecting:", requestTimeout, "seconds"));
p.section("Handling repeated timeouts during audit",
- row(Ui.label("If"), failChecks, Ui.label("consecutive audit checks fail, skip remaining checks in the current insertion point")),
- row(Ui.label("If"), failPoints, Ui.label("consecutive insertion points fail, skip remaining insertion points and flag")),
- row(Ui.label("Pause the audit if"), failItems, Ui.label("consecutive audit items fail")),
- row(failPctOn, Ui.label("or if"), failPct, Ui.label("% of audit items fail")),
- row(Ui.label("On completion of each audit phase do"), followUpPasses, Ui.label("follow-up passes to retry failed operations")));
+ Ui.note("Control how Open Suite responds to repeated timeouts during the audit."),
+ row(Ui.label("If"), failChecks, plain("consecutive audit checks fail, skip remaining checks in the current insertion point")),
+ row(Ui.label("If"), failPoints, plain("consecutive insertion points fail, skip remaining insertion points, and flag audit item as failed")),
+ para("Pause the audit if:"),
+ Box.createVerticalStrut(3),
+ OptionsPage.indent(row(failItems, plain("consecutive audit items fail")), 13),
+ OptionsPage.indent(row(failPct, plain("% of audit items fail")), 13),
+ Box.createVerticalStrut(4),
+ row(Ui.label("On completion of each audit phase, do"), followUpPasses, plain("follow-up passes to retry failed operations")));
return p;
}
private JComponent javascriptPage() {
OptionsPage p = new OptionsPage();
+ JLabel a = Ui.label("Maximum dynamic analysis time per item:"), b = Ui.label("Maximum static analysis time per item:");
+ b.setPreferredSize(a.getPreferredSize());
+ jsMissing.addItemListener(e -> jsOutOfScope.setEnabled(jsMissing.isSelected()));
p.section("JavaScript analysis",
- Ui.note("Controls how the audit analyses the site's JavaScript for DOM-based issues and hidden resources."),
- jsDynamic, jsStatic, jsMissing, jsOutOfScope,
- OptionsPage.fieldRow("Maximum dynamic analysis time per item:", asField(jsDynamicSecs), "s"),
- OptionsPage.fieldRow("Maximum static analysis time per item:", asField(jsStaticSecs), "s"));
+ Ui.note("Configure how Open Suite detects DOM-based vulnerabilities in JavaScript."),
+ jsDynamic, jsStatic, jsMissing, OptionsPage.indent(jsOutOfScope, 21),
+ Box.createVerticalStrut(4),
+ row(a, jsDynamicSecs, plain("seconds")),
+ row(b, jsStaticSecs, plain("seconds")));
return p;
}
private JComponent insertionPointsPage() {
OptionsPage p = new OptionsPage();
+ for (int i = 0; i < frequent.length; i++) frequent[i] = Ui.check(POINT_TYPES[i], true);
p.section("Set insertion point types",
- Ui.note("Locations where the audit inserts payloads."),
- ipQuery, ipBody, ipCookie, ipName, ipHeaders, ipEntireBody,
- OptionsPage.indent(row(rpcMultipart, rpcXml, rpcJson, rpcGwt, rpcOdata), 24),
- ipFilename, ipFolders);
+ Ui.note("Select which parts of the request Open Suite inserts payloads into:"),
+ ipQuery, ipBody, ipCookie, ipName, ipHeaders, ipEntireBody, ipFilename, ipFolders);
p.section("Ignore specific insertion points",
- Ui.bold("Skip server-side injection tests for these parameters"), skipInjection,
- Box.createVerticalStrut(8),
- Ui.bold("Skip all tests for these parameters"), skipAll);
- p.section("Nested insertion points", nested);
+ Ui.note("Skip server-side injection tests for these parameters:"),
+ opensuite.ui.Sections.fill(skipInjection),
+ Box.createVerticalStrut(6),
+ para("Skip all tests for these parameters:"),
+ Box.createVerticalStrut(3),
+ opensuite.ui.Sections.fill(skipAll));
+ List<Component> often = new ArrayList<>();
+ often.add(Ui.note("If the same insertion point appears often with no change in results, Open Suite runs a lighter audit to speed up scanning."));
+ often.add(para("Select the insertion point types this applies to:"));
+ often.addAll(List.of(frequent));
+ p.section("Handling frequent insertion points", often.toArray(new Component[0]));
+ p.section("Nested insertion points",
+ Ui.note("Choose whether Open Suite places payloads into insertion points within nested data structures, such as JSON within URL parameters."),
+ nested);
+ p.section("Array insertion points",
+ Ui.note("Choose whether Open Suite places payloads into every element of an array, or just a single value. Includes JSON arrays, and repeated or array-notation URL, body, and multipart parameters."),
+ arrayPoints);
p.section("Insertion point limits",
- OptionsPage.fieldRow("Maximum insertion points per base request:", asField(maxPoints), ""));
+ Ui.note("Limit how many insertion points are used in each base request. This helps speed up auditing when scanning requests with many parameters."),
+ OptionsPage.fieldRow("Maximum insertion points per base request:", maxPoints, ""));
+ // Two columns: where a payload starts, then each place it can be moved to.
+ JPanel grid = new JPanel(new GridLayout(3, 2, 12, opensuite.ui.Sections.ROW_GAP));
+ grid.setOpaque(false);
+ for (JCheckBox b : relocate) grid.add(b);
p.section("Payload relocation rules",
- Ui.note("Also test each payload in these alternative locations."),
- row(relocate[0], relocate[1], relocate[2]), row(relocate[3], relocate[4], relocate[5]));
+ Ui.note("Insert payloads for one insertion point type into other insertion point types. This may help evade some filters, but creates many more requests."),
+ para("Select new payload destinations:"),
+ Box.createVerticalStrut(3),
+ row(grid));
return p;
}
@@ -375,22 +536,6 @@ public final class ScanConfigPanel extends JPanel {
return p;
}
- /**
- * Size a spinner to sit on a field row.
- *
- * <p>This used to reach inside the spinner and hand back its editor's text
- * field. Adding that field to a row took it out of the editor, because a
- * component has one parent, and the editor was left with no children. The
- * next setValue on the spinner then threw, which is what stopped the New
- * scan wizard opening at all. The spinner goes on the row whole.
- */
- private static JSpinner asField(JSpinner s) {
- JTextField f = ((JSpinner.DefaultEditor) s.getEditor()).getTextField();
- f.setColumns(5);
- f.setFont(Ui.PLAIN);
- return s;
- }
-
// ---- presets ----
private void onPreset() {
@@ -398,11 +543,21 @@ public final class ScanConfigPanel extends JPanel {
boolean isCustom = p == null || "Custom".equals(p.name());
custom.setVisible((isCustom && !(p == null && mustChoose)) || mode == Mode.PASSIVE_CRAWL);
if (!isCustom && p != null) apply(ScanConfig.preset(p.name()));
+ // Custom starts from the default settings, not from whichever preset was shown before it.
+ if (isCustom && p != null && !wasCustom) apply(customDefaults());
+ wasCustom = isCustom && p != null;
revalidate();
repaint();
}
private boolean mustChoose;
+ private boolean wasCustom;
+
+ /** 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);
+ }
/**
* Start with no configuration selected: the list says to select one, and
@@ -425,12 +580,12 @@ public final class ScanConfigPanel extends JPanel {
/** Put a configuration's values into the controls. */
public void apply(ScanConfig c) {
- maxDepth.setValue(c.crawlDepth());
- maxCrawlMin.setValue(c.crawlDurationMin());
+ put(maxDepth, c.crawlDepth(), false);
+ put(maxCrawlMin, c.crawlDurationMin(), true);
submitForms.setSelected(c.submitForms());
- crawlDynamic.setSelected(c.ajaxSpider());
+ browserUse.setSelectedIndex(c.ajaxSpider() ? 0 : 2);
jsDynamic.setSelected(c.ajaxSpider());
- jsDynamicSecs.setValue(Math.max(1, c.ajaxMaxDurationMin() == 0 ? 30 : c.ajaxMaxDurationMin() * 60));
+ put(jsDynamicSecs, Math.max(1, c.ajaxMaxDurationMin() == 0 ? 30 : c.ajaxMaxDurationMin() * 60), false);
ajaxDepth.setValue(c.ajaxMaxDepth());
ajaxStates.setValue(c.ajaxMaxStates());
auditSpeed.setSelectedItem(switch (c.attackStrength()) { case "LOW" -> "Fast"; case "HIGH", "INSANE" -> "Thorough"; default -> "Normal"; });
@@ -442,13 +597,10 @@ public final class ScanConfigPanel extends JPanel {
ipFolders.setSelected((inj & ScanConfig.INJECT_PATH) != 0);
ipHeaders.setSelected((inj & ScanConfig.INJECT_HEADERS) != 0);
ipCookie.setSelected((inj & ScanConfig.INJECT_COOKIE) != 0);
- int rpc = c.rpcMask();
- rpcMultipart.setSelected((rpc & ScanConfig.RPC_MULTIPART) != 0);
- rpcXml.setSelected((rpc & ScanConfig.RPC_XML) != 0);
- rpcJson.setSelected((rpc & ScanConfig.RPC_JSON) != 0);
- rpcGwt.setSelected((rpc & ScanConfig.RPC_GWT) != 0);
- rpcOdata.setSelected((rpc & ScanConfig.RPC_ODATA) != 0);
- maxScanMin.setValue(c.scanDurationMin());
+ // The structured body formats are kept as the configuration gave them; the tick box covers them all.
+ rpcFormats = c.rpcMask();
+ ipEntireBody.setSelected(rpcFormats != 0);
+ put(maxScanMin, c.scanDurationMin(), true);
}
/** The engine configuration the controls describe. */
@@ -460,21 +612,15 @@ public final class ScanConfigPanel extends JPanel {
if (ipFilename.isSelected() || ipFolders.isSelected()) inj |= ScanConfig.INJECT_PATH;
if (ipHeaders.isSelected()) inj |= ScanConfig.INJECT_HEADERS;
if (ipCookie.isSelected()) inj |= ScanConfig.INJECT_COOKIE;
- int rpc = 0;
- if (ipEntireBody.isSelected()) {
- if (rpcMultipart.isSelected()) rpc |= ScanConfig.RPC_MULTIPART;
- if (rpcXml.isSelected()) rpc |= ScanConfig.RPC_XML;
- if (rpcJson.isSelected()) rpc |= ScanConfig.RPC_JSON;
- if (rpcGwt.isSelected()) rpc |= ScanConfig.RPC_GWT;
- if (rpcOdata.isSelected()) rpc |= ScanConfig.RPC_ODATA;
- }
+ int all = ScanConfig.RPC_MULTIPART | ScanConfig.RPC_XML | ScanConfig.RPC_JSON | ScanConfig.RPC_GWT | ScanConfig.RPC_ODATA;
+ int rpc = !ipEntireBody.isSelected() ? 0 : rpcFormats != 0 ? rpcFormats : all;
String strength = switch (String.valueOf(auditSpeed.getSelectedItem())) { case "Fast" -> "LOW"; case "Thorough" -> "HIGH"; default -> "MEDIUM"; };
String threshold = switch (String.valueOf(auditAccuracy.getSelectedItem())) { case "Minimize false negatives" -> "LOW"; case "Minimize false positives" -> "HIGH"; default -> "MEDIUM"; };
- boolean dyn = crawlDynamic.isSelected() && jsDynamic.isSelected();
+ boolean dyn = !"Never".equals(browserUse.getSelectedItem()) && jsDynamic.isSelected();
return new ScanConfig(name,
- (Integer) maxDepth.getValue(), (Integer) maxCrawlMin.getValue(), submitForms.isSelected(),
- dyn, Math.max(0, (Integer) jsDynamicSecs.getValue() / 60), (Integer) ajaxDepth.getValue(), (Integer) ajaxStates.getValue(),
- strength, threshold, inj, rpc, 0, (Integer) maxScanMin.getValue());
+ 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));
}
/** Live passive crawl choices, for the task description. */
@@ -542,11 +688,22 @@ public final class ScanConfigPanel extends JPanel {
open.add(text, BorderLayout.CENTER);
setOpaque(true);
}
+ private static Icon iconOf(String name, int size) {
+ return switch (name) {
+ case "Lightweight" -> Glyphs.lightweight(size, Theme.TEXT);
+ case "Fast" -> Glyphs.fast(size, Theme.TEXT);
+ case "Balanced" -> Glyphs.balanced(size, Theme.TEXT);
+ case "Deep" -> Glyphs.deep(size, Theme.TEXT);
+ default -> Glyphs.sliders(size, Theme.TEXT);
+ };
+ }
@Override public Component getListCellRendererComponent(JList<? extends Preset> list, Preset v, int i, boolean sel, boolean focus) {
removeAll();
if (i < 0) {
// The closed box.
closed.setText(v == null ? "Select a scan configuration" : v.name());
+ closed.setIcon(v == null ? null : iconOf(v.name(), 15));
+ closed.setIconTextGap(8);
closed.setForeground(Theme.TEXT);
setBorder(Ui.pad(0, 2, 0, 2));
setBackground(Theme.CARD);
@@ -557,13 +714,7 @@ public final class ScanConfigPanel extends JPanel {
desc.setText(v.description());
title.setForeground(Theme.TEXT);
desc.setForeground(Theme.TEXT);
- icon.setIcon(switch (v.name()) {
- case "Lightweight" -> Glyphs.lightweight(18, Theme.TEXT);
- case "Fast" -> Glyphs.fast(18, Theme.TEXT);
- case "Balanced" -> Glyphs.balanced(18, Theme.TEXT);
- case "Deep" -> Glyphs.deep(18, Theme.TEXT);
- default -> Glyphs.sliders(18, Theme.TEXT);
- });
+ icon.setIcon(iconOf(v.name(), 18));
boolean last = i == list.getModel().getSize() - 1;
setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createMatteBorder(0, 0, last ? 0 : 1, 0, Ui.GRID), Ui.pad(16, 14, 16, 14)));
@@ -579,21 +730,21 @@ public final class ScanConfigPanel extends JPanel {
private static List<SkipRule> defaultSkipInjection() {
List<SkipRule> l = new ArrayList<>();
- l.add(new SkipRule(true, "Cookie", "Name", "Matches regex", "^aspsessionid.*$"));
- l.add(new SkipRule(true, "Cookie", "Name", "Matches regex", "^\\.aspnet.*$"));
- l.add(new SkipRule(true, "Body parameter", "Name", "Matches regex", "^__event.*$"));
- l.add(new SkipRule(true, "Body parameter", "Name", "Matches regex", "^__viewstate.*$"));
+ l.add(new SkipRule(true, "Cookie", "Name", "Matches regex", "aspsessionid.*"));
+ l.add(new SkipRule(true, "Cookie", "Name", "Is", "asp.net_sessionid"));
+ for (String n : new String[]{"__eventtarget", "__eventargument", "__viewstate", "__eventvalidation"})
+ l.add(new SkipRule(true, "Body parameter", "Name", "Is", n));
for (String n : new String[]{"jsessionid", "cfid", "cftoken", "phpsessid", "sessionid"})
- l.add(new SkipRule(true, "Any parameter", "Name", "Matches", n));
+ l.add(new SkipRule(true, "Any parameter", "Name", "Is", n));
return l;
}
private static List<SkipRule> defaultSkipAll() {
List<SkipRule> l = new ArrayList<>();
- for (String n : new String[]{"version", "encoding", "standalone", "xmlns", "xml:lang", "lang"})
- l.add(new SkipRule(true, "XML attribute", "Name", "Matches", n));
- for (String n : new String[]{"_ga", "_gid", "_gat", "^_ga_.*$", "^_gac_.*$", "^aws.*$"})
- l.add(new SkipRule(true, "Cookie", "Name", n.startsWith("^") ? "Matches regex" : "Matches", n));
+ for (String n : new String[]{"version", "encoding", "standalone", "xmlns.*", "xml:lang", "lang"})
+ l.add(new SkipRule(true, "XML attribute", "Name", n.endsWith("*") ? "Matches regex" : "Is", n));
+ for (String n : new String[]{"_ga", "_gid", "_gat", "_ga_.*", "_gac_.*", "aws.*"})
+ l.add(new SkipRule(true, "Cookie", "Name", n.endsWith("*") ? "Matches regex" : "Is", n));
return l;
}
@@ -620,20 +771,20 @@ public final class ScanConfigPanel extends JPanel {
rules = new ArrayList<>(initial);
JTable t = new JTable(model);
Ui.styleTable(t);
- t.getColumnModel().getColumn(0).setMaxWidth(70);
+ Ui.distributeWidths(t, 110, 130, 110, 140, 240);
JButton add = Ui.button("Add"), edit = Ui.button("Edit"), remove = Ui.button("Remove");
add.addActionListener(e -> { SkipRule r = dialog(null); if (r != null) { rules.add(r); model.fireTableDataChanged(); } });
edit.addActionListener(e -> { int i = t.getSelectedRow(); if (i >= 0) { SkipRule r = dialog(rules.get(i)); if (r != null) { rules.set(i, r); model.fireTableDataChanged(); } } });
remove.addActionListener(e -> { int i = t.getSelectedRow(); if (i >= 0) { rules.remove(i); model.fireTableDataChanged(); } });
add(Ui.buttonColumn(add, edit, remove), BorderLayout.WEST);
JScrollPane sp = Ui.scroll(t);
- sp.setPreferredSize(new Dimension(560, 130));
+ sp.setPreferredSize(new Dimension(560, 26 + 6 * t.getRowHeight())); // the heading and six rows, as the reference shows
add(sp, BorderLayout.CENTER);
}
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> match = Ui.combo(new String[]{"Matches", "Matches regex"});
+ 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()); }
JPanel form = Ui.form("Parameter:", param, "Item:", item, "Match type:", match, "Expression:", expr);
@@ -665,7 +816,7 @@ public final class ScanConfigPanel extends JPanel {
@Override public boolean isCellEditable(int r, int c) { return c == 0; }
@Override public Object getValueAt(int r, int c) {
Check x = shown.get(r);
- return switch (c) { case 0 -> x.enabled(); case 1 -> x.name(); case 2 -> x.type(); case 3 -> x.javascript() ? "Yes" : "";
+ return switch (c) { case 0 -> x.enabled(); case 1 -> x.name(); case 2 -> x.type(); case 3 -> x.javascript();
case 4 -> x.severity(); case 5 -> x.id(); default -> x.methods(); };
}
@Override public void setValueAt(Object v, int r, int c) {
@@ -687,6 +838,12 @@ public final class ScanConfigPanel extends JPanel {
tabs.addTab("Custom", customTab());
tabs.addTab("Extension", extensionTab());
add(tabs, BorderLayout.CENTER);
+ // The help mark stands in the gutter beside the tabs, as it does beside a section's title.
+ JLabel help = new JLabel(Glyphs.help());
+ help.setVerticalAlignment(SwingConstants.TOP);
+ help.setBorder(Ui.pad(10, 10, 0, 6));
+ add(help, BorderLayout.WEST);
+ setBorder(Ui.pad(2, 0, 6, 8));
addHierarchyListener(e -> { if (isShowing() && !loaded) { loaded = true; load(); } });
}
@@ -699,8 +856,25 @@ public final class ScanConfigPanel extends JPanel {
chips.add(new JLabel(Glyphs.funnel(14, Theme.MUTED)));
chips.add(Ui.label("Filter"));
for (String t : new String[]{"Passive", "Light", "Medium", "Intrusive", "JavaScript"}) {
- JToggleButton b = new JToggleButton(t, true);
- b.setFont(Ui.PLAIN); b.setFocusable(false);
+ JToggleButton b = new JToggleButton(t, true) {
+ // A grey pill when its type is shown, an outline when it is filtered out.
+ @Override protected void paintComponent(Graphics g) {
+ Graphics2D g2 = (Graphics2D) g.create();
+ g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+ int h = getHeight(), w = getWidth();
+ if (isSelected()) { g2.setColor(Theme.SURFACE); g2.fillRoundRect(0, 0, w, h, h, h); }
+ else { g2.setColor(Theme.BORDER); g2.drawRoundRect(0, 0, w - 1, h - 1, h, h); }
+ g2.setFont(getFont());
+ g2.setColor(isSelected() ? Theme.TEXT : Theme.MUTED);
+ FontMetrics fm = g2.getFontMetrics();
+ g2.drawString(getText(), (w - fm.stringWidth(getText())) / 2, (h - fm.getHeight()) / 2 + fm.getAscent());
+ g2.dispose();
+ }
+ };
+ b.setFont(Ui.BOLD); b.setFocusable(false);
+ b.setContentAreaFilled(false); b.setBorderPainted(false); b.setOpaque(false);
+ b.setPreferredSize(new Dimension(b.getFontMetrics(Ui.BOLD).stringWidth(t) + 18, Ui.tall(22)));
b.addActionListener(e -> { if (b.isSelected()) typeFilter.add(t); else typeFilter.remove(t); refilter(); });
chips.add(b);
}
@@ -727,8 +901,13 @@ public final class ScanConfigPanel extends JPanel {
bar.setOpaque(false);
bar.add(chips, BorderLayout.WEST);
bar.add(right, BorderLayout.EAST);
- p.add(bar, BorderLayout.NORTH);
+ JPanel north = new JPanel(new BorderLayout(0, 8));
+ north.setOpaque(false);
+ north.add(Ui.label("These are scan checks that are included with the scanner."), BorderLayout.NORTH);
+ north.add(bar, BorderLayout.CENTER);
+ p.add(north, BorderLayout.NORTH);
Ui.styleTable(table);
+ table.getColumnModel().getColumn(3).setCellRenderer(new Ui.TickRenderer());
table.getColumnModel().getColumn(0).setMaxWidth(32);
Ui.distributeWidths(table, 32, 260, 80, 80, 110, 80, 160);
p.add(Ui.scroll(table), BorderLayout.CENTER);
diff --git a/src/opensuite/ui/OptionsPage.java b/src/opensuite/ui/OptionsPage.java
index ff24646..c57e549 100644
--- a/src/opensuite/ui/OptionsPage.java
+++ b/src/opensuite/ui/OptionsPage.java
@@ -124,7 +124,11 @@ public class OptionsPage extends JPanel {
p.add(control);
if (suffix != null && !suffix.isEmpty()) {
p.add(Box.createHorizontalStrut(5));
- p.add(Ui.label(suffix));
+ // The unit after a box is written as given ("seconds"), not started with a capital.
+ JLabel unit = new JLabel(suffix);
+ unit.setFont(Ui.PLAIN);
+ unit.setForeground(Theme.TEXT);
+ p.add(unit);
}
p.putClientProperty(ROW_LABEL, l);
return p;
diff --git a/tests/opensuite/dashboard/ScanWizardTest.java b/tests/opensuite/dashboard/ScanWizardTest.java
index be2ff0b..2026997 100644
--- a/tests/opensuite/dashboard/ScanWizardTest.java
+++ b/tests/opensuite/dashboard/ScanWizardTest.java
@@ -92,19 +92,26 @@ public final class ScanWizardTest {
}
});
- check("every spinner keeps its own editor", () -> {
- // A spinner whose editor has been emptied throws on setValue, and
- // the failure surfaces far from the cause.
+ check("a number box left empty means no limit, and a configuration goes in and comes back", () -> {
+ javax.swing.JTextField f = new javax.swing.JTextField("");
+ Expect.equal(ScanConfigPanel.intOf(f, 0), 0, "empty");
+ f.setText(" 150 ");
+ Expect.equal(ScanConfigPanel.intOf(f, 0), 150, "a number");
+ f.setText("abc");
+ Expect.equal(ScanConfigPanel.intOf(f, 7), 7, "not a number");
ScanConfigPanel panel = new ScanConfigPanel(ScanConfigPanel.Mode.CRAWL_AND_AUDIT);
- int checked = 0;
- for (JSpinner s : spinnersIn(panel)) {
- javax.swing.JComponent ed = (javax.swing.JComponent) s.getEditor();
- Expect.isTrue(ed.getComponentCount() > 0,
- "a spinner was left with an empty editor");
- s.setValue(s.getValue()); // the operation that used to throw
- checked++;
+ for (String name : new String[]{"Lightweight", "Fast", "Balanced", "Deep"}) {
+ opensuite.engine.ScanConfig c = opensuite.engine.ScanConfig.preset(name);
+ panel.apply(c);
+ opensuite.engine.ScanConfig back = panel.config();
+ Expect.equal(back.crawlDepth(), c.crawlDepth(), name + ": crawl depth");
+ Expect.equal(back.crawlDurationMin(), c.crawlDurationMin(), name + ": crawl time");
+ Expect.equal(back.scanDurationMin(), c.scanDurationMin(), name + ": scan time");
+ Expect.equal(back.injectableMask(), c.injectableMask(), name + ": insertion points");
+ Expect.equal(back.rpcMask(), c.rpcMask(), name + ": body formats");
+ Expect.equal(back.ajaxSpider(), c.ajaxSpider(), name + ": browser");
+ Expect.equal(back.attackStrength().equals("INSANE") ? "HIGH" : back.attackStrength(), c.attackStrength().equals("INSANE") ? "HIGH" : c.attackStrength(), name + ": audit speed");
}
- Expect.isTrue(checked > 0, "the panel has spinners to check");
});
check("the wizard itself can be constructed", () -> {