use of org.parosproxy.paros.model.HistoryReference in project zaproxy by zaproxy.
the class ExtensionHistory method buildHistory.
private void buildHistory(List<Integer> dbList, HistoryFilter historyFilter) {
HistoryReference historyRef = null;
synchronized (historyTableModel) {
if (getView() != null) {
getLogPanel().setModel(EMPTY_MODEL);
}
historyTableModel.clear();
for (int i = 0; i < dbList.size(); i++) {
int historyId = (dbList.get(i)).intValue();
try {
SiteNode sn = getModel().getSession().getSiteTree().getSiteNode(historyId);
if (sn != null && sn.getHistoryReference() != null && sn.getHistoryReference().getHistoryId() == historyId) {
historyRef = sn.getHistoryReference();
} else {
historyRef = getHistoryReference(historyId);
if (sn != null) {
sn.setHistoryReference(historyRef);
}
}
final String uri = historyRef.getURI().toString();
if (this.showJustInScope && !getModel().getSession().isInScope(uri)) {
// Not in scope
continue;
} else if (linkWithSitesTree && linkWithSitesTreeBaseUri != null && !uri.startsWith(linkWithSitesTreeBaseUri)) {
// Not under the selected node
continue;
}
if (historyFilter != null && !historyFilter.matches(historyRef)) {
// Not in filter
continue;
}
historyRef.loadAlerts();
historyTableModel.addHistoryReference(historyRef);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
if (getView() != null) {
getLogPanel().setModel(historyTableModel);
}
}
}
use of org.parosproxy.paros.model.HistoryReference in project zaproxy by zaproxy.
the class SpiderMessagesTableModel method addHistoryReference.
@Override
public void addHistoryReference(HistoryReference historyReference) {
HistoryReference latestHistoryReference = historyReference;
if (extensionHistory != null) {
latestHistoryReference = extensionHistory.getHistoryReference(historyReference.getHistoryId());
}
super.addHistoryReference(latestHistoryReference);
}
use of org.parosproxy.paros.model.HistoryReference in project zaproxy by zaproxy.
the class PopupMenuCopyUrls method performHistoryReferenceActions.
@Override
protected void performHistoryReferenceActions(List<HistoryReference> hrefs) {
StringBuilder sb = new StringBuilder();
for (HistoryReference href : hrefs) {
sb.append(href.getURI().toString());
sb.append("\n");
}
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(new StringSelection(sb.toString()), this);
}
use of org.parosproxy.paros.model.HistoryReference in project zaproxy by zaproxy.
the class Context method checkNode.
private boolean checkNode(SiteNode sn) {
// Loop backwards through the children TODO change for lowmem!
// log.debug("checkNode " + sn.getHierarchicNodeName()); // Useful for debugging
int origChildren = sn.getChildCount();
int movedChildren = 0;
for (SiteNode childNode : getChildren(sn)) {
if (checkNode(childNode)) {
movedChildren++;
}
}
if (this.isInContext(sn)) {
SiteMap sitesTree = this.session.getSiteTree();
HistoryReference href = sn.getHistoryReference();
try {
SiteNode sn2;
if (HttpRequestHeader.POST.equals(href.getMethod())) {
// Have to go to the db as POST data can be used in the name
sn2 = sitesTree.findNode(href.getHttpMessage());
} else {
// This is better as it doesnt require a db read
sn2 = sitesTree.findNode(href.getURI());
}
if (sn2 == null || !sn.getHierarchicNodeName().equals(sn2.getHierarchicNodeName())) {
if (!sn.isDataDriven()) {
moveNode(sitesTree, sn);
return true;
}
}
if (movedChildren > 0 && movedChildren == origChildren && sn.getChildCount() == 0) {
if (href.getHistoryType() == HistoryReference.TYPE_TEMPORARY) {
// Remove temp old node, no need to add new one in -
// that will happen when moving child nodes (if required)
deleteNode(sitesTree, sn);
return true;
}
}
// log.debug("Didnt need to move " + sn.getHierarchicNodeName()); // Useful for debugging
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
return false;
}
use of org.parosproxy.paros.model.HistoryReference in project zaproxy by zaproxy.
the class SpiderThread method readURI.
@Override
public void readURI(final HttpMessage msg) {
// Add the read message to the Site Map (tree or db structure)
try {
final HistoryReference historyRef = new HistoryReference(extension.getModel().getSession(), HistoryReference.TYPE_SPIDER, msg);
addMessageToSitesTree(historyRef, msg);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
Aggregations