use of org.zaproxy.zap.model.Target in project zaproxy by zaproxy.
the class ExtensionActiveScan method getMenuItemCustomScan.
private ZapMenuItem getMenuItemCustomScan() {
if (menuItemCustomScan == null) {
menuItemCustomScan = new ZapMenuItem("menu.tools.ascanadv", getView().getMenuShortcutKeyStroke(KeyEvent.VK_A, KeyEvent.ALT_DOWN_MASK, false));
menuItemCustomScan.setEnabled(Control.getSingleton().getMode() != Mode.safe);
menuItemCustomScan.addActionListener(e -> showCustomScanDialog((Target) null));
}
return menuItemCustomScan;
}
use of org.zaproxy.zap.model.Target in project zaproxy by zaproxy.
the class ExtensionActiveScan method startScanAllInScope.
public void startScanAllInScope() {
SiteNode snroot = Model.getSingleton().getSession().getSiteTree().getRoot();
this.startScan(new Target(snroot, null, true, true));
}
use of org.zaproxy.zap.model.Target in project zaproxy by zaproxy.
the class NodeSelectDialog method showDialog.
public Target showDialog(Target defaultTarget) {
// Assume Contexts can be selected
this.getTreeContext().setVisible(true);
SiteNode siteRoot = Model.getSingleton().getSession().getSiteTree().getRoot();
populateContexts((SiteNode) this.contextTree.getRoot());
if (defaultTarget != null) {
populateNode(siteRoot, (SiteNode) this.siteTree.getRoot(), defaultTarget.getStartNode());
} else {
populateNode(siteRoot, (SiteNode) this.siteTree.getRoot(), null);
}
if (selectedSiteNode != null) {
// Found the default node, select it
TreePath path = new TreePath(this.siteTree.getPathToRoot(selectedSiteNode));
this.getTreeSite().setExpandsSelectedPaths(true);
this.getTreeSite().setSelectionPath(path);
this.getTreeSite().scrollPathToVisible(path);
this.getTreeSite().expandPath(path);
} else {
// no default path, just expand the top level
TreePath path = new TreePath(this.siteTree.getPathToRoot((TreeNode) this.siteTree.getRoot()));
this.getTreeSite().expandPath(path);
}
this.setVisible(true);
// The dialog is modal so this wont return until the dialog visibility is unset
if (selectedSiteNode != null) {
return new Target(selectedSiteNode);
}
return selectedTarget;
}
use of org.zaproxy.zap.model.Target in project zaproxy by zaproxy.
the class StandardFieldsDialog method addTargetSelectField.
/**
* Add a 'node select' field to a non tabbed dialog. This includes a button for showing a Node
* Select Dialog and a field for showing the selected node.
*
* @param fieldLabel the {@code I18N} key for the field label, should not be null
* @param value the selected {@code Target} to show, can be null
* @param editable whether the field showing selected {@code Target} is editable or not
* @param allowRoot whether to allow root {@code SiteNode} to be selected as {@code Target}
* value or not
* @since 2.8.0
* @see #addTargetSelectField(int, String, Target, boolean, boolean)
*/
public void addTargetSelectField(final String fieldLabel, final Target value, final boolean editable, final boolean allowRoot) {
validateNotTabbed();
final ZapTextField text = new ZapTextField();
text.setEditable(editable);
this.setTextTarget(text, value);
JButton selectButton = new JButton(Constant.messages.getString("all.button.select"));
selectButton.setIcon(// Globe icon
new ImageIcon(View.class.getResource("/resource/icon/16/094.png")));
selectButton.addActionListener(new java.awt.event.ActionListener() {
// Keep a local copy so that we can always select the last node chosen
Target target = value;
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
NodeSelectDialog nsd = new NodeSelectDialog(StandardFieldsDialog.this);
nsd.setAllowRoot(allowRoot);
target = nsd.showDialog(target);
setTextTarget(text, target);
targetSelected(fieldLabel, target);
}
});
JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
panel.add(text, LayoutHelper.getGBC(0, 0, 1, 1.0D, 0.0D, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4)));
panel.add(selectButton, LayoutHelper.getGBC(1, 0, 1, 0.0D, 0.0D, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4)));
this.addField(fieldLabel, text, panel, 0.0D);
}
use of org.zaproxy.zap.model.Target in project zaproxy by zaproxy.
the class HistoryReference method notifyEvent.
private void notifyEvent(String event) {
Map<String, String> map = new HashMap<>();
map.put(HistoryReferenceEventPublisher.FIELD_HISTORY_REFERENCE_ID, Integer.toString(historyId));
ZAP.getEventBus().publishSyncEvent(HistoryReferenceEventPublisher.getPublisher(), new Event(HistoryReferenceEventPublisher.getPublisher(), event, new Target(getSiteNode()), map));
}
Aggregations