use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.
the class Control method createNewSession.
/**
* Creates a new session and resets session related data in other components (e.g. proxy excluded URLs).
*
* @return the newly created session.
*/
private Session createNewSession() {
Session session = model.newSession();
getProxy().setIgnoreList(model.getOptionsParam().getGlobalExcludeURLParam().getTokensNames());
return session;
}
use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.
the class PopupMenuItemContextDataDrivenNode method performAction.
@Override
public void performAction(SiteNode sn) {
Session session = Model.getSingleton().getSession();
SessionDialog sessionDialog = View.getSingleton().getSessionDialog();
sessionDialog.recreateUISharedContexts(session);
Context uiSharedContext = sessionDialog.getUISharedContext(context.getId());
// We want to form a regex expression like:
// https://www.example.com/(aa/bb/cc/)(.+?)(/.*)
StringBuilder sb = new StringBuilder();
SiteNode parent = sn.getParent();
while (!parent.getParent().isRoot()) {
sb.insert(0, "/");
if (parent.isDataDriven()) {
// Don't want these in their own regex group
sb.insert(0, ".+?");
} else {
sb.insert(0, parent.getCleanNodeName());
}
parent = parent.getParent();
}
sb.insert(0, "/(");
sb.insert(0, parent.getCleanNodeName());
sb.append(")(.+?)(/.*)");
Pattern p = Pattern.compile(sb.toString());
uiSharedContext.addDataDrivenNodes(new StructuralNodeModifier(StructuralNodeModifier.Type.DataDrivenNode, p, uiSharedContext.getDefaultDDNName()));
// Show the session dialog without recreating UI Shared contexts
View.getSingleton().showSessionDialog(session, ContextStructurePanel.getPanelName(context.getId()), false);
}
use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.
the class PopupMenuItemContextInclude method reCreateSubMenu.
protected void reCreateSubMenu() {
final List<JMenuItem> mainPopupMenuItems = View.getSingleton().getPopupList();
for (ExtensionPopupMenuItem menu : subMenus) {
mainPopupMenuItems.remove(menu);
}
subMenus.clear();
Session session = Model.getSingleton().getSession();
List<Context> contexts = session.getContexts();
for (Context context : contexts) {
ExtensionPopupMenuItem piicm = createPopupIncludeInContextMenu(context);
piicm.setMenuIndex(this.getMenuIndex());
mainPopupMenuItems.add(piicm);
this.subMenus.add(piicm);
}
// Add the 'new context' menu
ExtensionPopupMenuItem piicm = createPopupIncludeInContextMenu();
mainPopupMenuItems.add(piicm);
this.subMenus.add(piicm);
}
use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.
the class PopupExcludeFromProxyMenu method performAction.
@Override
public void performAction(SiteNode sn) {
try {
Session session = Model.getSingleton().getSession();
session.getExcludeFromProxyRegexs().add(new StructuralSiteNode(sn).getRegexPattern());
SiteMap map = (SiteMap) View.getSingleton().getSiteTreePanel().getTreeSite().getModel();
ExtensionHistory extHistory = Control.getSingleton().getExtensionLoader().getExtension(ExtensionHistory.class);
if (extHistory != null) {
extHistory.purge(map, sn);
}
} catch (DatabaseException e) {
// Ignore
}
}
use of org.parosproxy.paros.model.Session in project zaproxy by zaproxy.
the class SessionStructure method getNodeName.
private static String getNodeName(Model model, URI uri, String method, String postData) throws URIException {
Session session = model.getSession();
List<String> paths = getTreePath(model, uri);
String host = getHostName(uri);
String nodeUrl = pathsToUrl(host, paths, paths.size());
if (postData != null) {
String params = getParams(session, uri, postData);
if (params.length() > 0) {
nodeUrl = nodeUrl + " " + params;
}
}
return nodeUrl;
}
Aggregations