File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ All notable changes to this add-on will be documented in this file.
4
4
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) .
5
5
6
6
## [ Unreleased]
7
+ ### Added
8
+ - Standalone script 'PrivateMethodAccess.js'
7
9
### Changed
8
10
- Add cautionary note to help and readme.
9
11
### Fixed
Original file line number Diff line number Diff line change
1
+ /*
2
+ When writing scripts you may find that you need to access private java methods.
3
+ This script shows how you can do this easily.
4
+
5
+ WARNING: we do not consider private methods to be part of the code API, so they may
6
+ be changed or removed at any time.
7
+ If you think you have a strong case for making a method public then either:
8
+
9
+ 1. Ask on the ZAP Dev Group: https://groups.google.com/group/zaproxy-develop
10
+ 2. Submit a pull request making the change (but be prepared for it to be rejected)
11
+
12
+ */
13
+
14
+ var ExtensionAlert = Java . type (
15
+ "org.zaproxy.zap.extension.alert.ExtensionAlert"
16
+ ) ;
17
+ var MethodUtils = Java . type ( "org.apache.commons.lang3.reflect.MethodUtils" ) ;
18
+
19
+ extAlert = control . getExtensionLoader ( ) . getExtension ( ExtensionAlert ) ;
20
+
21
+ print ( extAlert ) ;
22
+
23
+ // Note that there are a lot of other methods in MethodUtils, e.g. for passing parameters.
24
+ print ( MethodUtils . invokeMethod ( extAlert , true , "getAlertPanel" ) ) ;
You can’t perform that action at this time.
0 commit comments