From b45111b4421c5672933395b3208af8c1a0486e93 Mon Sep 17 00:00:00 2001 From: ricekot Date: Tue, 2 Jul 2024 17:58:00 +0530 Subject: [PATCH] Update generate_alert_pages.js script `getExampleAlerts` is a public method for most scan rules and reflection is not needed to access it. The reason this change was needed is that reflection was failing for `PassiveScriptScanRule`s. This is probably because we are using `ByteBuddy` to dynamically create a unique class for each passive script but I haven't checked in detail. Signed-off-by: ricekot --- scripts/generate_alert_pages.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/generate_alert_pages.js b/scripts/generate_alert_pages.js index ec9139e0..7e12a11e 100644 --- a/scripts/generate_alert_pages.js +++ b/scripts/generate_alert_pages.js @@ -352,7 +352,11 @@ function getPrivateMethod(obj, methods, key, defaultVal) { function printPscanRule(plugin) { plugin.setHelper(passiveScanData); - var examples = getPrivateMethod(plugin, ['getExampleAlerts'], '', null); + try { + var examples = plugin.getExampleAlerts() + } catch (e) { + var examples = getPrivateMethod(plugin, ['getExampleAlerts'], '', null); + } if (examples == null || examples.length == 0) { var alert = new Alert(plugin.getPluginId());