use of org.parosproxy.paros.model.SiteNode in project zaproxy by zaproxy.
the class PopupMenuExportURLs method performAction.
protected void performAction() {
File file = getOutputFile();
if (file == null) {
return;
}
writeURLs(file, getOutputSet((SiteNode) extension.getView().getSiteTreePanel().getTreeSite().getModel().getRoot()));
}
use of org.parosproxy.paros.model.SiteNode in project zaproxy by zaproxy.
the class PopupMenuPurgeHistory method purgeHistory.
private void purgeHistory(HistoryReference ref) {
if (ref == null) {
return;
}
extension.removeFromHistoryList(ref);
ExtensionAlert extAlert = (ExtensionAlert) Control.getSingleton().getExtensionLoader().getExtension(ExtensionAlert.NAME);
if (extAlert != null) {
extAlert.deleteHistoryReferenceAlerts(ref);
}
extension.delete(ref);
SiteNode node = ref.getSiteNode();
if (node == null) {
return;
}
SiteMap map = Model.getSingleton().getSession().getSiteTree();
if (node.getHistoryReference() == ref) {
// same active Node
extension.purge(map, node);
} else {
node.getPastHistoryReference().remove(ref);
map.removeHistoryReference(ref.getHistoryId());
}
}
use of org.parosproxy.paros.model.SiteNode in project zaproxy by zaproxy.
the class ExtensionHistory method purge.
public void purge(SiteMap map, SiteNode node) {
SiteNode child = null;
synchronized (map) {
while (node.getChildCount() > 0) {
try {
child = (SiteNode) node.getChildAt(0);
purge(map, child);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
if (node.isRoot()) {
return;
}
// delete reference in node
removeFromHistoryList(node.getHistoryReference());
ExtensionAlert extAlert = Control.getSingleton().getExtensionLoader().getExtension(ExtensionAlert.class);
if (node.getHistoryReference() != null) {
deleteAlertsFromExtensionAlert(extAlert, node.getHistoryReference());
node.getHistoryReference().delete();
map.removeHistoryReference(node.getHistoryReference().getHistoryId());
}
// delete past reference in node
while (node.getPastHistoryReference().size() > 0) {
HistoryReference ref = node.getPastHistoryReference().get(0);
deleteAlertsFromExtensionAlert(extAlert, ref);
removeFromHistoryList(ref);
delete(ref);
node.getPastHistoryReference().remove(0);
map.removeHistoryReference(ref.getHistoryId());
}
map.removeNodeFromParent(node);
}
}
use of org.parosproxy.paros.model.SiteNode in project zaproxy by zaproxy.
the class PopupMenuHistoryReference method getSelectedHistoryReference.
private HistoryReference getSelectedHistoryReference() {
HistoryReference ref = null;
try {
switch(lastInvoker) {
case sites:
SiteNode sNode = (SiteNode) treeInvoker.getLastSelectedPathComponent();
ref = sNode.getHistoryReference();
break;
case ascan:
case history:
case bruteforce:
case search:
case fuzz:
ref = hrefsTableInvoker.getSelectedHistoryReference();
break;
case alerts:
AlertNode aNode = (AlertNode) treeInvoker.getLastSelectedPathComponent();
if (aNode.getUserObject() != null) {
Alert alert = aNode.getUserObject();
ref = alert.getHistoryRef();
}
break;
case hreftable:
ref = hrefTableInvoker.getSelectedHistoryReference();
break;
}
} catch (Exception e2) {
log.error(e2.getMessage(), e2);
}
return ref;
}
use of org.parosproxy.paros.model.SiteNode in project zaproxy by zaproxy.
the class PopupMenuHistoryReference method getSelectedHistoryReferences.
private List<HistoryReference> getSelectedHistoryReferences() {
List<HistoryReference> refs = new ArrayList<>();
TreePath[] treePaths = null;
try {
switch(lastInvoker) {
case sites:
treePaths = treeInvoker.getSelectionPaths();
if (treePaths != null) {
for (TreePath path : treePaths) {
SiteNode node = (SiteNode) path.getLastPathComponent();
refs.add(node.getHistoryReference());
}
}
break;
case ascan:
case history:
case bruteforce:
case fuzz:
case search:
refs = hrefsTableInvoker.getSelectedHistoryReferences();
break;
case alerts:
// Only support single items
AlertNode aNode = (AlertNode) treeInvoker.getLastSelectedPathComponent();
if (aNode.getUserObject() != null) {
Alert alert = aNode.getUserObject();
refs.add(alert.getHistoryRef());
}
break;
case hreftable:
refs = hrefTableInvoker.getSelectedHistoryReferences();
break;
}
} catch (Exception e2) {
log.error(e2.getMessage(), e2);
}
return refs;
}
Aggregations