Search in sources :

Example 1 with AlertNode

use of org.zaproxy.zap.extension.alert.AlertNode 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;
}
Also used : HistoryReference(org.parosproxy.paros.model.HistoryReference) AlertNode(org.zaproxy.zap.extension.alert.AlertNode) Alert(org.parosproxy.paros.core.scanner.Alert) SiteNode(org.parosproxy.paros.model.SiteNode)

Example 2 with AlertNode

use of org.zaproxy.zap.extension.alert.AlertNode 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;
}
Also used : HistoryReference(org.parosproxy.paros.model.HistoryReference) TreePath(javax.swing.tree.TreePath) ArrayList(java.util.ArrayList) AlertNode(org.zaproxy.zap.extension.alert.AlertNode) Alert(org.parosproxy.paros.core.scanner.Alert) SiteNode(org.parosproxy.paros.model.SiteNode)

Aggregations

Alert (org.parosproxy.paros.core.scanner.Alert)2 HistoryReference (org.parosproxy.paros.model.HistoryReference)2 SiteNode (org.parosproxy.paros.model.SiteNode)2 AlertNode (org.zaproxy.zap.extension.alert.AlertNode)2 ArrayList (java.util.ArrayList)1 TreePath (javax.swing.tree.TreePath)1