Search in sources :

Example 1 with ExtensionPassiveScan

use of org.zaproxy.zap.extension.pscan.ExtensionPassiveScan in project zaproxy by zaproxy.

the class ExtensionAntiCSRF method unload.

@Override
public void unload() {
    ExtensionPassiveScan extensionPassiveScan = Control.getSingleton().getExtensionLoader().getExtension(ExtensionPassiveScan.class);
    if (extensionPassiveScan != null) {
        extensionPassiveScan.removePassiveScanner(antiCsrfDetectScanner);
    }
    super.unload();
}
Also used : ExtensionPassiveScan(org.zaproxy.zap.extension.pscan.ExtensionPassiveScan)

Example 2 with ExtensionPassiveScan

use of org.zaproxy.zap.extension.pscan.ExtensionPassiveScan in project zaproxy by zaproxy.

the class ExtensionParams method unload.

@Override
public void unload() {
    ExtensionPassiveScan extensionPassiveScan = Control.getSingleton().getExtensionLoader().getExtension(ExtensionPassiveScan.class);
    if (extensionPassiveScan != null) {
        extensionPassiveScan.removePassiveScanner(paramScanner);
    }
    super.unload();
}
Also used : ExtensionPassiveScan(org.zaproxy.zap.extension.pscan.ExtensionPassiveScan)

Example 3 with ExtensionPassiveScan

use of org.zaproxy.zap.extension.pscan.ExtensionPassiveScan in project zaproxy by zaproxy.

the class AddOnInstaller method uninstallAddOnPassiveScanRules.

private static boolean uninstallAddOnPassiveScanRules(AddOn addOn, AddOnUninstallationProgressCallback callback) {
    boolean uninstalledWithoutErrors = true;
    List<PluginPassiveScanner> loadedPscanrules = addOn.getLoadedPscanrules();
    ExtensionPassiveScan extPscan = Control.getSingleton().getExtensionLoader().getExtension(ExtensionPassiveScan.class);
    if (!loadedPscanrules.isEmpty()) {
        logger.debug("Uninstall pscanrules: " + addOn.getPscanrules());
        callback.passiveScanRulesWillBeRemoved(loadedPscanrules.size());
        for (PluginPassiveScanner pscanrule : loadedPscanrules) {
            String name = pscanrule.getClass().getCanonicalName();
            logger.debug("Uninstall pscanrule: " + name);
            if (!extPscan.removePassiveScanner(pscanrule)) {
                logger.error("Failed to uninstall pscanrule: " + name);
                uninstalledWithoutErrors = false;
            }
            callback.passiveScanRuleRemoved(name);
        }
        addOn.setLoadedPscanrules(Collections.<PluginPassiveScanner>emptyList());
        addOn.setLoadedPscanrulesSet(false);
    }
    return uninstalledWithoutErrors;
}
Also used : ExtensionPassiveScan(org.zaproxy.zap.extension.pscan.ExtensionPassiveScan) PluginPassiveScanner(org.zaproxy.zap.extension.pscan.PluginPassiveScanner)

Example 4 with ExtensionPassiveScan

use of org.zaproxy.zap.extension.pscan.ExtensionPassiveScan in project zaproxy by zaproxy.

the class ExtensionAntiCSRF method hook.

@Override
public void hook(ExtensionHook extensionHook) {
    super.hook(extensionHook);
    extensionHook.addOptionsParamSet(antiCsrfParam);
    final ExtensionHistory extensionHistory = Control.getSingleton().getExtensionLoader().getExtension(ExtensionHistory.class);
    if (extensionHistory != null) {
        historyReferenceFactory = new HistoryReferenceFactory() {

            @Override
            public HistoryReference createHistoryReference(int id) {
                return extensionHistory.getHistoryReference(id);
            }
        };
    } else {
        historyReferenceFactory = new HistoryReferenceFactory() {

            @Override
            public HistoryReference createHistoryReference(int id) throws HttpMalformedHeaderException, DatabaseException {
                return new HistoryReference(id);
            }
        };
    }
    AntiCsrfToken.setHistoryReferenceFactory(historyReferenceFactory);
    extensionHook.addSessionListener(this);
    if (getView() != null) {
        extensionHook.getHookView().addOptionPanel(getOptionsAntiCsrfPanel());
        extensionHook.getHookMenu().addPopupMenuItem(this.getPopupMenuGenerateForm());
    }
    ExtensionPassiveScan extensionPassiveScan = Control.getSingleton().getExtensionLoader().getExtension(ExtensionPassiveScan.class);
    if (extensionPassiveScan != null) {
        extensionPassiveScan.addPassiveScanner(antiCsrfDetectScanner);
    }
    AntiCsrfAPI api = new AntiCsrfAPI(this);
    api.addApiOptions(getParam());
    extensionHook.addApiImplementor(api);
}
Also used : HistoryReference(org.parosproxy.paros.model.HistoryReference) ExtensionPassiveScan(org.zaproxy.zap.extension.pscan.ExtensionPassiveScan) HttpMalformedHeaderException(org.parosproxy.paros.network.HttpMalformedHeaderException) ExtensionHistory(org.parosproxy.paros.extension.history.ExtensionHistory) DatabaseException(org.parosproxy.paros.db.DatabaseException)

Example 5 with ExtensionPassiveScan

use of org.zaproxy.zap.extension.pscan.ExtensionPassiveScan in project zaproxy by zaproxy.

the class AlertViewPanel method getSourceData.

private String getSourceData(Alert alert) {
    String source = Constant.messages.getString(alert.getSource().getI18nKey());
    if (alert.getPluginId() == UNDEFINED_ID) {
        return source;
    }
    StringBuilder strBuilder = new StringBuilder(source);
    strBuilder.append(" (").append(alert.getPluginId());
    if (alert.getSource() == Alert.Source.ACTIVE) {
        Plugin plugin = PluginFactory.getLoadedPlugin(alert.getPluginId());
        if (plugin != null) {
            strBuilder.append(" - ").append(plugin.getName());
        }
    } else if (alert.getSource() == Alert.Source.PASSIVE) {
        ExtensionPassiveScan ext = Control.getSingleton().getExtensionLoader().getExtension(ExtensionPassiveScan.class);
        if (ext != null) {
            PluginPassiveScanner scanner = ext.getPluginPassiveScanner(alert.getPluginId());
            if (scanner != null) {
                strBuilder.append(" - ").append(scanner.getName());
            }
        }
    }
    strBuilder.append(')');
    return strBuilder.toString();
}
Also used : ExtensionPassiveScan(org.zaproxy.zap.extension.pscan.ExtensionPassiveScan) PluginPassiveScanner(org.zaproxy.zap.extension.pscan.PluginPassiveScanner) Plugin(org.parosproxy.paros.core.scanner.Plugin)

Aggregations

ExtensionPassiveScan (org.zaproxy.zap.extension.pscan.ExtensionPassiveScan)7 PluginPassiveScanner (org.zaproxy.zap.extension.pscan.PluginPassiveScanner)3 Plugin (org.parosproxy.paros.core.scanner.Plugin)1 DatabaseException (org.parosproxy.paros.db.DatabaseException)1 ExtensionHookView (org.parosproxy.paros.extension.ExtensionHookView)1 ExtensionLoader (org.parosproxy.paros.extension.ExtensionLoader)1 ExtensionHistory (org.parosproxy.paros.extension.history.ExtensionHistory)1 HistoryReference (org.parosproxy.paros.model.HistoryReference)1 HttpMalformedHeaderException (org.parosproxy.paros.network.HttpMalformedHeaderException)1