Search in sources :

Example 36 with Session

use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.

the class SpiderDialog method targetSelected.

@Override
public void targetSelected(String field, Target node) {
    List<String> ctxNames = new ArrayList<>();
    if (node != null) {
        // The user has selected a new node
        this.target = node;
        if (node.getStartNode() != null) {
            Session session = Model.getSingleton().getSession();
            List<Context> contexts = session.getContextsForNode(node.getStartNode());
            for (Context context : contexts) {
                ctxNames.add(context.getName());
            }
        } else if (node.getContext() != null) {
            ctxNames.add(node.getContext().getName());
        }
    }
    this.setComboFields(FIELD_CONTEXT, ctxNames, "");
    this.getField(FIELD_CONTEXT).setEnabled(ctxNames.size() > 0);
}
Also used : Context(org.zaproxy.zap.model.Context) ArrayList(java.util.ArrayList) Session(org.parosproxy.paros.model.Session)

Example 37 with Session

use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.

the class PopupContextMenuItemHolder method resetMenu.

private void resetMenu() {
    final List<JMenuItem> mainPopupMenuItems = View.getSingleton().getPopupList();
    // Remove existing popup menu items
    if (visibleItself)
        this.removeAll();
    else {
        for (ExtensionPopupMenuItem menu : getSubmenuItems()) {
            mainPopupMenuItems.remove(menu);
        }
        subMenuItems.clear();
    }
    // Add a popup menu item for each existing context
    Session session = Model.getSingleton().getSession();
    List<Context> contexts = session.getContexts();
    for (Context context : contexts) {
        ExtensionPopupMenuItem piicm;
        if (visibleItself) {
            piicm = getPopupContextMenu(context, this.getText());
            this.add(piicm);
        } else {
            piicm = getPopupContextMenu(context, this.parentName);
            piicm.setMenuIndex(this.getMenuIndex());
            mainPopupMenuItems.add(piicm);
            subMenuItems.add(piicm);
        }
    }
}
Also used : PopupMenuItemContext(org.zaproxy.zap.view.popup.PopupMenuItemContext) Context(org.zaproxy.zap.model.Context) ExtensionPopupMenuItem(org.parosproxy.paros.extension.ExtensionPopupMenuItem) JMenuItem(javax.swing.JMenuItem) Session(org.parosproxy.paros.model.Session)

Example 38 with Session

use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.

the class PopupExcludeFromSpiderMenu method performAction.

@Override
public void performAction(SiteNode sn) {
    try {
        Session session = Model.getSingleton().getSession();
        session.getExcludeFromSpiderRegexs().add(new StructuralSiteNode(sn).getRegexPattern());
    } catch (DatabaseException e) {
    // Ignore
    }
}
Also used : StructuralSiteNode(org.zaproxy.zap.model.StructuralSiteNode) DatabaseException(org.parosproxy.paros.db.DatabaseException) Session(org.parosproxy.paros.model.Session)

Example 39 with Session

use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.

the class PopupContextMenuItemFactory method isEnableForComponent.

@Override
public boolean isEnableForComponent(Component invoker) {
    final List<JMenuItem> mainPopupMenuItems = View.getSingleton().getPopupList();
    for (ExtensionPopupMenuItem menu : subMenus) {
        mainPopupMenuItems.remove(menu);
    }
    subMenus.clear();
    // Add the existing contexts
    Session session = Model.getSingleton().getSession();
    List<Context> contexts = session.getContexts();
    for (Context context : contexts) {
        ExtensionPopupMenuItem piicm = getContextMenu(context, this.parentMenu);
        piicm.setMenuIndex(this.getMenuIndex());
        mainPopupMenuItems.add(piicm);
        this.subMenus.add(piicm);
    }
    return false;
}
Also used : Context(org.zaproxy.zap.model.Context) ExtensionPopupMenuItem(org.parosproxy.paros.extension.ExtensionPopupMenuItem) JMenuItem(javax.swing.JMenuItem) Session(org.parosproxy.paros.model.Session)

Example 40 with Session

use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.

the class SessionExcludeFromProxyPanel method initParam.

@Override
public void initParam(Object obj) {
    Session session = (Session) obj;
    regexesPanel.setRegexes(session.getExcludeFromProxyRegexs());
    regexesPanel.setRemoveWithoutConfirmation(!Model.getSingleton().getOptionsParam().getViewParam().isConfirmRemoveProxyExcludeRegex());
}
Also used : Session(org.parosproxy.paros.model.Session)

Aggregations

Session (org.parosproxy.paros.model.Session)51 DatabaseException (org.parosproxy.paros.db.DatabaseException)18 Context (org.zaproxy.zap.model.Context)14 ArrayList (java.util.ArrayList)8 JMenuItem (javax.swing.JMenuItem)7 ExtensionPopupMenuItem (org.parosproxy.paros.extension.ExtensionPopupMenuItem)7 File (java.io.File)5 SiteNode (org.parosproxy.paros.model.SiteNode)5 HttpMalformedHeaderException (org.parosproxy.paros.network.HttpMalformedHeaderException)5 URIException (org.apache.commons.httpclient.URIException)4 RecordStructure (org.parosproxy.paros.db.RecordStructure)4 HttpMessage (org.parosproxy.paros.network.HttpMessage)4 ApiException (org.zaproxy.zap.extension.api.ApiException)4 ApiResponseElement (org.zaproxy.zap.extension.api.ApiResponseElement)4 Date (java.util.Date)3 HashMap (java.util.HashMap)3 PatternSyntaxException (java.util.regex.PatternSyntaxException)3 JFileChooser (javax.swing.JFileChooser)3 JSONException (net.sf.json.JSONException)3 ExtensionHistory (org.parosproxy.paros.extension.history.ExtensionHistory)3