Skip to content

Commit

Permalink
Merge pull request #5381 from thc202/alertFilters/pscan-data
Browse files Browse the repository at this point in the history
  • Loading branch information
kingthorin authored Apr 2, 2024
2 parents de65a65 + c2776b9 commit c94c073
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,14 @@
import org.parosproxy.paros.model.Session.OnContextsChangedListener;
import org.parosproxy.paros.view.View;
import org.zaproxy.zap.ZAP;
import org.zaproxy.zap.control.CoreFunctionality;
import org.zaproxy.zap.control.ExtensionFactory;
import org.zaproxy.zap.eventBus.Event;
import org.zaproxy.zap.eventBus.EventConsumer;
import org.zaproxy.zap.extension.alert.AlertEventPublisher;
import org.zaproxy.zap.extension.alert.ExtensionAlert;
import org.zaproxy.zap.extension.alert.PopupMenuItemAlert;
import org.zaproxy.zap.extension.alertFilters.internal.ScanRulesInfo;
import org.zaproxy.zap.extension.ascan.ExtensionActiveScan;
import org.zaproxy.zap.extension.pscan.ExtensionPassiveScan;
import org.zaproxy.zap.model.Context;
import org.zaproxy.zap.model.ContextDataFactory;
import org.zaproxy.zap.model.SessionStructure;
Expand Down Expand Up @@ -141,8 +140,9 @@ public static ScanRulesInfo getScanRulesInfo() {
scanRulesInfo =
new ScanRulesInfo(
getExtAscan(),
CoreFunctionality.getBuiltInPassiveScanRules(),
ExtensionFactory.getAddOnLoader().getPassiveScanRules());
Control.getSingleton()
.getExtensionLoader()
.getExtension(ExtensionPassiveScan.class));
}
return scanRulesInfo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.zaproxy.zap.extension.alert.ExampleAlertProvider;
import org.zaproxy.zap.extension.ascan.ExtensionActiveScan;
import org.zaproxy.zap.extension.ascan.ScanPolicy;
import org.zaproxy.zap.extension.pscan.ExtensionPassiveScan;
import org.zaproxy.zap.extension.pscan.PassiveScanData;
import org.zaproxy.zap.extension.pscan.PluginPassiveScanner;

Expand All @@ -48,20 +49,17 @@ public class ScanRulesInfo extends AbstractList<ScanRulesInfo.Entry> {
private Map<String, Entry> entriesById;

public ScanRulesInfo(
ExtensionActiveScan extensionActiveScan,
List<PluginPassiveScanner> builtInPassiveScanRules,
List<PluginPassiveScanner> passiveScanRules) {
ExtensionActiveScan extensionActiveScan, ExtensionPassiveScan extensionPassiveScan) {
entries = new ArrayList<>();
entriesById = new HashMap<>();
ScanPolicy sp = extensionActiveScan.getPolicyManager().getDefaultScanPolicy();
for (Plugin scanRule : sp.getPluginFactory().getAllPlugin()) {
addEntry(scanRule, scanRule.getId(), scanRule.getName());
}
for (PluginPassiveScanner scanRule : builtInPassiveScanRules) {
addEntry(scanRule, scanRule.getPluginId(), scanRule.getName());
}
for (PluginPassiveScanner scanRule : passiveScanRules) {
addEntry(scanRule, scanRule.getPluginId(), scanRule.getName());
if (extensionPassiveScan != null) {
for (PluginPassiveScanner scanRule : extensionPassiveScan.getPluginPassiveScanners()) {
addEntry(scanRule, scanRule.getPluginId(), scanRule.getName());
}
}
Collections.sort(entries);
}
Expand Down

0 comments on commit c94c073

Please sign in to comment.