Skip to content

Commit 7c618dc

Browse files
committed
Add Number of Browsers and Scope check to the client spider API
1 parent d9af8d6 commit 7c618dc

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

addOns/client/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
77
### Added
88
- Edge recorder link to help.
99
- Support for stopping the spiderCient automation job.
10+
- Optional `numberOfBrowsers` parameter for the Client Spider API action `scan` to control concurrency (number of browser windows).
11+
- Optional `scopeCheck` parameter for the Client Spider API action `scan` to select Scope Check (Flexible or Strict).
1012

1113
### Changed
1214
- Updated Chrome and Firefox extensions to v0.1.5.

addOns/client/src/main/java/org/zaproxy/addon/client/spider/ClientSpiderApi.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ public class ClientSpiderApi extends ApiImplementor {
6363
private static final String PARAM_USER_NAME = "userName";
6464
private static final String PARAM_MAX_CRAWL_DEPTH = "maxCrawlDepth";
6565
private static final String PARAM_PAGE_LOAD_TIME = "pageLoadTime";
66+
private static final String PARAM_NUMBER_OF_BROWSERS = "numberOfBrowsers";
67+
private static final String PARAM_SCOPE_CHECK = "scopeCheck";
6668

6769
private final ExtensionClientIntegration extension;
6870

@@ -84,7 +86,9 @@ public ClientSpiderApi(ExtensionClientIntegration extension) {
8486
PARAM_USER_NAME,
8587
PARAM_SUBTREE_ONLY,
8688
PARAM_MAX_CRAWL_DEPTH,
87-
PARAM_PAGE_LOAD_TIME)));
89+
PARAM_PAGE_LOAD_TIME,
90+
PARAM_NUMBER_OF_BROWSERS,
91+
PARAM_SCOPE_CHECK)));
8892

8993
addApiAction(new ApiAction(ACTION_STOP_SCAN, List.of(PARAM_SCAN_ID)));
9094

@@ -152,6 +156,12 @@ private ApiResponse startScan(String name, JSONObject params) throws ApiExceptio
152156
if (params.containsKey(PARAM_PAGE_LOAD_TIME)) {
153157
options.setPageLoadTimeInSecs(ApiUtils.getIntParam(params, PARAM_PAGE_LOAD_TIME));
154158
}
159+
if (params.containsKey(PARAM_NUMBER_OF_BROWSERS)) {
160+
options.setThreadCount(ApiUtils.getIntParam(params, PARAM_NUMBER_OF_BROWSERS));
161+
}
162+
if (params.containsKey(PARAM_SCOPE_CHECK)) {
163+
options.setScopeCheck(params.getString(PARAM_SCOPE_CHECK));
164+
}
155165

156166
User user = getUser(params, context);
157167

addOns/client/src/main/resources/org/zaproxy/addon/client/resources/Messages.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ client.clientSpider.api.action.scan = Starts a client spider scan.
3131
client.clientSpider.api.action.scan.param.browser = The ID of the browser. See Selenium documentation for valid IDs.
3232
client.clientSpider.api.action.scan.param.contextName = The name of the context.
3333
client.clientSpider.api.action.scan.param.maxCrawlDepth = Maximum Crawl Depth (0 is unlimited).
34+
client.clientSpider.api.action.scan.param.numberOfBrowsers = Number of Browser Windows to Open (concurrency).
3435
client.clientSpider.api.action.scan.param.pageLoadTime = Page Load Time (seconds).
36+
client.clientSpider.api.action.scan.param.scopeCheck = Scope Check (FLEXIBLE or STRICT).
3537
client.clientSpider.api.action.scan.param.subtreeOnly = true to spider only under the subtree, false otherwise.
3638
client.clientSpider.api.action.scan.param.url = The URL from where to start the spider.
3739
client.clientSpider.api.action.scan.param.userName = The name of the user.

0 commit comments

Comments
 (0)