-
-
Notifications
You must be signed in to change notification settings - Fork 718
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Client: Map initial context menu options
Signed-off-by: Simon Bennetts <psiinon@gmail.com>
- Loading branch information
Showing
16 changed files
with
571 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientAttack.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Zed Attack Proxy (ZAP) and its related class files. | ||
* | ||
* ZAP is an HTTP/HTTPS proxy for assessing web application security. | ||
* | ||
* Copyright 2023 The ZAP Development Team | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.zaproxy.addon.client; | ||
|
||
import java.awt.Component; | ||
import java.awt.event.ActionEvent; | ||
import org.parosproxy.paros.Constant; | ||
|
||
public class PopupMenuClientAttack extends PopupMenuItemClient { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public PopupMenuClientAttack(ClientMapPanel clientMapPanel) { | ||
super(Constant.messages.getString("client.tree.popup.attack"), clientMapPanel); | ||
} | ||
|
||
@Override | ||
public boolean isEnableForComponent(Component invoker) { | ||
boolean enabled = super.isEnableForComponent(invoker); | ||
if (enabled) { | ||
// For now its a placeholder / tease ;) | ||
this.setEnabled(false); | ||
} | ||
return enabled; | ||
} | ||
|
||
@Override | ||
public void performAction(ActionEvent e) { | ||
// Do nothing for now | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientCopyUrls.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Zed Attack Proxy (ZAP) and its related class files. | ||
* | ||
* ZAP is an HTTP/HTTPS proxy for assessing web application security. | ||
* | ||
* Copyright 2023 The ZAP Development Team | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.zaproxy.addon.client; | ||
|
||
import java.awt.Toolkit; | ||
import java.awt.datatransfer.Clipboard; | ||
import java.awt.datatransfer.StringSelection; | ||
import java.awt.event.ActionEvent; | ||
import org.parosproxy.paros.Constant; | ||
|
||
public class PopupMenuClientCopyUrls extends PopupMenuItemClient { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public PopupMenuClientCopyUrls(ClientMapPanel clientMapPanel) { | ||
super(Constant.messages.getString("client.tree.popup.copyurls"), clientMapPanel); | ||
} | ||
|
||
@Override | ||
public void performAction(ActionEvent e) { | ||
StringBuilder sb = new StringBuilder(); | ||
for (ClientNode node : getClientMapPanel().getSelectedNodes()) { | ||
if (!node.isRoot() | ||
&& node.getUserObject() != null | ||
&& !node.getUserObject().isStorage()) { | ||
sb.append(node.getUserObject().getUrl()); | ||
sb.append('\n'); | ||
} | ||
} | ||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); | ||
clipboard.setContents(new StringSelection(sb.toString()), null); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
addOns/client/src/main/java/org/zaproxy/addon/client/PopupMenuClientDelete.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Zed Attack Proxy (ZAP) and its related class files. | ||
* | ||
* ZAP is an HTTP/HTTPS proxy for assessing web application security. | ||
* | ||
* Copyright 2023 The ZAP Development Team | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.zaproxy.addon.client; | ||
|
||
import java.awt.event.ActionEvent; | ||
import javax.swing.JOptionPane; | ||
import org.parosproxy.paros.Constant; | ||
import org.parosproxy.paros.view.View; | ||
|
||
public class PopupMenuClientDelete extends PopupMenuItemClient { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public PopupMenuClientDelete(ClientMapPanel clientMapPanel) { | ||
super(Constant.messages.getString("client.tree.popup.delete"), clientMapPanel); | ||
} | ||
|
||
@Override | ||
public void performAction(ActionEvent e) { | ||
if (View.getSingleton() | ||
.showConfirmDialog( | ||
Constant.messages.getString("client.tree.popup.delete.confirm")) | ||
== JOptionPane.OK_OPTION) { | ||
getClientMapPanel().getExtension().deleteNodes(getClientMapPanel().getSelectedNodes()); | ||
} | ||
} | ||
} |
Oops, something went wrong.