Search in sources :

Example 1 with ExtensionLoader

use of org.parosproxy.paros.extension.ExtensionLoader in project zaproxy by zaproxy.

the class AddOnInstaller method installAddOnExtension.

public static void installAddOnExtension(AddOn addOn, Extension ext) {
    ExtensionLoader extensionLoader = Control.getSingleton().getExtensionLoader();
    ExtensionFactory.addAddOnExtension(extensionLoader, Model.getSingleton().getOptionsParam().getConfig(), ext);
    installAddOnExtensionImpl(addOn, ext, extensionLoader);
}
Also used : ExtensionLoader(org.parosproxy.paros.extension.ExtensionLoader)

Example 2 with ExtensionLoader

use of org.parosproxy.paros.extension.ExtensionLoader in project zaproxy by zaproxy.

the class ExtensionPassiveScan method getPassiveScanThread.

private PassiveScanThread getPassiveScanThread() {
    if (pst == null) {
        final ExtensionLoader extensionLoader = Control.getSingleton().getExtensionLoader();
        final ExtensionHistory extHist = (ExtensionHistory) extensionLoader.getExtension(ExtensionHistory.NAME);
        final ExtensionAlert extAlert = (ExtensionAlert) extensionLoader.getExtension(ExtensionAlert.NAME);
        pst = new PassiveScanThread(getPassiveScannerList(), extHist, extAlert, getPassiveScanParam());
        pst.start();
    }
    return pst;
}
Also used : ExtensionHistory(org.parosproxy.paros.extension.history.ExtensionHistory) ExtensionAlert(org.zaproxy.zap.extension.alert.ExtensionAlert) ExtensionLoader(org.parosproxy.paros.extension.ExtensionLoader)

Example 3 with ExtensionLoader

use of org.parosproxy.paros.extension.ExtensionLoader in project zaproxy by zaproxy.

the class WithConfigsTest method setUp.

@Before
public void setUp() throws Exception {
    /*
        // Useful if you need to get some info when debugging
        BasicConfigurator.configure();
        ConsoleAppender ca = new ConsoleAppender();
        ca.setWriter(new OutputStreamWriter(System.out));
        ca.setLayout(new PatternLayout("%-5p [%t]: %m%n"));
        Logger.getRootLogger().addAppender(ca);
        Logger.getRootLogger().setLevel(Level.DEBUG);
/**/
    Constant.setZapInstall(INSTALL_PATH);
    HOME_DIR.mkdirs();
    Constant.setZapHome(HOME_DIR.getAbsolutePath());
    File langDir = new File(Constant.getZapInstall(), "lang");
    ClassLoaderUtil.addFile(langDir.getAbsolutePath());
    ExtensionLoader extLoader = Mockito.mock(ExtensionLoader.class);
    Control control = Mockito.mock(Control.class);
    Mockito.when(control.getExtensionLoader()).thenReturn(extLoader);
    // Init all the things
    Constant.getInstance();
    I18N i18n = Mockito.mock(I18N.class);
    given(i18n.getString(anyString())).willReturn("");
    given(i18n.getString(anyString(), anyObject())).willReturn("");
    given(i18n.getLocal()).willReturn(Locale.getDefault());
    Constant.messages = i18n;
    Control.initSingletonForTesting(Model.getSingleton());
    Mockito.when(control.getExtensionLoader()).thenReturn(extLoader);
}
Also used : Control(org.parosproxy.paros.control.Control) File(java.io.File) ExtensionLoader(org.parosproxy.paros.extension.ExtensionLoader) I18N(org.zaproxy.zap.utils.I18N) Before(org.junit.Before)

Example 4 with ExtensionLoader

use of org.parosproxy.paros.extension.ExtensionLoader in project zaproxy by zaproxy.

the class AddOnInstaller method installAddOnExtensions.

private static List<Extension> installAddOnExtensions(AddOn addOn) {
    ExtensionLoader extensionLoader = Control.getSingleton().getExtensionLoader();
    List<Extension> listExts = ExtensionFactory.loadAddOnExtensions(extensionLoader, Model.getSingleton().getOptionsParam().getConfig(), addOn);
    for (Extension ext : listExts) {
        installAddOnExtensionImpl(addOn, ext, extensionLoader);
    }
    return listExts;
}
Also used : Extension(org.parosproxy.paros.extension.Extension) ExtensionLoader(org.parosproxy.paros.extension.ExtensionLoader)

Example 5 with ExtensionLoader

use of org.parosproxy.paros.extension.ExtensionLoader in project zaproxy by zaproxy.

the class ExtensionStdMenus method hook.

@Override
public void hook(ExtensionHook extensionHook) {
    super.hook(extensionHook);
    if (getView() != null) {
        extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuCopy());
        extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuPaste());
        final ExtensionLoader extensionLoader = Control.getSingleton().getExtensionLoader();
        boolean isExtensionHistoryEnabled = extensionLoader.isExtensionEnabled(ExtensionHistory.NAME);
        boolean isExtensionActiveScanEnabled = extensionLoader.isExtensionEnabled(ExtensionActiveScan.NAME);
        // Be careful when changing the menu indexes (and order above) - its easy to get unexpected
        // results!
        extensionHook.getHookMenu().addPopupMenuItem(getPopupExcludeFromProxyMenu(0));
        if (isExtensionActiveScanEnabled) {
            extensionHook.getHookMenu().addPopupMenuItem(getPopupExcludeFromScanMenu(0));
        }
        extensionHook.getHookMenu().addPopupMenuItem(getPopupExcludeFromSpiderMenu(0));
        extensionHook.getHookMenu().addPopupMenuItem(getPopupContextIncludeMenu(1));
        extensionHook.getHookMenu().addPopupMenuItem(getPopupContextExcludeMenu(2));
        // TODO ??
        extensionHook.getHookMenu().addPopupMenuItem(getPopupContextDataDrivenMenu(2));
        if (isExtensionActiveScanEnabled) {
            extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuActiveScanCustom(3));
        }
        if (isExtensionHistoryEnabled) {
            extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuResendMessage(4));
        }
        extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuAlert(5));
        if (isExtensionHistoryEnabled) {
            // Both are index 6
            extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuShowInHistory(6));
        }
        // on purpose ;)
        extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuShowInSites(6));
        extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuOpenUrlInBrowser(7));
        extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuCopyUrls(8));
        // extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuShowResponseInBrowser(7));
        extensionHook.getHookMenu().addPopupMenuItem(getPopupContextTreeMenuInScope());
        extensionHook.getHookMenu().addPopupMenuItem(getPopupContextTreeMenuOutScope());
        extensionHook.getHookMenu().addPopupMenuItem(getPopupContextTreeMenuDelete());
        extensionHook.getHookMenu().addPopupMenuItem(getPopupContextTreeMenuExport());
    }
}
Also used : ExtensionLoader(org.parosproxy.paros.extension.ExtensionLoader)

Aggregations

ExtensionLoader (org.parosproxy.paros.extension.ExtensionLoader)8 Extension (org.parosproxy.paros.extension.Extension)2 File (java.io.File)1 Before (org.junit.Before)1 Control (org.parosproxy.paros.control.Control)1 ExtensionHookView (org.parosproxy.paros.extension.ExtensionHookView)1 ExtensionHistory (org.parosproxy.paros.extension.history.ExtensionHistory)1 XmlReporterExtension (org.zaproxy.zap.extension.XmlReporterExtension)1 ExtensionAlert (org.zaproxy.zap.extension.alert.ExtensionAlert)1 ExtensionPassiveScan (org.zaproxy.zap.extension.pscan.ExtensionPassiveScan)1 I18N (org.zaproxy.zap.utils.I18N)1