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.

Custom scan configuration: options the engine lacks are greyed out

scottsturrock7ecea264eef5
diff --git a/src/opensuite/dashboard/ScanConfigPanel.java b/src/opensuite/dashboard/ScanConfigPanel.java
index f7247ec..d7d8f17 100644
--- a/src/opensuite/dashboard/ScanConfigPanel.java
+++ b/src/opensuite/dashboard/ScanConfigPanel.java
@@ -249,6 +249,17 @@ public final class ScanConfigPanel extends JPanel {
custom.add(ts, BorderLayout.WEST);
custom.add(pages, BorderLayout.CENTER);
add(custom, BorderLayout.CENTER);
+ // What the scan engine cannot do yet stays on the page, greyed, so the page keeps its shape.
+ notYet(crawlStrategy, crawlSpeed, crawlTimeouts, crawlTimeoutPct, crawlAuthFailures, crawlRetries,
+ authenticatedOnly, selfRegister, triggerFailures,
+ apiDefinitions, apiWsdl, apiGraphql, apiGraphqlCommon,
+ fetchOutOfScope, resourceTimeout, sitemapItems, hiddenLinkCount, clickPointer, fragments,
+ skipIneffective, maintainSession, followRedirects, parallelPhases, consolidatePassive,
+ failChecks, failPoints, failItems, failPct, followUpPasses,
+ jsStatic, jsMissing, jsOutOfScope, jsDynamicSecs, jsStaticSecs,
+ ipName, nested, arrayPoints, maxPoints);
+ notYet(relocate);
+ notYet(frequent);
// Select the first leaf.
for (int i = 0; i < tree.getRowCount(); i++) {
Object o = tree.getPathForRow(i).getLastPathComponent();
@@ -296,6 +307,19 @@ public final class ScanConfigPanel extends JPanel {
f.setText(value == 0 && zeroIsBlank ? "" : String.valueOf(value));
}
+ static final String NOT_YET = "Not available yet";
+
+ /** Grey out controls the engine has nothing behind, and say so when the pointer rests on one. */
+ private static void notYet(JComponent... controls) {
+ for (JComponent c : controls) {
+ if (c == null) continue;
+ c.setEnabled(false);
+ c.setToolTipText(NOT_YET);
+ // A box or a list has to look as dead as it is.
+ if (c instanceof javax.swing.text.JTextComponent t) { t.setDisabledTextColor(Theme.DISABLED_TEXT); t.setBackground(Theme.SURFACE); }
+ }
+ }
+
private static JPanel row(Component... c) { return Ui.row(c); }
private static JTextArea para(String s) { return opensuite.ui.Sections.text(s); }
@@ -382,7 +406,6 @@ public final class ScanConfigPanel extends JPanel {
private JComponent apiCrawlingPage() {
OptionsPage p = new OptionsPage();
- 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));
@@ -416,8 +439,6 @@ public final class ScanConfigPanel extends JPanel {
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,
@@ -477,7 +498,6 @@ public final class ScanConfigPanel extends JPanel {
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("Configure how Open Suite detects DOM-based vulnerabilities in JavaScript."),
jsDynamic, jsStatic, jsMissing, OptionsPage.indent(jsOutOfScope, 21),
diff --git a/src/opensuite/ui/theme/FlatComboBoxUI.java b/src/opensuite/ui/theme/FlatComboBoxUI.java
index e4991ae..fad787f 100644
--- a/src/opensuite/ui/theme/FlatComboBoxUI.java
+++ b/src/opensuite/ui/theme/FlatComboBoxUI.java
@@ -52,15 +52,27 @@ public class FlatComboBoxUI extends BasicComboBoxUI {
return r;
}
+ /** The chosen value of a disabled list is written in the disabled colour, on the disabled ground. */
+ @Override public void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus) {
+ if (comboBox.isEnabled()) { super.paintCurrentValue(g, bounds, hasFocus); return; }
+ @SuppressWarnings("unchecked")
+ ListCellRenderer<Object> r = (ListCellRenderer<Object>) comboBox.getRenderer();
+ Component c = r.getListCellRendererComponent(listBox, comboBox.getSelectedItem(), -1, false, false);
+ c.setFont(comboBox.getFont());
+ c.setForeground(Theme.DISABLED_TEXT);
+ c.setBackground(Theme.SURFACE);
+ currentValuePane.paintComponent(g, c, comboBox, bounds.x, bounds.y, bounds.width, bounds.height, c instanceof JPanel);
+ }
+
@Override public void paintCurrentValueBackground(Graphics g, Rectangle bounds, boolean hasFocus) {
- g.setColor(comboBox.isEnabled() ? Theme.FIELD_BG : Theme.CONTENT);
+ g.setColor(comboBox.isEnabled() ? Theme.FIELD_BG : Theme.SURFACE);
g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
}
@Override public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g.create();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- g2.setColor(c.isEnabled() ? Theme.FIELD_BG : Theme.CONTENT);
+ g2.setColor(c.isEnabled() ? Theme.FIELD_BG : Theme.SURFACE);
g2.fillRoundRect(0, 0, c.getWidth(), c.getHeight(), Theme.RADIUS * 2, Theme.RADIUS * 2);
g2.dispose();
super.paint(g, c);