Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update APIs of core and release 2.0.0-rc.5 #97

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ All notable changes to this project will be documented in this file.

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

## [Unreleased]
## [2.0.0-rc.5] - 2024-04-10
### Changed
* Update core APIs for 2.15.

## [2.0.0-rc.4] - 2023-11-24
### Added
Expand Down Expand Up @@ -100,7 +102,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
## 0.3.0 - 2017-12-04


[Unreleased]: https://github.com/zaproxy/zap-api-nodejs/compare/v2.0.0-rc.4...HEAD
[2.0.0-rc.5]: https://github.com/zaproxy/zap-api-nodejs/compare/v2.0.0-rc.4...v2.0.0-rc.5
[2.0.0-rc.4]: https://github.com/zaproxy/zap-api-nodejs/compare/v2.0.0-rc.3...v2.0.0-rc.4
[2.0.0-rc.3]: https://github.com/zaproxy/zap-api-nodejs/compare/v2.0.0-rc.2...v2.0.0-rc.3
[2.0.0-rc.2]: https://github.com/zaproxy/zap-api-nodejs/compare/v2.0.0-rc.1...v2.0.0-rc.2
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zaproxy",
"description": "ZAP API Client for Node.js",
"version": "2.0.0-rc.4",
"version": "2.0.0-rc.5",
"homepage": "https://github.com/zaproxy/zap-api-nodejs",
"author": {
"name": "Najam Ul Saqib",
Expand Down
2 changes: 1 addition & 1 deletion src/ajaxSpider.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ AjaxSpider.prototype.setOptionBrowserId = function (args) {
}

/**
* Sets whether or not the the AJAX Spider will only click on the default HTML elements.
* Sets whether or not the AJAX Spider will only click on the default HTML elements.
* This component is optional and therefore the API will only work if it is installed
* @param {string} bool - A boolean (true/false) indicating if only default elements such as 'a' 'button' 'input' should be clicked (default is true).
**/
Expand Down
15 changes: 15 additions & 0 deletions src/ascan.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,13 @@ Ascan.prototype.optionAllowAttackOnStart = function () {
return this.api.request('/ascan/view/optionAllowAttackOnStart/')
}

/**
* Tells whether or not the active scanner should encode cookie values.
**/
Ascan.prototype.optionEncodeCookieValues = function () {
return this.api.request('/ascan/view/optionEncodeCookieValues/')
}

/**
* Tells whether or not the active scanner should inject the HTTP request header X-ZAP-Scan-ID, with the ID of the scan rule that's sending the requests.
**/
Expand Down Expand Up @@ -719,6 +726,14 @@ Ascan.prototype.setOptionDelayInMs = function (args) {
return this.api.request('/ascan/action/setOptionDelayInMs/', { Integer: args.integer })
}

/**
* Sets whether or not the active scanner should encode cookie values.
* @param {string} bool
**/
Ascan.prototype.setOptionEncodeCookieValues = function (args) {
return this.api.request('/ascan/action/setOptionEncodeCookieValues/', { Boolean: args.bool })
}

/**
*
* @param {string} bool
Expand Down
21 changes: 21 additions & 0 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,18 @@ Core.prototype.numberOfAlerts = function (args) {
return this.api.request('/core/view/numberOfAlerts/', params)
}

/**
* The detailed logging config, optionally filtered based on a name (ex: starts with).
* @param {string} name - The name for which the logger details should be provided (this value will be used as a case insensitive starts with filter).
**/
Core.prototype.getLogLevel = function (args) {
const params = { }
if (args.name && args.name !== null) {
params.name = args.name
}
return this.api.request('/core/view/getLogLevel/', params)
}

/**
* Gets the user agent that ZAP should use when creating HTTP messages (for example, spider messages or CONNECT requests to outgoing proxy).
**/
Expand Down Expand Up @@ -648,6 +660,15 @@ Core.prototype.deleteAlert = function (args) {
return this.api.request('/core/action/deleteAlert/', { id: args.id })
}

/**
* Sets the logging level for a given logger name.
* @param {string} name - The logger name for which the logging level should be set.
* @param {string} loglevel - The logging level which should be set.
**/
Core.prototype.setLogLevel = function (args) {
return this.api.request('/core/action/setLogLevel/', { name: args.name, logLevel: args.loglevel })
}

/**
* Sets the user agent that ZAP should use when creating HTTP messages (for example, spider messages or CONNECT requests to outgoing proxy).
* @param {string} string
Expand Down
63 changes: 63 additions & 0 deletions src/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,27 @@ Search.prototype.urlsByUrlRegex = function (args) {
return this.api.request('/search/view/urlsByUrlRegex/', params)
}

/**
* Returns the URLs of the HTTP messages that match the given regular expression in their history Tags optionally filtered by URL and paginated with 'start' position and 'count' of messages.
* @param {string} regex
* @param {string} baseurl - The highest URL in the Sites tree under which URLs should be included.
* @param {string} start
* @param {string} count
**/
Search.prototype.urlsByTagRegex = function (args) {
const params = { regex: args.regex }
if (args.baseurl && args.baseurl !== null) {
params.baseurl = args.baseurl
}
if (args.start && args.start !== null) {
params.start = args.start
}
if (args.count && args.count !== null) {
params.count = args.count
}
return this.api.request('/search/view/urlsByTagRegex/', params)
}

/**
* Returns the URLs of the HTTP messages that match the given regular expression in the request optionally filtered by URL and paginated with 'start' position and 'count' of messages.
* @param {string} regex
Expand Down Expand Up @@ -131,6 +152,27 @@ Search.prototype.messagesByUrlRegex = function (args) {
return this.api.request('/search/view/messagesByUrlRegex/', params)
}

/**
* Returns the HTTP messages that match the given regular expression in their history Tags optionally filtered by URL and paginated with 'start' position and 'count' of messages.
* @param {string} regex
* @param {string} baseurl - The highest URL in the Sites tree under which messages should be included.
* @param {string} start
* @param {string} count
**/
Search.prototype.messagesByTagRegex = function (args) {
const params = { regex: args.regex }
if (args.baseurl && args.baseurl !== null) {
params.baseurl = args.baseurl
}
if (args.start && args.start !== null) {
params.start = args.start
}
if (args.count && args.count !== null) {
params.count = args.count
}
return this.api.request('/search/view/messagesByTagRegex/', params)
}

/**
* Returns the HTTP messages that match the given regular expression in the request optionally filtered by URL and paginated with 'start' position and 'count' of messages.
* @param {string} regex
Expand Down Expand Up @@ -215,6 +257,27 @@ Search.prototype.harByUrlRegex = function (args) {
return this.api.request('/search/other/harByUrlRegex/', params, 'other')
}

/**
* Returns the HTTP messages, in HAR format, that match the given regular expression in their history Tags optionally filtered by URL and paginated with 'start' position and 'count' of messages.
* @param {string} regex
* @param {string} baseurl - The highest URL in the Sites tree under which URLs should be included.
* @param {string} start
* @param {string} count
**/
Search.prototype.harByTagRegex = function (args) {
const params = { regex: args.regex }
if (args.baseurl && args.baseurl !== null) {
params.baseurl = args.baseurl
}
if (args.start && args.start !== null) {
params.start = args.start
}
if (args.count && args.count !== null) {
params.count = args.count
}
return this.api.request('/search/other/harByTagRegex/', params, 'other')
}

/**
* Returns the HTTP messages, in HAR format, that match the given regular expression in the request optionally filtered by URL and paginated with 'start' position and 'count' of messages.
* @param {string} regex
Expand Down
2 changes: 1 addition & 1 deletion src/wappalyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Wappalyzer (clientApi) {
}

/**
* Lists all the sites recognized by the wappalyzer addon.
* Lists all the sites recognized by the Technology Detection add-on.
* This component is optional and therefore the API will only work if it is installed
**/
Wappalyzer.prototype.listSites = function () {
Expand Down