Skip to content

Commit 970cc40

Browse files
authored
Merge pull request #118 from thc202/rel/v2.0.0-rc.6
Update APIs and release 2.0.0-rc.6
2 parents eb1a934 + 78c56ad commit 970cc40

File tree

14 files changed

+321
-41
lines changed

14 files changed

+321
-41
lines changed

CHANGELOG.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,22 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
55

6-
## [Unreleased]
6+
## [2.0.0-rc.6] - 2025-01-20
7+
### Added
8+
- Add the API of the following add-on:
9+
- OAST Support
10+
11+
### Changed
12+
- Update core APIs for 2.16.
13+
- Update the APIs of the following add-ons:
14+
- AJAX Spider
15+
- Import/Export
16+
- OpenAPI Support
17+
- Passive Scanner
18+
- Replacer
19+
- Script Console
20+
- Selenium
21+
- Spider
722

823
## [2.0.0-rc.5] - 2024-04-10
924
### Changed
@@ -104,7 +119,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
104119
## 0.3.0 - 2017-12-04
105120

106121

107-
[Unreleased]: https://github.com/zaproxy/zap-api-nodejs/compare/v2.0.0-rc.5...HEAD
122+
[2.0.0-rc.6]: https://github.com/zaproxy/zap-api-nodejs/compare/v2.0.0-rc.5...v2.0.0-rc.6
108123
[2.0.0-rc.5]: https://github.com/zaproxy/zap-api-nodejs/compare/v2.0.0-rc.4...v2.0.0-rc.5
109124
[2.0.0-rc.4]: https://github.com/zaproxy/zap-api-nodejs/compare/v2.0.0-rc.3...v2.0.0-rc.4
110125
[2.0.0-rc.3]: https://github.com/zaproxy/zap-api-nodejs/compare/v2.0.0-rc.2...v2.0.0-rc.3

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "zaproxy",
33
"description": "ZAP API Client for Node.js",
4-
"version": "2.0.0-rc.5",
4+
"version": "2.0.0-rc.6",
55
"homepage": "https://github.com/zaproxy/zap-api-nodejs",
66
"author": {
77
"name": "Najam Ul Saqib",

src/ajaxSpider.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ AjaxSpider.prototype.optionClickElemsOnce = function () {
156156
return this.api.request('/ajaxSpider/view/optionClickElemsOnce/')
157157
}
158158

159+
/**
160+
* This component is optional and therefore the API will only work if it is installed
161+
**/
162+
AjaxSpider.prototype.optionEnableExtensions = function () {
163+
return this.api.request('/ajaxSpider/view/optionEnableExtensions/')
164+
}
165+
159166
/**
160167
* Gets if the AJAX Spider will use random values in form fields when crawling, if set to true.
161168
* This component is optional and therefore the API will only work if it is installed
@@ -354,6 +361,13 @@ AjaxSpider.prototype.setOptionClickElemsOnce = function (args) {
354361
return this.api.request('/ajaxSpider/action/setOptionClickElemsOnce/', { Boolean: args.bool })
355362
}
356363

364+
/**
365+
* This component is optional and therefore the API will only work if it is installed
366+
**/
367+
AjaxSpider.prototype.setOptionEnableExtensions = function (args) {
368+
return this.api.request('/ajaxSpider/action/setOptionEnableExtensions/', { Boolean: args.bool })
369+
}
370+
357371
/**
358372
* Sets the time to wait after an event (in milliseconds). For example: the wait delay after the cursor hovers over an element, in order for a menu to display, etc.
359373
* This component is optional and therefore the API will only work if it is installed

src/exim.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,24 @@ Exim.prototype.importModsec2Logs = function (args) {
6262
return this.api.request('/exim/action/importModsec2Logs/', { filePath: args.filepath })
6363
}
6464

65+
/**
66+
* Exports the Sites Tree in the Sites Tree YAML format.
67+
* This component is optional and therefore the API will only work if it is installed
68+
* @param {string} filepath
69+
**/
70+
Exim.prototype.exportSitesTree = function (args) {
71+
return this.api.request('/exim/action/exportSitesTree/', { filePath: args.filepath })
72+
}
73+
74+
/**
75+
* Prunes the Sites Tree based on a file in the Sites Tree YAML format.
76+
* This component is optional and therefore the API will only work if it is installed
77+
* @param {string} filepath
78+
**/
79+
Exim.prototype.pruneSitesTree = function (args) {
80+
return this.api.request('/exim/action/pruneSitesTree/', { filePath: args.filepath })
81+
}
82+
6583
/**
6684
* Gets the HTTP messages sent through/by ZAP, in HAR format, optionally filtered by URL and paginated with 'start' position and 'count' of messages
6785
* This component is optional and therefore the API will only work if it is installed

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const ForcedUser = require('./forcedUser')
3636
const Graphql = require('./graphql')
3737
const HttpSessions = require('./httpSessions')
3838
const Network = require('./network')
39+
const Oast = require('./oast')
3940
const Openapi = require('./openapi')
4041
const Params = require('./params')
4142
const Pnh = require('./pnh')
@@ -87,6 +88,7 @@ function ClientApi (options) {
8788
this.graphql = new Graphql(this)
8889
this.httpSessions = new HttpSessions(this)
8990
this.network = new Network(this)
91+
this.oast = new Oast(this)
9092
this.openapi = new Openapi(this)
9193
this.params = new Params(this)
9294
this.pnh = new Pnh(this)

src/oast.js

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
/* Zed Attack Proxy (ZAP) and its related class files.
2+
*
3+
* ZAP is an HTTP/HTTPS proxy for assessing web application security.
4+
*
5+
* Copyright 2025 the ZAP development team
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
20+
'use strict'
21+
22+
/**
23+
* This file was automatically generated.
24+
*/
25+
function Oast (clientApi) {
26+
this.api = clientApi
27+
}
28+
29+
/**
30+
* Gets the service used with the active scanner, if any.
31+
* This component is optional and therefore the API will only work if it is installed
32+
**/
33+
Oast.prototype.getActiveScanService = function () {
34+
return this.api.request('/oast/view/getActiveScanService/')
35+
}
36+
37+
/**
38+
* Gets all of the services.
39+
* This component is optional and therefore the API will only work if it is installed
40+
**/
41+
Oast.prototype.getServices = function () {
42+
return this.api.request('/oast/view/getServices/')
43+
}
44+
45+
/**
46+
* Gets the BOAST options.
47+
* This component is optional and therefore the API will only work if it is installed
48+
**/
49+
Oast.prototype.getBoastOptions = function () {
50+
return this.api.request('/oast/view/getBoastOptions/')
51+
}
52+
53+
/**
54+
* Gets the Callback options.
55+
* This component is optional and therefore the API will only work if it is installed
56+
**/
57+
Oast.prototype.getCallbackOptions = function () {
58+
return this.api.request('/oast/view/getCallbackOptions/')
59+
}
60+
61+
/**
62+
* Gets the Interactsh options.
63+
* This component is optional and therefore the API will only work if it is installed
64+
**/
65+
Oast.prototype.getInteractshOptions = function () {
66+
return this.api.request('/oast/view/getInteractshOptions/')
67+
}
68+
69+
/**
70+
* Gets the number of days the OAST records will be kept for.
71+
* This component is optional and therefore the API will only work if it is installed
72+
**/
73+
Oast.prototype.getDaysToKeepRecords = function () {
74+
return this.api.request('/oast/view/getDaysToKeepRecords/')
75+
}
76+
77+
/**
78+
* Sets the service used with the active scanner.
79+
* This component is optional and therefore the API will only work if it is installed
80+
* @param {string} name - The name of the service.
81+
**/
82+
Oast.prototype.setActiveScanService = function (args) {
83+
return this.api.request('/oast/action/setActiveScanService/', { name: args.name })
84+
}
85+
86+
/**
87+
* Sets the BOAST options.
88+
* This component is optional and therefore the API will only work if it is installed
89+
* @param {string} server - The server URL.
90+
* @param {string} pollinsecs - The polling frequency.
91+
**/
92+
Oast.prototype.setBoastOptions = function (args) {
93+
return this.api.request('/oast/action/setBoastOptions/', { server: args.server, pollInSecs: args.pollinsecs })
94+
}
95+
96+
/**
97+
* Sets the Callback options.
98+
* This component is optional and therefore the API will only work if it is installed
99+
* @param {string} localaddress - The local address
100+
* @param {string} remoteaddress - The remote address.
101+
* @param {string} port - The port to listen on.
102+
**/
103+
Oast.prototype.setCallbackOptions = function (args) {
104+
return this.api.request('/oast/action/setCallbackOptions/', { localAddress: args.localaddress, remoteAddress: args.remoteaddress, port: args.port })
105+
}
106+
107+
/**
108+
* Sets the Interactsh options.
109+
* This component is optional and therefore the API will only work if it is installed
110+
* @param {string} server - The server URL.
111+
* @param {string} pollinsecs - The polling frequency.
112+
* @param {string} authtoken - The Interactsh authentication token.
113+
**/
114+
Oast.prototype.setInteractshOptions = function (args) {
115+
return this.api.request('/oast/action/setInteractshOptions/', { server: args.server, pollInSecs: args.pollinsecs, authToken: args.authtoken })
116+
}
117+
118+
/**
119+
* Sets the number of days the OAST records will be kept for.
120+
* This component is optional and therefore the API will only work if it is installed
121+
* @param {string} days - The number of days.
122+
**/
123+
Oast.prototype.setDaysToKeepRecords = function (args) {
124+
return this.api.request('/oast/action/setDaysToKeepRecords/', { days: args.days })
125+
}
126+
127+
module.exports = Oast

src/openapi.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ function Openapi (clientApi) {
3131
* This component is optional and therefore the API will only work if it is installed
3232
* @param {string} file - The file that contains the OpenAPI definition.
3333
* @param {string} target - The Target URL to override the server URL present in the definition.
34-
* @param {string} contextid
34+
* @param {string} contextid - The ID of the context. Defaults to the first context, if any.
35+
* @param {string} userid - The ID of the user.
3536
**/
3637
Openapi.prototype.importFile = function (args) {
3738
const params = { file: args.file }
@@ -41,6 +42,9 @@ Openapi.prototype.importFile = function (args) {
4142
if (args.contextid && args.contextid !== null) {
4243
params.contextId = args.contextid
4344
}
45+
if (args.userid && args.userid !== null) {
46+
params.userId = args.userid
47+
}
4448
return this.api.request('/openapi/action/importFile/', params)
4549
}
4650

@@ -49,7 +53,8 @@ Openapi.prototype.importFile = function (args) {
4953
* This component is optional and therefore the API will only work if it is installed
5054
* @param {string} url - The URL locating the OpenAPI definition.
5155
* @param {string} hostoverride - The Target URL (called hostOverride for historical reasons) to override the server URL present in the definition.
52-
* @param {string} contextid
56+
* @param {string} contextid - The ID of the context. Defaults to the first context, if any.
57+
* @param {string} userid - The ID of the user.
5358
**/
5459
Openapi.prototype.importUrl = function (args) {
5560
const params = { url: args.url }
@@ -59,6 +64,9 @@ Openapi.prototype.importUrl = function (args) {
5964
if (args.contextid && args.contextid !== null) {
6065
params.contextId = args.contextid
6166
}
67+
if (args.userid && args.userid !== null) {
68+
params.userId = args.userid
69+
}
6270
return this.api.request('/openapi/action/importUrl/', params)
6371
}
6472

0 commit comments

Comments
 (0)