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);
}
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;
}
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);
}
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;
}
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());
}
}
Aggregations