From 023c2f2427524da7f87c1eb243b25c9c1f165bc8 Mon Sep 17 00:00:00 2001 From: Alessio Dalla Piazza Date: Tue, 2 Jul 2024 11:46:52 +0200 Subject: [PATCH 01/14] update go version Signed-off-by: Alessio Dalla Piazza --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 4563020..0f34d0f 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/zaproxy/zap-api-go -go 1.17 +go 1.22 From 6890df601b4e922617b574cbacf55f3cd6124926 Mon Sep 17 00:00:00 2001 From: Alessio Dalla Piazza Date: Tue, 2 Jul 2024 11:50:19 +0200 Subject: [PATCH 02/14] update README.md Signed-off-by: Alessio Dalla Piazza --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4fc0ee1..9ecdc22 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ You should typically generate the core API calls from the latest release tag e.g ``` cd zaproxy git fetch upstream -t -git checkout tags/v2.13.0 +git checkout tags/v2.15.0 ./gradlew generateGoApiEndpoints cd .. ``` From af7152a7174f6c805d109e393171dd1e117b2acb Mon Sep 17 00:00:00 2001 From: Alessio Dalla Piazza Date: Tue, 2 Jul 2024 11:50:25 +0200 Subject: [PATCH 03/14] update lint action Signed-off-by: Alessio Dalla Piazza --- .github/workflows/golangci-lint.yaml | 30 +++++----------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml index e07f52e..2c44cf9 100644 --- a/.github/workflows/golangci-lint.yaml +++ b/.github/workflows/golangci-lint.yaml @@ -4,37 +4,17 @@ on: branches: - master pull_request: - + permissions: contents: read - # Optional: allow read access to pull request. Use with `only-new-issues` option. - # pull-requests: read + jobs: golangci: name: lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: golangci-lint - uses: golangci/golangci-lint-action@v2 + - uses: actions/checkout@v4 + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v6 with: - # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version version: latest - - # Optional: working directory, useful for monorepos - # working-directory: somedir - - # Optional: golangci-lint command line arguments. - # args: --issues-exit-code=0 - - # Optional: show only new issues if it's a pull request. The default value is `false`. - # only-new-issues: true - - # Optional: if set to true then the action will use pre-installed Go. - # skip-go-installation: true - - # Optional: if set to true then the action don't cache or restore ~/go/pkg. - # skip-pkg-cache: true - - # Optional: if set to true then the action don't cache or restore ~/.cache/go-build. - # skip-build-cache: true \ No newline at end of file From 4cf6a11ad8fbb0864a7ef58633e56a92e9e75984 Mon Sep 17 00:00:00 2001 From: Alessio Dalla Piazza Date: Tue, 2 Jul 2024 11:57:50 +0200 Subject: [PATCH 04/14] add folder to git ignore Signed-off-by: Alessio Dalla Piazza --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index daf913b..6b3cdf4 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ _testmain.go *.exe *.test *.prof + +zaproxy/ +zap-extensions/ From 7214bd2873f9484b3732d84eccbb524880e152e4 Mon Sep 17 00:00:00 2001 From: Alessio Dalla Piazza Date: Tue, 2 Jul 2024 11:58:00 +0200 Subject: [PATCH 05/14] improve README.md Signed-off-by: Alessio Dalla Piazza --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9ecdc22..d30880f 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,13 @@ Most of the API code is generated from the ZAP java source code. To regenerate the API code you will need the repos [zaproxy](https://github.com/zaproxy/zaproxy) and [zap-extensions](https://github.com/zaproxy/zap-extensions) checked out at the same level as this one. -You should typically generate the core API calls from the latest release tag e.g.: +Cloning the Repositories: +``` +git clone --recursive -j8 https://github.com/zaproxy/zaproxy.git +git clone --recursive -j8 https://github.com/zaproxy/zap-extensions.git +``` + +Typically, you should generate the core API calls from the latest release tag. For example: ``` cd zaproxy @@ -32,7 +38,7 @@ git checkout tags/v2.15.0 cd .. ``` -The add-on APIs can be generated from the zap-extensions `main` branch: +The add-on APIs can be generated from the zap-extensions main branch: ``` cd zap-extensions From 33032b727107301c4acf97e5514c194ebc86cbbd Mon Sep 17 00:00:00 2001 From: Alessio Dalla Piazza Date: Tue, 2 Jul 2024 12:01:55 +0200 Subject: [PATCH 06/14] remove old folder Signed-off-by: Alessio Dalla Piazza --- zap/access-control_generated.go | 71 ---- zap/acsrf_generated.go | 70 ---- zap/ajax-spider_generated.go | 302 ------------- zap/alert-filter_generated.go | 167 -------- zap/alert_generated.go | 151 ------- zap/ascan_generated.go | 591 -------------------------- zap/authentication_generated.go | 91 ---- zap/authorization_generated.go | 46 -- zap/automation_generated.go | 47 --- zap/autoupdate_generated.go | 199 --------- zap/brk_generated.go | 104 ----- zap/client.go | 141 ------- zap/context_generated.go | 202 --------- zap/core_generated.go | 630 ---------------------------- zap/exportreport_generated.go | 45 -- zap/forced-user_generated.go | 58 --- zap/graphql_generated.go | 186 -------- zap/http-sessions_generated.go | 161 ------- zap/import-log-files_generated.go | 67 --- zap/importurls_generated.go | 36 -- zap/interface.go | 264 ------------ zap/local-proxies_generated.go | 52 --- zap/openapi_generated.go | 50 --- zap/params_generated.go | 34 -- zap/pnh_generated.go | 79 ---- zap/pscan_generated.go | 120 ------ zap/replacer_generated.go | 70 ---- zap/reports_generated.go | 65 --- zap/retest_generated.go | 34 -- zap/reveal_generated.go | 43 -- zap/revisit_generated.go | 49 --- zap/rule-config_generated.go | 61 --- zap/script_generated.go | 212 ---------- zap/search_generated.go | 158 ------- zap/selenium_generated.go | 125 ------ zap/session-management_generated.go | 57 --- zap/soap_generated.go | 46 -- zap/spider_generated.go | 464 -------------------- zap/stats_generated.go | 118 ------ zap/users_generated.go | 170 -------- zap/wappalyzer_generated.go | 50 --- zap/websocket_generated.go | 87 ---- 42 files changed, 5773 deletions(-) delete mode 100644 zap/access-control_generated.go delete mode 100644 zap/acsrf_generated.go delete mode 100644 zap/ajax-spider_generated.go delete mode 100644 zap/alert-filter_generated.go delete mode 100644 zap/alert_generated.go delete mode 100644 zap/ascan_generated.go delete mode 100644 zap/authentication_generated.go delete mode 100644 zap/authorization_generated.go delete mode 100644 zap/automation_generated.go delete mode 100644 zap/autoupdate_generated.go delete mode 100644 zap/brk_generated.go delete mode 100644 zap/client.go delete mode 100644 zap/context_generated.go delete mode 100644 zap/core_generated.go delete mode 100644 zap/exportreport_generated.go delete mode 100644 zap/forced-user_generated.go delete mode 100644 zap/graphql_generated.go delete mode 100644 zap/http-sessions_generated.go delete mode 100644 zap/import-log-files_generated.go delete mode 100644 zap/importurls_generated.go delete mode 100644 zap/interface.go delete mode 100644 zap/local-proxies_generated.go delete mode 100644 zap/openapi_generated.go delete mode 100644 zap/params_generated.go delete mode 100644 zap/pnh_generated.go delete mode 100644 zap/pscan_generated.go delete mode 100644 zap/replacer_generated.go delete mode 100644 zap/reports_generated.go delete mode 100644 zap/retest_generated.go delete mode 100644 zap/reveal_generated.go delete mode 100644 zap/revisit_generated.go delete mode 100644 zap/rule-config_generated.go delete mode 100644 zap/script_generated.go delete mode 100644 zap/search_generated.go delete mode 100644 zap/selenium_generated.go delete mode 100644 zap/session-management_generated.go delete mode 100644 zap/soap_generated.go delete mode 100644 zap/spider_generated.go delete mode 100644 zap/stats_generated.go delete mode 100644 zap/users_generated.go delete mode 100644 zap/wappalyzer_generated.go delete mode 100644 zap/websocket_generated.go diff --git a/zap/access-control_generated.go b/zap/access-control_generated.go deleted file mode 100644 index 6bb7c3e..0000000 --- a/zap/access-control_generated.go +++ /dev/null @@ -1,71 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type AccessControl struct { - c *Client -} - -// Gets the Access Control scan progress (percentage integer) for the given context ID. -// -// This component is optional and therefore the API will only work if it is installed -func (a AccessControl) GetScanProgress(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return a.c.Request("accessControl/view/getScanProgress/", m) -} - -// Gets the Access Control scan status (description string) for the given context ID. -// -// This component is optional and therefore the API will only work if it is installed -func (a AccessControl) GetScanStatus(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return a.c.Request("accessControl/view/getScanStatus/", m) -} - -// Starts an Access Control scan with the given context ID and user ID. (Optional parameters: user ID for Unauthenticated user, boolean identifying whether or not Alerts are raised, and the Risk level for the Alerts.) [This assumes the Access Control rules were previously established via ZAP gui and the necessary Context exported/imported.] -// -// This component is optional and therefore the API will only work if it is installed -func (a AccessControl) Scan(contextid string, userid string, scanasunauthuser string, raisealert string, alertrisklevel string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - "scanAsUnAuthUser": scanasunauthuser, - "raiseAlert": raisealert, - "alertRiskLevel": alertrisklevel, - } - return a.c.Request("accessControl/action/scan/", m) -} - -// Generates an Access Control report for the given context ID and saves it based on the provided filename (path). -// -// This component is optional and therefore the API will only work if it is installed -func (a AccessControl) WriteHTMLreport(contextid string, filename string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "fileName": filename, - } - return a.c.Request("accessControl/action/writeHTMLreport/", m) -} diff --git a/zap/acsrf_generated.go b/zap/acsrf_generated.go deleted file mode 100644 index fe78831..0000000 --- a/zap/acsrf_generated.go +++ /dev/null @@ -1,70 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -import "strconv" - -type Acsrf struct { - c *Client -} - -// Lists the names of all anti-CSRF tokens -func (a Acsrf) OptionTokensNames() (map[string]interface{}, error) { - return a.c.Request("acsrf/view/optionTokensNames/", nil) -} - -// Define if ZAP should detect CSRF tokens by searching for partial matches -func (a Acsrf) OptionPartialMatchingEnabled() (map[string]interface{}, error) { - return a.c.Request("acsrf/view/optionPartialMatchingEnabled/", nil) -} - -// Adds an anti-CSRF token with the given name, enabled by default -func (a Acsrf) AddOptionToken(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return a.c.Request("acsrf/action/addOptionToken/", m) -} - -// Removes the anti-CSRF token with the given name -func (a Acsrf) RemoveOptionToken(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return a.c.Request("acsrf/action/removeOptionToken/", m) -} - -// Define if ZAP should detect CSRF tokens by searching for partial matches. -func (a Acsrf) SetOptionPartialMatchingEnabled(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("acsrf/action/setOptionPartialMatchingEnabled/", m) -} - -// Generate a form for testing lack of anti-CSRF tokens - typically invoked via ZAP -func (a Acsrf) GenForm(hrefid string) ([]byte, error) { - m := map[string]string{ - "hrefId": hrefid, - } - return a.c.RequestOther("acsrf/other/genForm/", m) -} diff --git a/zap/ajax-spider_generated.go b/zap/ajax-spider_generated.go deleted file mode 100644 index 613bbf3..0000000 --- a/zap/ajax-spider_generated.go +++ /dev/null @@ -1,302 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -import "strconv" - -type AjaxSpider struct { - c *Client -} - -// Gets the allowed resources. The allowed resources are always fetched even if out of scope, allowing to include necessary resources (e.g. scripts) from 3rd-parties. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) AllowedResources() (map[string]interface{}, error) { - return a.c.Request("ajaxSpider/view/allowedResources/", nil) -} - -// Gets the current status of the crawler. Actual values are Stopped and Running. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) Status() (map[string]interface{}, error) { - return a.c.Request("ajaxSpider/view/status/", nil) -} - -// Gets the current results of the crawler. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) Results(start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "start": start, - "count": count, - } - return a.c.Request("ajaxSpider/view/results/", m) -} - -// Gets the number of resources found. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) NumberOfResults() (map[string]interface{}, error) { - return a.c.Request("ajaxSpider/view/numberOfResults/", nil) -} - -// Gets the full crawled content detected by the AJAX Spider. Returns a set of values based on 'inScope' URLs, 'outOfScope' URLs, and 'errors' encountered during the last/current run of the AJAX Spider. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) FullResults() (map[string]interface{}, error) { - return a.c.Request("ajaxSpider/view/fullResults/", nil) -} - -// Gets the configured browser to use for crawling. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) OptionBrowserId() (map[string]interface{}, error) { - return a.c.Request("ajaxSpider/view/optionBrowserId/", nil) -} - -// Gets 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. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) OptionEventWait() (map[string]interface{}, error) { - return a.c.Request("ajaxSpider/view/optionEventWait/", nil) -} - -// Gets the configured value for the max crawl depth. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) OptionMaxCrawlDepth() (map[string]interface{}, error) { - return a.c.Request("ajaxSpider/view/optionMaxCrawlDepth/", nil) -} - -// Gets the configured value for the maximum crawl states allowed. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) OptionMaxCrawlStates() (map[string]interface{}, error) { - return a.c.Request("ajaxSpider/view/optionMaxCrawlStates/", nil) -} - -// Gets the configured max duration of the crawl, the value is in minutes. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) OptionMaxDuration() (map[string]interface{}, error) { - return a.c.Request("ajaxSpider/view/optionMaxDuration/", nil) -} - -// Gets the configured number of browsers to be used. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) OptionNumberOfBrowsers() (map[string]interface{}, error) { - return a.c.Request("ajaxSpider/view/optionNumberOfBrowsers/", nil) -} - -// Gets the configured time to wait after reloading the page, this value is in milliseconds. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) OptionReloadWait() (map[string]interface{}, error) { - return a.c.Request("ajaxSpider/view/optionReloadWait/", nil) -} - -// Gets the configured value for 'Click Default Elements Only', HTML elements such as 'a', 'button', 'input', all associated with some action or links on the page. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) OptionClickDefaultElems() (map[string]interface{}, error) { - return a.c.Request("ajaxSpider/view/optionClickDefaultElems/", nil) -} - -// Gets the value configured for the AJAX Spider to know if it should click on the elements only once. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) OptionClickElemsOnce() (map[string]interface{}, error) { - return a.c.Request("ajaxSpider/view/optionClickElemsOnce/", nil) -} - -// Gets if the AJAX Spider will use random values in form fields when crawling, if set to true. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) OptionRandomInputs() (map[string]interface{}, error) { - return a.c.Request("ajaxSpider/view/optionRandomInputs/", nil) -} - -// Runs the AJAX Spider against a given target. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) Scan(url string, inscope string, contextname string, subtreeonly string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - "inScope": inscope, - "contextName": contextname, - "subtreeOnly": subtreeonly, - } - return a.c.Request("ajaxSpider/action/scan/", m) -} - -// Runs the AJAX Spider from the perspective of a User of the web application. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) ScanAsUser(contextname string, username string, url string, subtreeonly string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "userName": username, - "url": url, - "subtreeOnly": subtreeonly, - } - return a.c.Request("ajaxSpider/action/scanAsUser/", m) -} - -// Stops the AJAX Spider. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) Stop() (map[string]interface{}, error) { - return a.c.Request("ajaxSpider/action/stop/", nil) -} - -// Adds an allowed resource. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) AddAllowedResource(regex string, enabled string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "enabled": enabled, - } - return a.c.Request("ajaxSpider/action/addAllowedResource/", m) -} - -// Removes an allowed resource. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) RemoveAllowedResource(regex string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - } - return a.c.Request("ajaxSpider/action/removeAllowedResource/", m) -} - -// Sets whether or not an allowed resource is enabled. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) SetEnabledAllowedResource(regex string, enabled string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "enabled": enabled, - } - return a.c.Request("ajaxSpider/action/setEnabledAllowedResource/", m) -} - -// Sets the configuration of the AJAX Spider to use one of the supported browsers. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) SetOptionBrowserId(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return a.c.Request("ajaxSpider/action/setOptionBrowserId/", m) -} - -// Sets whether or not the 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 -func (a AjaxSpider) SetOptionClickDefaultElems(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ajaxSpider/action/setOptionClickDefaultElems/", m) -} - -// When enabled, the crawler attempts to interact with each element (e.g., by clicking) only once. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) SetOptionClickElemsOnce(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ajaxSpider/action/setOptionClickElemsOnce/", m) -} - -// 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. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) SetOptionEventWait(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ajaxSpider/action/setOptionEventWait/", m) -} - -// Sets the maximum depth that the crawler can reach. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) SetOptionMaxCrawlDepth(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ajaxSpider/action/setOptionMaxCrawlDepth/", m) -} - -// Sets the maximum number of states that the crawler should crawl. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) SetOptionMaxCrawlStates(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ajaxSpider/action/setOptionMaxCrawlStates/", m) -} - -// The maximum time that the crawler is allowed to run. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) SetOptionMaxDuration(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ajaxSpider/action/setOptionMaxDuration/", m) -} - -// Sets the number of windows to be used by AJAX Spider. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) SetOptionNumberOfBrowsers(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ajaxSpider/action/setOptionNumberOfBrowsers/", m) -} - -// When enabled, inserts random values into form fields. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) SetOptionRandomInputs(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ajaxSpider/action/setOptionRandomInputs/", m) -} - -// Sets the time to wait after the page is loaded before interacting with it. -// -// This component is optional and therefore the API will only work if it is installed -func (a AjaxSpider) SetOptionReloadWait(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ajaxSpider/action/setOptionReloadWait/", m) -} diff --git a/zap/alert-filter_generated.go b/zap/alert-filter_generated.go deleted file mode 100644 index 9937df3..0000000 --- a/zap/alert-filter_generated.go +++ /dev/null @@ -1,167 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type AlertFilter struct { - c *Client -} - -// Lists the alert filters of the context with the given ID. -// -// This component is optional and therefore the API will only work if it is installed -func (a AlertFilter) AlertFilterList(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return a.c.Request("alertFilter/view/alertFilterList/", m) -} - -// Lists the global alert filters. -// -// This component is optional and therefore the API will only work if it is installed -func (a AlertFilter) GlobalAlertFilterList() (map[string]interface{}, error) { - return a.c.Request("alertFilter/view/globalAlertFilterList/", nil) -} - -// Adds a new alert filter for the context with the given ID. -// -// This component is optional and therefore the API will only work if it is installed -func (a AlertFilter) AddAlertFilter(contextid string, ruleid string, newlevel string, url string, urlisregex string, parameter string, enabled string, parameterisregex string, attack string, attackisregex string, evidence string, evidenceisregex string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "ruleId": ruleid, - "newLevel": newlevel, - "url": url, - "urlIsRegex": urlisregex, - "parameter": parameter, - "enabled": enabled, - "parameterIsRegex": parameterisregex, - "attack": attack, - "attackIsRegex": attackisregex, - "evidence": evidence, - "evidenceIsRegex": evidenceisregex, - } - return a.c.Request("alertFilter/action/addAlertFilter/", m) -} - -// Removes an alert filter from the context with the given ID. -// -// This component is optional and therefore the API will only work if it is installed -func (a AlertFilter) RemoveAlertFilter(contextid string, ruleid string, newlevel string, url string, urlisregex string, parameter string, enabled string, parameterisregex string, attack string, attackisregex string, evidence string, evidenceisregex string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "ruleId": ruleid, - "newLevel": newlevel, - "url": url, - "urlIsRegex": urlisregex, - "parameter": parameter, - "enabled": enabled, - "parameterIsRegex": parameterisregex, - "attack": attack, - "attackIsRegex": attackisregex, - "evidence": evidence, - "evidenceIsRegex": evidenceisregex, - } - return a.c.Request("alertFilter/action/removeAlertFilter/", m) -} - -// Adds a new global alert filter. -// -// This component is optional and therefore the API will only work if it is installed -func (a AlertFilter) AddGlobalAlertFilter(ruleid string, newlevel string, url string, urlisregex string, parameter string, enabled string, parameterisregex string, attack string, attackisregex string, evidence string, evidenceisregex string) (map[string]interface{}, error) { - m := map[string]string{ - "ruleId": ruleid, - "newLevel": newlevel, - "url": url, - "urlIsRegex": urlisregex, - "parameter": parameter, - "enabled": enabled, - "parameterIsRegex": parameterisregex, - "attack": attack, - "attackIsRegex": attackisregex, - "evidence": evidence, - "evidenceIsRegex": evidenceisregex, - } - return a.c.Request("alertFilter/action/addGlobalAlertFilter/", m) -} - -// Removes a global alert filter. -// -// This component is optional and therefore the API will only work if it is installed -func (a AlertFilter) RemoveGlobalAlertFilter(ruleid string, newlevel string, url string, urlisregex string, parameter string, enabled string, parameterisregex string, attack string, attackisregex string, evidence string, evidenceisregex string) (map[string]interface{}, error) { - m := map[string]string{ - "ruleId": ruleid, - "newLevel": newlevel, - "url": url, - "urlIsRegex": urlisregex, - "parameter": parameter, - "enabled": enabled, - "parameterIsRegex": parameterisregex, - "attack": attack, - "attackIsRegex": attackisregex, - "evidence": evidence, - "evidenceIsRegex": evidenceisregex, - } - return a.c.Request("alertFilter/action/removeGlobalAlertFilter/", m) -} - -// Applies all currently enabled Global and Context alert filters. -// -// This component is optional and therefore the API will only work if it is installed -func (a AlertFilter) ApplyAll() (map[string]interface{}, error) { - return a.c.Request("alertFilter/action/applyAll/", nil) -} - -// Applies all currently enabled Context alert filters. -// -// This component is optional and therefore the API will only work if it is installed -func (a AlertFilter) ApplyContext() (map[string]interface{}, error) { - return a.c.Request("alertFilter/action/applyContext/", nil) -} - -// Applies all currently enabled Global alert filters. -// -// This component is optional and therefore the API will only work if it is installed -func (a AlertFilter) ApplyGlobal() (map[string]interface{}, error) { - return a.c.Request("alertFilter/action/applyGlobal/", nil) -} - -// Tests all currently enabled Global and Context alert filters. -// -// This component is optional and therefore the API will only work if it is installed -func (a AlertFilter) TestAll() (map[string]interface{}, error) { - return a.c.Request("alertFilter/action/testAll/", nil) -} - -// Tests all currently enabled Context alert filters. -// -// This component is optional and therefore the API will only work if it is installed -func (a AlertFilter) TestContext() (map[string]interface{}, error) { - return a.c.Request("alertFilter/action/testContext/", nil) -} - -// Tests all currently enabled Global alert filters. -// -// This component is optional and therefore the API will only work if it is installed -func (a AlertFilter) TestGlobal() (map[string]interface{}, error) { - return a.c.Request("alertFilter/action/testGlobal/", nil) -} diff --git a/zap/alert_generated.go b/zap/alert_generated.go deleted file mode 100644 index ed7a9d8..0000000 --- a/zap/alert_generated.go +++ /dev/null @@ -1,151 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Alert struct { - c *Client -} - -// Gets the alert with the given ID, the corresponding HTTP message can be obtained with the 'messageId' field and 'message' API method -func (a Alert) Alert(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return a.c.Request("alert/view/alert/", m) -} - -// Gets the alerts raised by ZAP, optionally filtering by URL or riskId, and paginating with 'start' position and 'count' of alerts -func (a Alert) Alerts(baseurl string, start string, count string, riskid string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - "start": start, - "count": count, - "riskId": riskid, - } - return a.c.Request("alert/view/alerts/", m) -} - -// Gets number of alerts grouped by each risk level, optionally filtering by URL -func (a Alert) AlertsSummary(baseurl string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - } - return a.c.Request("alert/view/alertsSummary/", m) -} - -// Gets the number of alerts, optionally filtering by URL or riskId -func (a Alert) NumberOfAlerts(baseurl string, riskid string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - "riskId": riskid, - } - return a.c.Request("alert/view/numberOfAlerts/", m) -} - -// Gets a summary of the alerts, optionally filtered by a 'url'. If 'recurse' is true then all alerts that apply to urls that start with the specified 'url' will be returned, otherwise only those on exactly the same 'url' (ignoring url parameters) -func (a Alert) AlertsByRisk(url string, recurse string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - "recurse": recurse, - } - return a.c.Request("alert/view/alertsByRisk/", m) -} - -// Gets a count of the alerts, optionally filtered as per alertsPerRisk -func (a Alert) AlertCountsByRisk(url string, recurse string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - "recurse": recurse, - } - return a.c.Request("alert/view/alertCountsByRisk/", m) -} - -// Deletes all alerts of the current session. -func (a Alert) DeleteAllAlerts() (map[string]interface{}, error) { - return a.c.Request("alert/action/deleteAllAlerts/", nil) -} - -// Deletes the alert with the given ID. -func (a Alert) DeleteAlert(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return a.c.Request("alert/action/deleteAlert/", m) -} - -// Update the confidence of the alerts. -func (a Alert) UpdateAlertsConfidence(ids string, confidenceid string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - "confidenceId": confidenceid, - } - return a.c.Request("alert/action/updateAlertsConfidence/", m) -} - -// Update the risk of the alerts. -func (a Alert) UpdateAlertsRisk(ids string, riskid string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - "riskId": riskid, - } - return a.c.Request("alert/action/updateAlertsRisk/", m) -} - -// Update the alert with the given ID, with the provided details. -func (a Alert) UpdateAlert(id string, name string, riskid string, confidenceid string, description string, param string, attack string, otherinfo string, solution string, references string, evidence string, cweid string, wascid string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - "name": name, - "riskId": riskid, - "confidenceId": confidenceid, - "description": description, - "param": param, - "attack": attack, - "otherInfo": otherinfo, - "solution": solution, - "references": references, - "evidence": evidence, - "cweId": cweid, - "wascId": wascid, - } - return a.c.Request("alert/action/updateAlert/", m) -} - -// Add an alert associated with the given message ID, with the provided details. (The ID of the created alert is returned.) -func (a Alert) AddAlert(messageid string, name string, riskid string, confidenceid string, description string, param string, attack string, otherinfo string, solution string, references string, evidence string, cweid string, wascid string) (map[string]interface{}, error) { - m := map[string]string{ - "messageId": messageid, - "name": name, - "riskId": riskid, - "confidenceId": confidenceid, - "description": description, - "param": param, - "attack": attack, - "otherInfo": otherinfo, - "solution": solution, - "references": references, - "evidence": evidence, - "cweId": cweid, - "wascId": wascid, - } - return a.c.Request("alert/action/addAlert/", m) -} diff --git a/zap/ascan_generated.go b/zap/ascan_generated.go deleted file mode 100644 index b21ba7d..0000000 --- a/zap/ascan_generated.go +++ /dev/null @@ -1,591 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -import "strconv" - -type Ascan struct { - c *Client -} - -func (a Ascan) Status(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/view/status/", m) -} - -func (a Ascan) ScanProgress(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/view/scanProgress/", m) -} - -// Gets the IDs of the messages sent during the scan with the given ID. A message can be obtained with 'message' core view. -func (a Ascan) MessagesIds(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/view/messagesIds/", m) -} - -// Gets the IDs of the alerts raised during the scan with the given ID. An alert can be obtained with 'alert' core view. -func (a Ascan) AlertsIds(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/view/alertsIds/", m) -} - -func (a Ascan) Scans() (map[string]interface{}, error) { - return a.c.Request("ascan/view/scans/", nil) -} - -func (a Ascan) ScanPolicyNames() (map[string]interface{}, error) { - return a.c.Request("ascan/view/scanPolicyNames/", nil) -} - -// Gets the regexes of URLs excluded from the active scans. -func (a Ascan) ExcludedFromScan() (map[string]interface{}, error) { - return a.c.Request("ascan/view/excludedFromScan/", nil) -} - -// Gets the scanners, optionally, of the given scan policy and/or scanner policy/category ID. -func (a Ascan) Scanners(scanpolicyname string, policyid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanPolicyName": scanpolicyname, - "policyId": policyid, - } - return a.c.Request("ascan/view/scanners/", m) -} - -func (a Ascan) Policies(scanpolicyname string, policyid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanPolicyName": scanpolicyname, - "policyId": policyid, - } - return a.c.Request("ascan/view/policies/", m) -} - -func (a Ascan) AttackModeQueue() (map[string]interface{}, error) { - return a.c.Request("ascan/view/attackModeQueue/", nil) -} - -// Gets all the parameters that are excluded. For each parameter the following are shown: the name, the URL, and the parameter type. -func (a Ascan) ExcludedParams() (map[string]interface{}, error) { - return a.c.Request("ascan/view/excludedParams/", nil) -} - -// Use view excludedParams instead. -func (a Ascan) OptionExcludedParamList() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionExcludedParamList/", nil) -} - -// Gets all the types of excluded parameters. For each type the following are shown: the ID and the name. -func (a Ascan) ExcludedParamTypes() (map[string]interface{}, error) { - return a.c.Request("ascan/view/excludedParamTypes/", nil) -} - -func (a Ascan) OptionAttackPolicy() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionAttackPolicy/", nil) -} - -func (a Ascan) OptionDefaultPolicy() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionDefaultPolicy/", nil) -} - -func (a Ascan) OptionDelayInMs() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionDelayInMs/", nil) -} - -func (a Ascan) OptionHandleAntiCSRFTokens() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionHandleAntiCSRFTokens/", nil) -} - -func (a Ascan) OptionHostPerScan() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionHostPerScan/", nil) -} - -func (a Ascan) OptionMaxChartTimeInMins() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionMaxChartTimeInMins/", nil) -} - -func (a Ascan) OptionMaxResultsToList() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionMaxResultsToList/", nil) -} - -func (a Ascan) OptionMaxRuleDurationInMins() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionMaxRuleDurationInMins/", nil) -} - -func (a Ascan) OptionMaxScanDurationInMins() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionMaxScanDurationInMins/", nil) -} - -func (a Ascan) OptionMaxScansInUI() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionMaxScansInUI/", nil) -} - -func (a Ascan) OptionTargetParamsEnabledRPC() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionTargetParamsEnabledRPC/", nil) -} - -func (a Ascan) OptionTargetParamsInjectable() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionTargetParamsInjectable/", nil) -} - -func (a Ascan) OptionThreadPerHost() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionThreadPerHost/", nil) -} - -// Tells whether or not the active scanner should add a query parameter to GET request that don't have parameters to start with. -func (a Ascan) OptionAddQueryParam() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionAddQueryParam/", nil) -} - -func (a Ascan) OptionAllowAttackOnStart() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionAllowAttackOnStart/", nil) -} - -// Tells whether or not the active scanner should inject the HTTP request header X-ZAP-Scan-ID, with the ID of the scanner that's sending the requests. -func (a Ascan) OptionInjectPluginIdInHeader() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionInjectPluginIdInHeader/", nil) -} - -func (a Ascan) OptionPromptInAttackMode() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionPromptInAttackMode/", nil) -} - -func (a Ascan) OptionPromptToClearFinishedScans() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionPromptToClearFinishedScans/", nil) -} - -func (a Ascan) OptionRescanInAttackMode() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionRescanInAttackMode/", nil) -} - -// Tells whether or not the HTTP Headers of all requests should be scanned. Not just requests that send parameters, through the query or request body. -func (a Ascan) OptionScanHeadersAllRequests() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionScanHeadersAllRequests/", nil) -} - -// Tells whether or not the active scanner should scan null JSON values. -func (a Ascan) OptionScanNullJsonValues() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionScanNullJsonValues/", nil) -} - -func (a Ascan) OptionShowAdvancedDialog() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionShowAdvancedDialog/", nil) -} - -// Runs the active scanner against the given URL and/or Context. Optionally, the 'recurse' parameter can be used to scan URLs under the given URL, the parameter 'inScopeOnly' can be used to constrain the scan to URLs that are in scope (ignored if a Context is specified), the parameter 'scanPolicyName' allows to specify the scan policy (if none is given it uses the default scan policy), the parameters 'method' and 'postData' allow to select a given request in conjunction with the given URL. -func (a Ascan) Scan(url string, recurse string, inscopeonly string, scanpolicyname string, method string, postdata string, contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - "recurse": recurse, - "inScopeOnly": inscopeonly, - "scanPolicyName": scanpolicyname, - "method": method, - "postData": postdata, - "contextId": contextid, - } - return a.c.Request("ascan/action/scan/", m) -} - -// Active Scans from the perspective of a User, obtained using the given Context ID and User ID. See 'scan' action for more details. -func (a Ascan) ScanAsUser(url string, contextid string, userid string, recurse string, scanpolicyname string, method string, postdata string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - "contextId": contextid, - "userId": userid, - "recurse": recurse, - "scanPolicyName": scanpolicyname, - "method": method, - "postData": postdata, - } - return a.c.Request("ascan/action/scanAsUser/", m) -} - -func (a Ascan) Pause(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/action/pause/", m) -} - -func (a Ascan) Resume(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/action/resume/", m) -} - -func (a Ascan) Stop(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/action/stop/", m) -} - -func (a Ascan) RemoveScan(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/action/removeScan/", m) -} - -func (a Ascan) PauseAllScans() (map[string]interface{}, error) { - return a.c.Request("ascan/action/pauseAllScans/", nil) -} - -func (a Ascan) ResumeAllScans() (map[string]interface{}, error) { - return a.c.Request("ascan/action/resumeAllScans/", nil) -} - -func (a Ascan) StopAllScans() (map[string]interface{}, error) { - return a.c.Request("ascan/action/stopAllScans/", nil) -} - -func (a Ascan) RemoveAllScans() (map[string]interface{}, error) { - return a.c.Request("ascan/action/removeAllScans/", nil) -} - -// Clears the regexes of URLs excluded from the active scans. -func (a Ascan) ClearExcludedFromScan() (map[string]interface{}, error) { - return a.c.Request("ascan/action/clearExcludedFromScan/", nil) -} - -// Adds a regex of URLs that should be excluded from the active scans. -func (a Ascan) ExcludeFromScan(regex string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - } - return a.c.Request("ascan/action/excludeFromScan/", m) -} - -// Enables all scanners of the scan policy with the given name, or the default if none given. -func (a Ascan) EnableAllScanners(scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/enableAllScanners/", m) -} - -// Disables all scanners of the scan policy with the given name, or the default if none given. -func (a Ascan) DisableAllScanners(scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/disableAllScanners/", m) -} - -// Enables the scanners with the given IDs (comma separated list of IDs) of the scan policy with the given name, or the default if none given. -func (a Ascan) EnableScanners(ids string, scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/enableScanners/", m) -} - -// Disables the scanners with the given IDs (comma separated list of IDs) of the scan policy with the given name, or the default if none given. -func (a Ascan) DisableScanners(ids string, scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/disableScanners/", m) -} - -func (a Ascan) SetEnabledPolicies(ids string, scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/setEnabledPolicies/", m) -} - -func (a Ascan) SetPolicyAttackStrength(id string, attackstrength string, scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - "attackStrength": attackstrength, - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/setPolicyAttackStrength/", m) -} - -func (a Ascan) SetPolicyAlertThreshold(id string, alertthreshold string, scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - "alertThreshold": alertthreshold, - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/setPolicyAlertThreshold/", m) -} - -func (a Ascan) SetScannerAttackStrength(id string, attackstrength string, scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - "attackStrength": attackstrength, - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/setScannerAttackStrength/", m) -} - -func (a Ascan) SetScannerAlertThreshold(id string, alertthreshold string, scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - "alertThreshold": alertthreshold, - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/setScannerAlertThreshold/", m) -} - -func (a Ascan) AddScanPolicy(scanpolicyname string, alertthreshold string, attackstrength string) (map[string]interface{}, error) { - m := map[string]string{ - "scanPolicyName": scanpolicyname, - "alertThreshold": alertthreshold, - "attackStrength": attackstrength, - } - return a.c.Request("ascan/action/addScanPolicy/", m) -} - -func (a Ascan) RemoveScanPolicy(scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/removeScanPolicy/", m) -} - -func (a Ascan) UpdateScanPolicy(scanpolicyname string, alertthreshold string, attackstrength string) (map[string]interface{}, error) { - m := map[string]string{ - "scanPolicyName": scanpolicyname, - "alertThreshold": alertthreshold, - "attackStrength": attackstrength, - } - return a.c.Request("ascan/action/updateScanPolicy/", m) -} - -// Imports a Scan Policy using the given file system path. -func (a Ascan) ImportScanPolicy(path string) (map[string]interface{}, error) { - m := map[string]string{ - "path": path, - } - return a.c.Request("ascan/action/importScanPolicy/", m) -} - -// Adds a new parameter excluded from the scan, using the specified name. Optionally sets if the new entry applies to a specific URL (default, all URLs) and sets the ID of the type of the parameter (default, ID of any type). The type IDs can be obtained with the view excludedParamTypes. -func (a Ascan) AddExcludedParam(name string, t string, url string) (map[string]interface{}, error) { - m := map[string]string{ - "name": name, - "type": t, - "url": url, - } - return a.c.Request("ascan/action/addExcludedParam/", m) -} - -// Modifies a parameter excluded from the scan. Allows to modify the name, the URL and the type of parameter. The parameter is selected with its index, which can be obtained with the view excludedParams. -func (a Ascan) ModifyExcludedParam(idx string, name string, t string, url string) (map[string]interface{}, error) { - m := map[string]string{ - "idx": idx, - "name": name, - "type": t, - "url": url, - } - return a.c.Request("ascan/action/modifyExcludedParam/", m) -} - -// Removes a parameter excluded from the scan, with the given index. The index can be obtained with the view excludedParams. -func (a Ascan) RemoveExcludedParam(idx string) (map[string]interface{}, error) { - m := map[string]string{ - "idx": idx, - } - return a.c.Request("ascan/action/removeExcludedParam/", m) -} - -// Skips the scanner using the given IDs of the scan and the scanner. -func (a Ascan) SkipScanner(scanid string, scannerid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - "scannerId": scannerid, - } - return a.c.Request("ascan/action/skipScanner/", m) -} - -func (a Ascan) SetOptionAttackPolicy(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return a.c.Request("ascan/action/setOptionAttackPolicy/", m) -} - -func (a Ascan) SetOptionDefaultPolicy(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return a.c.Request("ascan/action/setOptionDefaultPolicy/", m) -} - -// Sets whether or not the active scanner should add a query param to GET requests which do not have parameters to start with. -func (a Ascan) SetOptionAddQueryParam(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionAddQueryParam/", m) -} - -func (a Ascan) SetOptionAllowAttackOnStart(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionAllowAttackOnStart/", m) -} - -func (a Ascan) SetOptionDelayInMs(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionDelayInMs/", m) -} - -func (a Ascan) SetOptionHandleAntiCSRFTokens(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionHandleAntiCSRFTokens/", m) -} - -func (a Ascan) SetOptionHostPerScan(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionHostPerScan/", m) -} - -// Sets whether or not the active scanner should inject the HTTP request header X-ZAP-Scan-ID, with the ID of the scanner that's sending the requests. -func (a Ascan) SetOptionInjectPluginIdInHeader(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionInjectPluginIdInHeader/", m) -} - -func (a Ascan) SetOptionMaxChartTimeInMins(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionMaxChartTimeInMins/", m) -} - -func (a Ascan) SetOptionMaxResultsToList(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionMaxResultsToList/", m) -} - -func (a Ascan) SetOptionMaxRuleDurationInMins(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionMaxRuleDurationInMins/", m) -} - -func (a Ascan) SetOptionMaxScanDurationInMins(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionMaxScanDurationInMins/", m) -} - -func (a Ascan) SetOptionMaxScansInUI(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionMaxScansInUI/", m) -} - -func (a Ascan) SetOptionPromptInAttackMode(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionPromptInAttackMode/", m) -} - -func (a Ascan) SetOptionPromptToClearFinishedScans(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionPromptToClearFinishedScans/", m) -} - -func (a Ascan) SetOptionRescanInAttackMode(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionRescanInAttackMode/", m) -} - -// Sets whether or not the HTTP Headers of all requests should be scanned. Not just requests that send parameters, through the query or request body. -func (a Ascan) SetOptionScanHeadersAllRequests(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionScanHeadersAllRequests/", m) -} - -// Sets whether or not the active scanner should scan null JSON values. -func (a Ascan) SetOptionScanNullJsonValues(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionScanNullJsonValues/", m) -} - -func (a Ascan) SetOptionShowAdvancedDialog(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionShowAdvancedDialog/", m) -} - -func (a Ascan) SetOptionTargetParamsEnabledRPC(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionTargetParamsEnabledRPC/", m) -} - -func (a Ascan) SetOptionTargetParamsInjectable(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionTargetParamsInjectable/", m) -} - -func (a Ascan) SetOptionThreadPerHost(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionThreadPerHost/", m) -} diff --git a/zap/authentication_generated.go b/zap/authentication_generated.go deleted file mode 100644 index 9ff7247..0000000 --- a/zap/authentication_generated.go +++ /dev/null @@ -1,91 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Authentication struct { - c *Client -} - -// Gets the name of the authentication methods. -func (a Authentication) GetSupportedAuthenticationMethods() (map[string]interface{}, error) { - return a.c.Request("authentication/view/getSupportedAuthenticationMethods/", nil) -} - -// Gets the configuration parameters for the authentication method with the given name. -func (a Authentication) GetAuthenticationMethodConfigParams(authmethodname string) (map[string]interface{}, error) { - m := map[string]string{ - "authMethodName": authmethodname, - } - return a.c.Request("authentication/view/getAuthenticationMethodConfigParams/", m) -} - -// Gets the name of the authentication method for the context with the given ID. -func (a Authentication) GetAuthenticationMethod(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return a.c.Request("authentication/view/getAuthenticationMethod/", m) -} - -// Gets the logged in indicator for the context with the given ID. -func (a Authentication) GetLoggedInIndicator(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return a.c.Request("authentication/view/getLoggedInIndicator/", m) -} - -// Gets the logged out indicator for the context with the given ID. -func (a Authentication) GetLoggedOutIndicator(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return a.c.Request("authentication/view/getLoggedOutIndicator/", m) -} - -// Sets the authentication method for the context with the given ID. -func (a Authentication) SetAuthenticationMethod(contextid string, authmethodname string, authmethodconfigparams string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "authMethodName": authmethodname, - "authMethodConfigParams": authmethodconfigparams, - } - return a.c.Request("authentication/action/setAuthenticationMethod/", m) -} - -// Sets the logged in indicator for the context with the given ID. -func (a Authentication) SetLoggedInIndicator(contextid string, loggedinindicatorregex string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "loggedInIndicatorRegex": loggedinindicatorregex, - } - return a.c.Request("authentication/action/setLoggedInIndicator/", m) -} - -// Sets the logged out indicator for the context with the given ID. -func (a Authentication) SetLoggedOutIndicator(contextid string, loggedoutindicatorregex string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "loggedOutIndicatorRegex": loggedoutindicatorregex, - } - return a.c.Request("authentication/action/setLoggedOutIndicator/", m) -} diff --git a/zap/authorization_generated.go b/zap/authorization_generated.go deleted file mode 100644 index bd6882f..0000000 --- a/zap/authorization_generated.go +++ /dev/null @@ -1,46 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Authorization struct { - c *Client -} - -// Obtains all the configuration of the authorization detection method that is currently set for a context. -func (a Authorization) GetAuthorizationDetectionMethod(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return a.c.Request("authorization/view/getAuthorizationDetectionMethod/", m) -} - -// Sets the authorization detection method for a context as one that identifies un-authorized messages based on: the message's status code or a regex pattern in the response's header or body. Also, whether all conditions must match or just some can be specified via the logicalOperator parameter, which accepts two values: "AND" (default), "OR". -func (a Authorization) SetBasicAuthorizationDetectionMethod(contextid string, headerregex string, bodyregex string, statuscode string, logicaloperator string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "headerRegex": headerregex, - "bodyRegex": bodyregex, - "statusCode": statuscode, - "logicalOperator": logicaloperator, - } - return a.c.Request("authorization/action/setBasicAuthorizationDetectionMethod/", m) -} diff --git a/zap/automation_generated.go b/zap/automation_generated.go deleted file mode 100644 index aaefcf8..0000000 --- a/zap/automation_generated.go +++ /dev/null @@ -1,47 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Automation struct { - c *Client -} - -// This component is optional and therefore the API will only work if it is installed -func (a Automation) PlanProgress(planid string) (map[string]interface{}, error) { - m := map[string]string{ - "planId": planid, - } - return a.c.Request("automation/view/planProgress/", m) -} - -// This component is optional and therefore the API will only work if it is installed -func (a Automation) RunPlan(filepath string) (map[string]interface{}, error) { - m := map[string]string{ - "filePath": filepath, - } - return a.c.Request("automation/action/runPlan/", m) -} - -// This component is optional and therefore the API will only work if it is installed -func (a Automation) EndDelayJob() (map[string]interface{}, error) { - return a.c.Request("automation/action/endDelayJob/", nil) -} diff --git a/zap/autoupdate_generated.go b/zap/autoupdate_generated.go deleted file mode 100644 index 9ece400..0000000 --- a/zap/autoupdate_generated.go +++ /dev/null @@ -1,199 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -import "strconv" - -type Autoupdate struct { - c *Client -} - -// Returns the latest version number -func (a Autoupdate) LatestVersionNumber() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/latestVersionNumber/", nil) -} - -// Returns 'true' if ZAP is on the latest version -func (a Autoupdate) IsLatestVersion() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/isLatestVersion/", nil) -} - -// Return a list of all of the installed add-ons -func (a Autoupdate) InstalledAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/installedAddons/", nil) -} - -// Returns a list with all local add-ons, installed or not. -func (a Autoupdate) LocalAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/localAddons/", nil) -} - -// Return a list of any add-ons that have been added to the Marketplace since the last check for updates -func (a Autoupdate) NewAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/newAddons/", nil) -} - -// Return a list of any add-ons that have been changed in the Marketplace since the last check for updates -func (a Autoupdate) UpdatedAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/updatedAddons/", nil) -} - -// Return a list of all of the add-ons on the ZAP Marketplace (this information is read once and then cached) -func (a Autoupdate) MarketplaceAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/marketplaceAddons/", nil) -} - -func (a Autoupdate) OptionAddonDirectories() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionAddonDirectories/", nil) -} - -func (a Autoupdate) OptionDayLastChecked() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionDayLastChecked/", nil) -} - -func (a Autoupdate) OptionDayLastInstallWarned() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionDayLastInstallWarned/", nil) -} - -func (a Autoupdate) OptionDayLastUpdateWarned() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionDayLastUpdateWarned/", nil) -} - -func (a Autoupdate) OptionDownloadDirectory() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionDownloadDirectory/", nil) -} - -func (a Autoupdate) OptionCheckAddonUpdates() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionCheckAddonUpdates/", nil) -} - -func (a Autoupdate) OptionCheckOnStart() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionCheckOnStart/", nil) -} - -func (a Autoupdate) OptionDownloadNewRelease() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionDownloadNewRelease/", nil) -} - -func (a Autoupdate) OptionInstallAddonUpdates() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionInstallAddonUpdates/", nil) -} - -func (a Autoupdate) OptionInstallScannerRules() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionInstallScannerRules/", nil) -} - -func (a Autoupdate) OptionReportAlphaAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionReportAlphaAddons/", nil) -} - -func (a Autoupdate) OptionReportBetaAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionReportBetaAddons/", nil) -} - -func (a Autoupdate) OptionReportReleaseAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionReportReleaseAddons/", nil) -} - -// Downloads the latest release, if any -func (a Autoupdate) DownloadLatestRelease() (map[string]interface{}, error) { - return a.c.Request("autoupdate/action/downloadLatestRelease/", nil) -} - -// Installs or updates the specified add-on, returning when complete (i.e. not asynchronously) -func (a Autoupdate) InstallAddon(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return a.c.Request("autoupdate/action/installAddon/", m) -} - -func (a Autoupdate) InstallLocalAddon(file string) (map[string]interface{}, error) { - m := map[string]string{ - "file": file, - } - return a.c.Request("autoupdate/action/installLocalAddon/", m) -} - -// Uninstalls the specified add-on -func (a Autoupdate) UninstallAddon(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return a.c.Request("autoupdate/action/uninstallAddon/", m) -} - -func (a Autoupdate) SetOptionCheckAddonUpdates(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionCheckAddonUpdates/", m) -} - -func (a Autoupdate) SetOptionCheckOnStart(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionCheckOnStart/", m) -} - -func (a Autoupdate) SetOptionDownloadNewRelease(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionDownloadNewRelease/", m) -} - -func (a Autoupdate) SetOptionInstallAddonUpdates(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionInstallAddonUpdates/", m) -} - -func (a Autoupdate) SetOptionInstallScannerRules(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionInstallScannerRules/", m) -} - -func (a Autoupdate) SetOptionReportAlphaAddons(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionReportAlphaAddons/", m) -} - -func (a Autoupdate) SetOptionReportBetaAddons(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionReportBetaAddons/", m) -} - -func (a Autoupdate) SetOptionReportReleaseAddons(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionReportReleaseAddons/", m) -} diff --git a/zap/brk_generated.go b/zap/brk_generated.go deleted file mode 100644 index 93137f3..0000000 --- a/zap/brk_generated.go +++ /dev/null @@ -1,104 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Break struct { - c *Client -} - -// Returns True if ZAP will break on both requests and responses -func (b Break) IsBreakAll() (map[string]interface{}, error) { - return b.c.Request("break/view/isBreakAll/", nil) -} - -// Returns True if ZAP will break on requests -func (b Break) IsBreakRequest() (map[string]interface{}, error) { - return b.c.Request("break/view/isBreakRequest/", nil) -} - -// Returns True if ZAP will break on responses -func (b Break) IsBreakResponse() (map[string]interface{}, error) { - return b.c.Request("break/view/isBreakResponse/", nil) -} - -// Returns the HTTP message currently intercepted (if any) -func (b Break) HttpMessage() (map[string]interface{}, error) { - return b.c.Request("break/view/httpMessage/", nil) -} - -// Controls the global break functionality. The type may be one of: http-all, http-request or http-response. The state may be true (for turning break on for the specified type) or false (for turning break off). Scope is not currently used. -func (b Break) Brk(t string, state string, scope string) (map[string]interface{}, error) { - m := map[string]string{ - "type": t, - "state": state, - "scope": scope, - } - return b.c.Request("break/action/break/", m) -} - -// Overwrites the currently intercepted message with the data provided -func (b Break) SetHttpMessage(httpheader string, httpbody string) (map[string]interface{}, error) { - m := map[string]string{ - "httpHeader": httpheader, - "httpBody": httpbody, - } - return b.c.Request("break/action/setHttpMessage/", m) -} - -// Submits the currently intercepted message and unsets the global request/response breakpoints -func (b Break) Cont() (map[string]interface{}, error) { - return b.c.Request("break/action/continue/", nil) -} - -// Submits the currently intercepted message, the next request or response will automatically be intercepted -func (b Break) Step() (map[string]interface{}, error) { - return b.c.Request("break/action/step/", nil) -} - -// Drops the currently intercepted message -func (b Break) Drop() (map[string]interface{}, error) { - return b.c.Request("break/action/drop/", nil) -} - -// Adds a custom HTTP breakpoint. The string is the string to match. Location may be one of: url, request_header, request_body, response_header or response_body. Match may be: contains or regex. Inverse (match) may be true or false. Lastly, ignorecase (when matching the string) may be true or false. -func (b Break) AddHttpBreakpoint(str string, location string, match string, inverse string, ignorecase string) (map[string]interface{}, error) { - m := map[string]string{ - "string": str, - "location": location, - "match": match, - "inverse": inverse, - "ignorecase": ignorecase, - } - return b.c.Request("break/action/addHttpBreakpoint/", m) -} - -// Removes the specified breakpoint -func (b Break) RemoveHttpBreakpoint(str string, location string, match string, inverse string, ignorecase string) (map[string]interface{}, error) { - m := map[string]string{ - "string": str, - "location": location, - "match": match, - "inverse": inverse, - "ignorecase": ignorecase, - } - return b.c.Request("break/action/removeHttpBreakpoint/", m) -} diff --git a/zap/client.go b/zap/client.go deleted file mode 100644 index 4044190..0000000 --- a/zap/client.go +++ /dev/null @@ -1,141 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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 zap - -import ( - "crypto/tls" - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "net/url" -) - -const ( - DefaultBase = "http://zap/JSON/" - DefaultBaseOther = "http://zap/OTHER/" - DefaultHTTPSBase = "https://zap/JSON/" - DefaultHTTPSBaseOther = "https://zap/OTHER/" - DefaultProxy = "tcp://127.0.0.1:8080" - ZAP_API_KEY_PARAM = "apikey" - ZAP_API_KEY_HEADER = "X-ZAP-API-Key" -) - -// Config defines the config of ZAP client -type Config struct { - Base string - BaseOther string - Proxy string - APIKey string - TLSConfig tls.Config -} - -// Client is a ZAP client that allows you to access ZAP API -type Client struct { - *Config - httpClient *http.Client -} - -// NewClient returns a new ZAP client based on the passed in config -func NewClient(cfg *Config) (Interface, error) { - if cfg.Base == "" { - cfg.Base = DefaultBase - } - if cfg.BaseOther == "" { - cfg.BaseOther = DefaultBaseOther - } - if cfg.Proxy == "" { - cfg.Proxy = DefaultProxy - } - - proxyURL, err := url.Parse(cfg.Proxy) - if err != nil { - return nil, err - } - - httpClient := &http.Client{ - Transport: &http.Transport{ - Proxy: http.ProxyURL(proxyURL), - TLSClientConfig: &cfg.TLSConfig, - }, - } - return &Client{ - Config: cfg, - httpClient: httpClient, - }, nil -} - -// Request sends HTTP request to zap base("http://zap/JSON/") API group -func (c *Client) Request(path string, queryParams map[string]string) (map[string]interface{}, error) { - body, err := c.request(c.Base+path, queryParams) - if err != nil { - return nil, err - } - // NOTE: since Golang can not unmarshal a json without knowing the exact struct - // so we can only unmarshal json into a map[string]interface{} here. - var obj map[string]interface{} - if err := json.Unmarshal(body, &obj); err != nil { - return nil, err - } - return obj, nil -} - -// RequestOther sends HTTP request to zap other("http://zap/OTHER/") API group -func (c *Client) RequestOther(path string, queryParams map[string]string) ([]byte, error) { - return c.request(c.BaseOther+path, queryParams) -} - -func (c *Client) request(path string, queryParams map[string]string) ([]byte, error) { - req, err := http.NewRequest("GET", path, nil) - if err != nil { - return nil, err - } - - if len(queryParams) == 0 { - queryParams = map[string]string{} - } - // Send the API key even if there are no parameters, - // older ZAP versions might need API key as (query) parameter. - queryParams[ZAP_API_KEY_PARAM] = c.APIKey - - // add url query parameter - query := req.URL.Query() - for k, v := range queryParams { - if v == "" { - continue - } - query.Add(k, v) - } - req.URL.RawQuery = query.Encode() - - // add HTTP Accept header - req.Header.Add("Accept", "application/json") - // add API Key header - req.Header.Add(ZAP_API_KEY_HEADER, c.APIKey) - - // Close the connection - req.Close = true - - resp, err := c.httpClient.Do(req) - if err != nil { - return nil, fmt.Errorf("Errored when sending request to the server: %v", err) - } - defer resp.Body.Close() - return ioutil.ReadAll(resp.Body) -} diff --git a/zap/context_generated.go b/zap/context_generated.go deleted file mode 100644 index e299c4d..0000000 --- a/zap/context_generated.go +++ /dev/null @@ -1,202 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Context struct { - c *Client -} - -// List context names of current session -func (c Context) ContextList() (map[string]interface{}, error) { - return c.c.Request("context/view/contextList/", nil) -} - -// List excluded regexs for context -func (c Context) ExcludeRegexs(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/view/excludeRegexs/", m) -} - -// List included regexs for context -func (c Context) IncludeRegexs(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/view/includeRegexs/", m) -} - -// List the information about the named context -func (c Context) Context(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/view/context/", m) -} - -// Lists the names of all built in technologies -func (c Context) TechnologyList() (map[string]interface{}, error) { - return c.c.Request("context/view/technologyList/", nil) -} - -// Lists the names of all technologies included in a context -func (c Context) IncludedTechnologyList(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/view/includedTechnologyList/", m) -} - -// Lists the names of all technologies excluded from a context -func (c Context) ExcludedTechnologyList(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/view/excludedTechnologyList/", m) -} - -// Lists the URLs accessed through/by ZAP, that belong to the context with the given name. -func (c Context) Urls(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/view/urls/", m) -} - -// Add exclude regex to context -func (c Context) ExcludeFromContext(contextname string, regex string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "regex": regex, - } - return c.c.Request("context/action/excludeFromContext/", m) -} - -// Add include regex to context -func (c Context) IncludeInContext(contextname string, regex string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "regex": regex, - } - return c.c.Request("context/action/includeInContext/", m) -} - -// Set the regexs to include and exclude for a context, both supplied as JSON string arrays -func (c Context) SetContextRegexs(contextname string, incregexs string, excregexs string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "incRegexs": incregexs, - "excRegexs": excregexs, - } - return c.c.Request("context/action/setContextRegexs/", m) -} - -// Set the checking strategy for a context - this defines how ZAP checks that a request is authenticated -func (c Context) SetContextCheckingStrategy(contextname string, checkingstrategy string, pollurl string, polldata string, pollheaders string, pollfrequency string, pollfrequencyunits string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "checkingStrategy": checkingstrategy, - "pollUrl": pollurl, - "pollData": polldata, - "pollHeaders": pollheaders, - "pollFrequency": pollfrequency, - "pollFrequencyUnits": pollfrequencyunits, - } - return c.c.Request("context/action/setContextCheckingStrategy/", m) -} - -// Creates a new context with the given name in the current session -func (c Context) NewContext(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/action/newContext/", m) -} - -// Removes a context in the current session -func (c Context) RemoveContext(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/action/removeContext/", m) -} - -// Exports the context with the given name to a file. If a relative file path is specified it will be resolved against the "contexts" directory in ZAP "home" dir. -func (c Context) ExportContext(contextname string, contextfile string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "contextFile": contextfile, - } - return c.c.Request("context/action/exportContext/", m) -} - -// Imports a context from a file. If a relative file path is specified it will be resolved against the "contexts" directory in ZAP "home" dir. -func (c Context) ImportContext(contextfile string) (map[string]interface{}, error) { - m := map[string]string{ - "contextFile": contextfile, - } - return c.c.Request("context/action/importContext/", m) -} - -// Includes technologies with the given names, separated by a comma, to a context -func (c Context) IncludeContextTechnologies(contextname string, technologynames string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "technologyNames": technologynames, - } - return c.c.Request("context/action/includeContextTechnologies/", m) -} - -// Includes all built in technologies in to a context -func (c Context) IncludeAllContextTechnologies(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/action/includeAllContextTechnologies/", m) -} - -// Excludes technologies with the given names, separated by a comma, from a context -func (c Context) ExcludeContextTechnologies(contextname string, technologynames string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "technologyNames": technologynames, - } - return c.c.Request("context/action/excludeContextTechnologies/", m) -} - -// Excludes all built in technologies from a context -func (c Context) ExcludeAllContextTechnologies(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/action/excludeAllContextTechnologies/", m) -} - -// Sets a context to in scope (contexts are in scope by default) -func (c Context) SetContextInScope(contextname string, booleaninscope string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "booleanInScope": booleaninscope, - } - return c.c.Request("context/action/setContextInScope/", m) -} diff --git a/zap/core_generated.go b/zap/core_generated.go deleted file mode 100644 index 8cb9389..0000000 --- a/zap/core_generated.go +++ /dev/null @@ -1,630 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -import "strconv" - -type Core struct { - c *Client -} - -// Gets the name of the hosts accessed through/by ZAP -func (c Core) Hosts() (map[string]interface{}, error) { - return c.c.Request("core/view/hosts/", nil) -} - -// Gets the sites accessed through/by ZAP (scheme and domain) -func (c Core) Sites() (map[string]interface{}, error) { - return c.c.Request("core/view/sites/", nil) -} - -// Gets the URLs accessed through/by ZAP, optionally filtering by (base) URL. -func (c Core) Urls(baseurl string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - } - return c.c.Request("core/view/urls/", m) -} - -// Gets the child nodes underneath the specified URL in the Sites tree -func (c Core) ChildNodes(url string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - } - return c.c.Request("core/view/childNodes/", m) -} - -// Gets the HTTP message with the given ID. Returns the ID, request/response headers and bodies, cookies, note, type, RTT, and timestamp. -func (c Core) Message(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return c.c.Request("core/view/message/", m) -} - -// Gets the HTTP messages sent by ZAP, request and response, optionally filtered by URL and paginated with 'start' position and 'count' of messages -func (c Core) Messages(baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - "start": start, - "count": count, - } - return c.c.Request("core/view/messages/", m) -} - -// Gets the HTTP messages with the given IDs. -func (c Core) MessagesById(ids string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - } - return c.c.Request("core/view/messagesById/", m) -} - -// Gets the number of messages, optionally filtering by URL -func (c Core) NumberOfMessages(baseurl string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - } - return c.c.Request("core/view/numberOfMessages/", m) -} - -// Gets the mode -func (c Core) Mode() (map[string]interface{}, error) { - return c.c.Request("core/view/mode/", nil) -} - -// Gets ZAP version -func (c Core) Version() (map[string]interface{}, error) { - return c.c.Request("core/view/version/", nil) -} - -// Gets the regular expressions, applied to URLs, to exclude from the local proxies. -func (c Core) ExcludedFromProxy() (map[string]interface{}, error) { - return c.c.Request("core/view/excludedFromProxy/", nil) -} - -// Gets the location of the current session file -func (c Core) SessionLocation() (map[string]interface{}, error) { - return c.c.Request("core/view/sessionLocation/", nil) -} - -// Gets all the domains that are excluded from the outgoing proxy. For each domain the following are shown: the index, the value (domain), if enabled, and if specified as a regex. -func (c Core) ProxyChainExcludedDomains() (map[string]interface{}, error) { - return c.c.Request("core/view/proxyChainExcludedDomains/", nil) -} - -// Gets the path to ZAP's home directory. -func (c Core) ZapHomePath() (map[string]interface{}, error) { - return c.c.Request("core/view/zapHomePath/", nil) -} - -// Gets the maximum number of alert instances to include in a report. -func (c Core) OptionMaximumAlertInstances() (map[string]interface{}, error) { - return c.c.Request("core/view/optionMaximumAlertInstances/", nil) -} - -// Gets whether or not related alerts will be merged in any reports generated. -func (c Core) OptionMergeRelatedAlerts() (map[string]interface{}, error) { - return c.c.Request("core/view/optionMergeRelatedAlerts/", nil) -} - -// Gets the path to the file with alert overrides. -func (c Core) OptionAlertOverridesFilePath() (map[string]interface{}, error) { - return c.c.Request("core/view/optionAlertOverridesFilePath/", nil) -} - -func (c Core) HomeDirectory() (map[string]interface{}, error) { - return c.c.Request("core/view/homeDirectory/", nil) -} - -// Use view proxyChainExcludedDomains instead. -func (c Core) OptionProxyChainSkipName() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyChainSkipName/", nil) -} - -// Use view proxyChainExcludedDomains instead. -func (c Core) OptionProxyExcludedDomains() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyExcludedDomains/", nil) -} - -// Use view proxyChainExcludedDomains instead. -func (c Core) OptionProxyExcludedDomainsEnabled() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyExcludedDomainsEnabled/", nil) -} - -// Gets the alert with the given ID, the corresponding HTTP message can be obtained with the 'messageId' field and 'message' API method -func (c Core) Alert(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return c.c.Request("core/view/alert/", m) -} - -// Gets the alerts raised by ZAP, optionally filtering by URL or riskId, and paginating with 'start' position and 'count' of alerts -func (c Core) Alerts(baseurl string, start string, count string, riskid string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - "start": start, - "count": count, - "riskId": riskid, - } - return c.c.Request("core/view/alerts/", m) -} - -// Gets number of alerts grouped by each risk level, optionally filtering by URL -func (c Core) AlertsSummary(baseurl string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - } - return c.c.Request("core/view/alertsSummary/", m) -} - -// Gets the number of alerts, optionally filtering by URL or riskId -func (c Core) NumberOfAlerts(baseurl string, riskid string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - "riskId": riskid, - } - return c.c.Request("core/view/numberOfAlerts/", m) -} - -// Gets the user agent that ZAP should use when creating HTTP messages (for example, spider messages or CONNECT requests to outgoing proxy). -func (c Core) OptionDefaultUserAgent() (map[string]interface{}, error) { - return c.c.Request("core/view/optionDefaultUserAgent/", nil) -} - -// Gets the TTL (in seconds) of successful DNS queries. -func (c Core) OptionDnsTtlSuccessfulQueries() (map[string]interface{}, error) { - return c.c.Request("core/view/optionDnsTtlSuccessfulQueries/", nil) -} - -func (c Core) OptionHttpState() (map[string]interface{}, error) { - return c.c.Request("core/view/optionHttpState/", nil) -} - -func (c Core) OptionProxyChainName() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyChainName/", nil) -} - -func (c Core) OptionProxyChainPassword() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyChainPassword/", nil) -} - -func (c Core) OptionProxyChainPort() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyChainPort/", nil) -} - -func (c Core) OptionProxyChainRealm() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyChainRealm/", nil) -} - -func (c Core) OptionProxyChainUserName() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyChainUserName/", nil) -} - -// Gets the connection time out (in seconds). -func (c Core) OptionTimeoutInSecs() (map[string]interface{}, error) { - return c.c.Request("core/view/optionTimeoutInSecs/", nil) -} - -func (c Core) OptionHttpStateEnabled() (map[string]interface{}, error) { - return c.c.Request("core/view/optionHttpStateEnabled/", nil) -} - -func (c Core) OptionProxyChainPrompt() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyChainPrompt/", nil) -} - -func (c Core) OptionSingleCookieRequestHeader() (map[string]interface{}, error) { - return c.c.Request("core/view/optionSingleCookieRequestHeader/", nil) -} - -func (c Core) OptionUseProxyChain() (map[string]interface{}, error) { - return c.c.Request("core/view/optionUseProxyChain/", nil) -} - -func (c Core) OptionUseProxyChainAuth() (map[string]interface{}, error) { - return c.c.Request("core/view/optionUseProxyChainAuth/", nil) -} - -// Gets whether or not the SOCKS proxy should be used. -func (c Core) OptionUseSocksProxy() (map[string]interface{}, error) { - return c.c.Request("core/view/optionUseSocksProxy/", nil) -} - -// Convenient and simple action to access a URL, optionally following redirections. Returns the request sent and response received and followed redirections, if any. Other actions are available which offer more control on what is sent, like, 'sendRequest' or 'sendHarRequest'. -func (c Core) AccessUrl(url string, followredirects string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - "followRedirects": followredirects, - } - return c.c.Request("core/action/accessUrl/", m) -} - -// Shuts down ZAP -func (c Core) Shutdown() (map[string]interface{}, error) { - return c.c.Request("core/action/shutdown/", nil) -} - -// Creates a new session, optionally overwriting existing files. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir. -func (c Core) NewSession(name string, overwrite string) (map[string]interface{}, error) { - m := map[string]string{ - "name": name, - "overwrite": overwrite, - } - return c.c.Request("core/action/newSession/", m) -} - -// Loads the session with the given name. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir. -func (c Core) LoadSession(name string) (map[string]interface{}, error) { - m := map[string]string{ - "name": name, - } - return c.c.Request("core/action/loadSession/", m) -} - -// Saves the session. -func (c Core) SaveSession(name string, overwrite string) (map[string]interface{}, error) { - m := map[string]string{ - "name": name, - "overwrite": overwrite, - } - return c.c.Request("core/action/saveSession/", m) -} - -// Snapshots the session, optionally with the given name, and overwriting existing files. If no name is specified the name of the current session with a timestamp appended is used. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir. -func (c Core) SnapshotSession(name string, overwrite string) (map[string]interface{}, error) { - m := map[string]string{ - "name": name, - "overwrite": overwrite, - } - return c.c.Request("core/action/snapshotSession/", m) -} - -// Clears the regexes of URLs excluded from the local proxies. -func (c Core) ClearExcludedFromProxy() (map[string]interface{}, error) { - return c.c.Request("core/action/clearExcludedFromProxy/", nil) -} - -// Adds a regex of URLs that should be excluded from the local proxies. -func (c Core) ExcludeFromProxy(regex string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - } - return c.c.Request("core/action/excludeFromProxy/", m) -} - -func (c Core) SetHomeDirectory(dir string) (map[string]interface{}, error) { - m := map[string]string{ - "dir": dir, - } - return c.c.Request("core/action/setHomeDirectory/", m) -} - -// Sets the mode, which may be one of [safe, protect, standard, attack] -func (c Core) SetMode(mode string) (map[string]interface{}, error) { - m := map[string]string{ - "mode": mode, - } - return c.c.Request("core/action/setMode/", m) -} - -// Generates a new Root CA certificate for the local proxies. -func (c Core) GenerateRootCA() (map[string]interface{}, error) { - return c.c.Request("core/action/generateRootCA/", nil) -} - -// Sends the HTTP request, optionally following redirections. Returns the request sent and response received and followed redirections, if any. The Mode is enforced when sending the request (and following redirections), custom manual requests are not allowed in 'Safe' mode nor in 'Protected' mode if out of scope. -func (c Core) SendRequest(request string, followredirects string) (map[string]interface{}, error) { - m := map[string]string{ - "request": request, - "followRedirects": followredirects, - } - return c.c.Request("core/action/sendRequest/", m) -} - -func (c Core) RunGarbageCollection() (map[string]interface{}, error) { - return c.c.Request("core/action/runGarbageCollection/", nil) -} - -// Deletes the site node found in the Sites Tree on the basis of the URL, HTTP method, and post data (if applicable and specified). -func (c Core) DeleteSiteNode(url string, method string, postdata string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - "method": method, - "postData": postdata, - } - return c.c.Request("core/action/deleteSiteNode/", m) -} - -// Adds a domain to be excluded from the outgoing proxy, using the specified value. Optionally sets if the new entry is enabled (default, true) and whether or not the new value is specified as a regex (default, false). -func (c Core) AddProxyChainExcludedDomain(value string, isregex string, isenabled string) (map[string]interface{}, error) { - m := map[string]string{ - "value": value, - "isRegex": isregex, - "isEnabled": isenabled, - } - return c.c.Request("core/action/addProxyChainExcludedDomain/", m) -} - -// Modifies a domain excluded from the outgoing proxy. Allows to modify the value, if enabled or if a regex. The domain is selected with its index, which can be obtained with the view proxyChainExcludedDomains. -func (c Core) ModifyProxyChainExcludedDomain(idx string, value string, isregex string, isenabled string) (map[string]interface{}, error) { - m := map[string]string{ - "idx": idx, - "value": value, - "isRegex": isregex, - "isEnabled": isenabled, - } - return c.c.Request("core/action/modifyProxyChainExcludedDomain/", m) -} - -// Removes a domain excluded from the outgoing proxy, with the given index. The index can be obtained with the view proxyChainExcludedDomains. -func (c Core) RemoveProxyChainExcludedDomain(idx string) (map[string]interface{}, error) { - m := map[string]string{ - "idx": idx, - } - return c.c.Request("core/action/removeProxyChainExcludedDomain/", m) -} - -// Enables all domains excluded from the outgoing proxy. -func (c Core) EnableAllProxyChainExcludedDomains() (map[string]interface{}, error) { - return c.c.Request("core/action/enableAllProxyChainExcludedDomains/", nil) -} - -// Disables all domains excluded from the outgoing proxy. -func (c Core) DisableAllProxyChainExcludedDomains() (map[string]interface{}, error) { - return c.c.Request("core/action/disableAllProxyChainExcludedDomains/", nil) -} - -// Sets the maximum number of alert instances to include in a report. A value of zero is treated as unlimited. -func (c Core) SetOptionMaximumAlertInstances(numberofinstances string) (map[string]interface{}, error) { - m := map[string]string{ - "numberOfInstances": numberofinstances, - } - return c.c.Request("core/action/setOptionMaximumAlertInstances/", m) -} - -// Sets whether or not related alerts will be merged in any reports generated. -func (c Core) SetOptionMergeRelatedAlerts(enabled string) (map[string]interface{}, error) { - m := map[string]string{ - "enabled": enabled, - } - return c.c.Request("core/action/setOptionMergeRelatedAlerts/", m) -} - -// Sets (or clears, if empty) the path to the file with alert overrides. -func (c Core) SetOptionAlertOverridesFilePath(filepath string) (map[string]interface{}, error) { - m := map[string]string{ - "filePath": filepath, - } - return c.c.Request("core/action/setOptionAlertOverridesFilePath/", m) -} - -// Enables use of a PKCS12 client certificate for the certificate with the given file system path, password, and optional index. -func (c Core) EnablePKCS12ClientCertificate(filepath string, password string, index string) (map[string]interface{}, error) { - m := map[string]string{ - "filePath": filepath, - "password": password, - "index": index, - } - return c.c.Request("core/action/enablePKCS12ClientCertificate/", m) -} - -// Disables the option for use of client certificates. -func (c Core) DisableClientCertificate() (map[string]interface{}, error) { - return c.c.Request("core/action/disableClientCertificate/", nil) -} - -// Deletes all alerts of the current session. -func (c Core) DeleteAllAlerts() (map[string]interface{}, error) { - return c.c.Request("core/action/deleteAllAlerts/", nil) -} - -// Deletes the alert with the given ID. -func (c Core) DeleteAlert(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return c.c.Request("core/action/deleteAlert/", m) -} - -// Sets the user agent that ZAP should use when creating HTTP messages (for example, spider messages or CONNECT requests to outgoing proxy). -func (c Core) SetOptionDefaultUserAgent(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return c.c.Request("core/action/setOptionDefaultUserAgent/", m) -} - -func (c Core) SetOptionProxyChainName(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return c.c.Request("core/action/setOptionProxyChainName/", m) -} - -func (c Core) SetOptionProxyChainPassword(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return c.c.Request("core/action/setOptionProxyChainPassword/", m) -} - -func (c Core) SetOptionProxyChainRealm(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return c.c.Request("core/action/setOptionProxyChainRealm/", m) -} - -// Use actions [add|modify|remove]ProxyChainExcludedDomain instead. -func (c Core) SetOptionProxyChainSkipName(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return c.c.Request("core/action/setOptionProxyChainSkipName/", m) -} - -func (c Core) SetOptionProxyChainUserName(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return c.c.Request("core/action/setOptionProxyChainUserName/", m) -} - -// Sets the TTL (in seconds) of successful DNS queries (applies after ZAP restart). -func (c Core) SetOptionDnsTtlSuccessfulQueries(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return c.c.Request("core/action/setOptionDnsTtlSuccessfulQueries/", m) -} - -func (c Core) SetOptionHttpStateEnabled(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return c.c.Request("core/action/setOptionHttpStateEnabled/", m) -} - -func (c Core) SetOptionProxyChainPort(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return c.c.Request("core/action/setOptionProxyChainPort/", m) -} - -func (c Core) SetOptionProxyChainPrompt(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return c.c.Request("core/action/setOptionProxyChainPrompt/", m) -} - -func (c Core) SetOptionSingleCookieRequestHeader(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return c.c.Request("core/action/setOptionSingleCookieRequestHeader/", m) -} - -// Sets the connection time out (in seconds). -func (c Core) SetOptionTimeoutInSecs(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return c.c.Request("core/action/setOptionTimeoutInSecs/", m) -} - -// Sets whether or not the outgoing proxy should be used. The address/hostname of the outgoing proxy must be set to enable this option. -func (c Core) SetOptionUseProxyChain(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return c.c.Request("core/action/setOptionUseProxyChain/", m) -} - -func (c Core) SetOptionUseProxyChainAuth(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return c.c.Request("core/action/setOptionUseProxyChainAuth/", m) -} - -// Sets whether or not the SOCKS proxy should be used. -func (c Core) SetOptionUseSocksProxy(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return c.c.Request("core/action/setOptionUseSocksProxy/", m) -} - -func (c Core) Proxypac() ([]byte, error) { - return c.c.RequestOther("core/other/proxy.pac/", nil) -} - -// Gets the Root CA certificate used by the local proxies. -func (c Core) Rootcert() ([]byte, error) { - return c.c.RequestOther("core/other/rootcert/", nil) -} - -func (c Core) Setproxy(proxy string) ([]byte, error) { - m := map[string]string{ - "proxy": proxy, - } - return c.c.RequestOther("core/other/setproxy/", m) -} - -// Generates a report in XML format -func (c Core) Xmlreport() ([]byte, error) { - return c.c.RequestOther("core/other/xmlreport/", nil) -} - -// Generates a report in HTML format -func (c Core) Htmlreport() ([]byte, error) { - return c.c.RequestOther("core/other/htmlreport/", nil) -} - -// Generates a report in JSON format -func (c Core) Jsonreport() ([]byte, error) { - return c.c.RequestOther("core/other/jsonreport/", nil) -} - -// Generates a report in Markdown format -func (c Core) Mdreport() ([]byte, error) { - return c.c.RequestOther("core/other/mdreport/", nil) -} - -// Gets the message with the given ID in HAR format -func (c Core) MessageHar(id string) ([]byte, error) { - m := map[string]string{ - "id": id, - } - return c.c.RequestOther("core/other/messageHar/", m) -} - -// Gets the HTTP messages sent through/by ZAP, in HAR format, optionally filtered by URL and paginated with 'start' position and 'count' of messages -func (c Core) MessagesHar(baseurl string, start string, count string) ([]byte, error) { - m := map[string]string{ - "baseurl": baseurl, - "start": start, - "count": count, - } - return c.c.RequestOther("core/other/messagesHar/", m) -} - -// Gets the HTTP messages with the given IDs, in HAR format. -func (c Core) MessagesHarById(ids string) ([]byte, error) { - m := map[string]string{ - "ids": ids, - } - return c.c.RequestOther("core/other/messagesHarById/", m) -} - -// Sends the first HAR request entry, optionally following redirections. Returns, in HAR format, the request sent and response received and followed redirections, if any. The Mode is enforced when sending the request (and following redirections), custom manual requests are not allowed in 'Safe' mode nor in 'Protected' mode if out of scope. -func (c Core) SendHarRequest(request string, followredirects string) ([]byte, error) { - m := map[string]string{ - "request": request, - "followRedirects": followredirects, - } - return c.c.RequestOther("core/other/sendHarRequest/", m) -} diff --git a/zap/exportreport_generated.go b/zap/exportreport_generated.go deleted file mode 100644 index 49c0ebb..0000000 --- a/zap/exportreport_generated.go +++ /dev/null @@ -1,45 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Exportreport struct { - c *Client -} - -// This component is optional and therefore the API will only work if it is installed -func (e Exportreport) Formats() (map[string]interface{}, error) { - return e.c.Request("exportreport/view/formats/", nil) -} - -// This component is optional and therefore the API will only work if it is installed -func (e Exportreport) Generate(absolutepath string, fileextension string, sourcedetails string, alertseverity string, alertdetails string, scanid string, includepassivealerts string) (map[string]interface{}, error) { - m := map[string]string{ - "absolutePath": absolutepath, - "fileExtension": fileextension, - "sourceDetails": sourcedetails, - "alertSeverity": alertseverity, - "alertDetails": alertdetails, - "scanId": scanid, - "includePassiveAlerts": includepassivealerts, - } - return e.c.Request("exportreport/action/generate/", m) -} diff --git a/zap/forced-user_generated.go b/zap/forced-user_generated.go deleted file mode 100644 index 84a8f01..0000000 --- a/zap/forced-user_generated.go +++ /dev/null @@ -1,58 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -import "strconv" - -type ForcedUser struct { - c *Client -} - -// Returns 'true' if 'forced user' mode is enabled, 'false' otherwise -func (f ForcedUser) IsForcedUserModeEnabled() (map[string]interface{}, error) { - return f.c.Request("forcedUser/view/isForcedUserModeEnabled/", nil) -} - -// Gets the user (ID) set as 'forced user' for the given context (ID) -func (f ForcedUser) GetForcedUser(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return f.c.Request("forcedUser/view/getForcedUser/", m) -} - -// Sets the user (ID) that should be used in 'forced user' mode for the given context (ID) -func (f ForcedUser) SetForcedUser(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return f.c.Request("forcedUser/action/setForcedUser/", m) -} - -// Sets if 'forced user' mode should be enabled or not -func (f ForcedUser) SetForcedUserModeEnabled(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "boolean": strconv.FormatBool(boolean), - } - return f.c.Request("forcedUser/action/setForcedUserModeEnabled/", m) -} diff --git a/zap/graphql_generated.go b/zap/graphql_generated.go deleted file mode 100644 index 98d59cb..0000000 --- a/zap/graphql_generated.go +++ /dev/null @@ -1,186 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -import "strconv" - -type Graphql struct { - c *Client -} - -// Returns how arguments are currently specified. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) OptionArgsType() (map[string]interface{}, error) { - return g.c.Request("graphql/view/optionArgsType/", nil) -} - -// Returns whether or not lenient maximum query generation depth is enabled. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) OptionLenientMaxQueryDepthEnabled() (map[string]interface{}, error) { - return g.c.Request("graphql/view/optionLenientMaxQueryDepthEnabled/", nil) -} - -// Returns the current maximum additional query generation depth. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) OptionMaxAdditionalQueryDepth() (map[string]interface{}, error) { - return g.c.Request("graphql/view/optionMaxAdditionalQueryDepth/", nil) -} - -// Returns the current maximum arguments generation depth. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) OptionMaxArgsDepth() (map[string]interface{}, error) { - return g.c.Request("graphql/view/optionMaxArgsDepth/", nil) -} - -// Returns the current maximum query generation depth. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) OptionMaxQueryDepth() (map[string]interface{}, error) { - return g.c.Request("graphql/view/optionMaxQueryDepth/", nil) -} - -// Returns whether or not optional arguments are currently specified. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) OptionOptionalArgsEnabled() (map[string]interface{}, error) { - return g.c.Request("graphql/view/optionOptionalArgsEnabled/", nil) -} - -// Returns the current level for which a single query is generated. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) OptionQuerySplitType() (map[string]interface{}, error) { - return g.c.Request("graphql/view/optionQuerySplitType/", nil) -} - -// Returns the current request method. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) OptionRequestMethod() (map[string]interface{}, error) { - return g.c.Request("graphql/view/optionRequestMethod/", nil) -} - -// Imports a GraphQL Schema from a File. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) ImportFile(endurl string, file string) (map[string]interface{}, error) { - m := map[string]string{ - "endurl": endurl, - "file": file, - } - return g.c.Request("graphql/action/importFile/", m) -} - -// Imports a GraphQL Schema from a URL. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) ImportUrl(endurl string, url string) (map[string]interface{}, error) { - m := map[string]string{ - "endurl": endurl, - "url": url, - } - return g.c.Request("graphql/action/importUrl/", m) -} - -// Sets how arguments are specified. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) SetOptionArgsType(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return g.c.Request("graphql/action/setOptionArgsType/", m) -} - -// Sets the level for which a single query is generated. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) SetOptionQuerySplitType(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return g.c.Request("graphql/action/setOptionQuerySplitType/", m) -} - -// Sets the request method. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) SetOptionRequestMethod(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return g.c.Request("graphql/action/setOptionRequestMethod/", m) -} - -// Sets whether or not Maximum Query Depth is enforced leniently. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) SetOptionLenientMaxQueryDepthEnabled(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return g.c.Request("graphql/action/setOptionLenientMaxQueryDepthEnabled/", m) -} - -// Sets the maximum additional query generation depth (used if enforced leniently). -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) SetOptionMaxAdditionalQueryDepth(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return g.c.Request("graphql/action/setOptionMaxAdditionalQueryDepth/", m) -} - -// Sets the maximum arguments generation depth. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) SetOptionMaxArgsDepth(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return g.c.Request("graphql/action/setOptionMaxArgsDepth/", m) -} - -// Sets the maximum query generation depth. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) SetOptionMaxQueryDepth(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return g.c.Request("graphql/action/setOptionMaxQueryDepth/", m) -} - -// Sets whether or not Optional Arguments should be specified. -// -// This component is optional and therefore the API will only work if it is installed -func (g Graphql) SetOptionOptionalArgsEnabled(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return g.c.Request("graphql/action/setOptionOptionalArgsEnabled/", m) -} diff --git a/zap/http-sessions_generated.go b/zap/http-sessions_generated.go deleted file mode 100644 index 391e136..0000000 --- a/zap/http-sessions_generated.go +++ /dev/null @@ -1,161 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type HttpSessions struct { - c *Client -} - -// Gets all of the sites that have sessions. -func (h HttpSessions) Sites() (map[string]interface{}, error) { - return h.c.Request("httpSessions/view/sites/", nil) -} - -// Gets the sessions for the given site. Optionally returning just the session with the given name. -func (h HttpSessions) Sessions(site string, session string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "session": session, - } - return h.c.Request("httpSessions/view/sessions/", m) -} - -// Gets the name of the active session for the given site. -func (h HttpSessions) ActiveSession(site string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - } - return h.c.Request("httpSessions/view/activeSession/", m) -} - -// Gets the names of the session tokens for the given site. -func (h HttpSessions) SessionTokens(site string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - } - return h.c.Request("httpSessions/view/sessionTokens/", m) -} - -// Gets the default session tokens. -func (h HttpSessions) DefaultSessionTokens() (map[string]interface{}, error) { - return h.c.Request("httpSessions/view/defaultSessionTokens/", nil) -} - -// Creates an empty session for the given site. Optionally with the given name. -func (h HttpSessions) CreateEmptySession(site string, session string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "session": session, - } - return h.c.Request("httpSessions/action/createEmptySession/", m) -} - -// Removes the session from the given site. -func (h HttpSessions) RemoveSession(site string, session string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "session": session, - } - return h.c.Request("httpSessions/action/removeSession/", m) -} - -// Sets the given session as active for the given site. -func (h HttpSessions) SetActiveSession(site string, session string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "session": session, - } - return h.c.Request("httpSessions/action/setActiveSession/", m) -} - -// Unsets the active session of the given site. -func (h HttpSessions) UnsetActiveSession(site string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - } - return h.c.Request("httpSessions/action/unsetActiveSession/", m) -} - -// Adds the session token to the given site. -func (h HttpSessions) AddSessionToken(site string, sessiontoken string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "sessionToken": sessiontoken, - } - return h.c.Request("httpSessions/action/addSessionToken/", m) -} - -// Removes the session token from the given site. -func (h HttpSessions) RemoveSessionToken(site string, sessiontoken string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "sessionToken": sessiontoken, - } - return h.c.Request("httpSessions/action/removeSessionToken/", m) -} - -// Sets the value of the session token of the given session for the given site. -func (h HttpSessions) SetSessionTokenValue(site string, session string, sessiontoken string, tokenvalue string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "session": session, - "sessionToken": sessiontoken, - "tokenValue": tokenvalue, - } - return h.c.Request("httpSessions/action/setSessionTokenValue/", m) -} - -// Renames the session of the given site. -func (h HttpSessions) RenameSession(site string, oldsessionname string, newsessionname string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "oldSessionName": oldsessionname, - "newSessionName": newsessionname, - } - return h.c.Request("httpSessions/action/renameSession/", m) -} - -// Adds a default session token with the given name and enabled state. -func (h HttpSessions) AddDefaultSessionToken(sessiontoken string, tokenenabled string) (map[string]interface{}, error) { - m := map[string]string{ - "sessionToken": sessiontoken, - "tokenEnabled": tokenenabled, - } - return h.c.Request("httpSessions/action/addDefaultSessionToken/", m) -} - -// Sets whether or not the default session token with the given name is enabled. -func (h HttpSessions) SetDefaultSessionTokenEnabled(sessiontoken string, tokenenabled string) (map[string]interface{}, error) { - m := map[string]string{ - "sessionToken": sessiontoken, - "tokenEnabled": tokenenabled, - } - return h.c.Request("httpSessions/action/setDefaultSessionTokenEnabled/", m) -} - -// Removes the default session token with the given name. -func (h HttpSessions) RemoveDefaultSessionToken(sessiontoken string) (map[string]interface{}, error) { - m := map[string]string{ - "sessionToken": sessiontoken, - } - return h.c.Request("httpSessions/action/removeDefaultSessionToken/", m) -} diff --git a/zap/import-log-files_generated.go b/zap/import-log-files_generated.go deleted file mode 100644 index 43b4133..0000000 --- a/zap/import-log-files_generated.go +++ /dev/null @@ -1,67 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type ImportLogFiles struct { - c *Client -} - -// This component is optional and therefore the API will only work if it is installed -func (i ImportLogFiles) ImportZAPLogFromFile(filepath string) (map[string]interface{}, error) { - m := map[string]string{ - "FilePath": filepath, - } - return i.c.Request("importLogFiles/action/ImportZAPLogFromFile/", m) -} - -// This component is optional and therefore the API will only work if it is installed -func (i ImportLogFiles) ImportModSecurityLogFromFile(filepath string) (map[string]interface{}, error) { - m := map[string]string{ - "FilePath": filepath, - } - return i.c.Request("importLogFiles/action/ImportModSecurityLogFromFile/", m) -} - -// This component is optional and therefore the API will only work if it is installed -func (i ImportLogFiles) ImportZAPHttpRequestResponsePair(httprequest string, httpresponse string) (map[string]interface{}, error) { - m := map[string]string{ - "HTTPRequest": httprequest, - "HTTPResponse": httpresponse, - } - return i.c.Request("importLogFiles/action/ImportZAPHttpRequestResponsePair/", m) -} - -// This component is optional and therefore the API will only work if it is installed -func (i ImportLogFiles) PostModSecurityAuditEvent(auditeventstring string) (map[string]interface{}, error) { - m := map[string]string{ - "AuditEventString": auditeventstring, - } - return i.c.Request("importLogFiles/action/PostModSecurityAuditEvent/", m) -} - -// This component is optional and therefore the API will only work if it is installed -func (i ImportLogFiles) OtherPostModSecurityAuditEvent(auditeventstring string) ([]byte, error) { - m := map[string]string{ - "AuditEventString": auditeventstring, - } - return i.c.RequestOther("importLogFiles/other/OtherPostModSecurityAuditEvent/", m) -} diff --git a/zap/importurls_generated.go b/zap/importurls_generated.go deleted file mode 100644 index 3403673..0000000 --- a/zap/importurls_generated.go +++ /dev/null @@ -1,36 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Importurls struct { - c *Client -} - -// Imports URLs (one per line) from the file with the given file system path. -// -// This component is optional and therefore the API will only work if it is installed -func (i Importurls) Importurls(filepath string) (map[string]interface{}, error) { - m := map[string]string{ - "filePath": filepath, - } - return i.c.Request("importurls/action/importurls/", m) -} diff --git a/zap/interface.go b/zap/interface.go deleted file mode 100644 index 8b291bb..0000000 --- a/zap/interface.go +++ /dev/null @@ -1,264 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. - -// TODO: auto generate this file -package zap - -// Interface defines the interface a ZAP client should implement -type Interface interface { - AccessControl() *AccessControl - Acsrf() *Acsrf - AjaxSpider() *AjaxSpider - Alert() *Alert - AlertFilter() *AlertFilter - Ascan() *Ascan - Authentication() *Authentication - Authorization() *Authorization - Automation() *Automation - Autoupdate() *Autoupdate - Break() *Break - Context() *Context - Core() *Core - Exportreport() *Exportreport - ForcedUser() *ForcedUser - Graphql() *Graphql - HttpSessions() *HttpSessions - ImportLogFiles() *ImportLogFiles - Importurls() *Importurls - LocalProxies() *LocalProxies - Openapi() *Openapi - Params() *Params - Pnh() *Pnh - Pscan() *Pscan - Replacer() *Replacer - Reports() *Reports - Retest() *Retest - Reveal() *Reveal - Revisit() *Revisit - RuleConfig() *RuleConfig - Script() *Script - Search() *Search - Selenium() *Selenium - SessionManagement() *SessionManagement - Soap() *Soap - Spider() *Spider - Stats() *Stats - Users() *Users - Wappalyzer() *Wappalyzer - Websocket() *Websocket -} - -// AccessControl() returns a AccessControl client -func (c *Client) AccessControl() *AccessControl { - return &AccessControl{c} -} - -// Acsrf() returns a Acsrf client -func (c *Client) Acsrf() *Acsrf { - return &Acsrf{c} -} - -// AjaxSpider() returns a AjaxSpider client -func (c *Client) AjaxSpider() *AjaxSpider { - return &AjaxSpider{c} -} - -// Alert() returns a Alert client -func (c *Client) Alert() *Alert { - return &Alert{c} -} - -// AlertFilter() returns a AlertFilter client -func (c *Client) AlertFilter() *AlertFilter { - return &AlertFilter{c} -} - -// Ascan() returns a Ascan client -func (c *Client) Ascan() *Ascan { - return &Ascan{c} -} - -// Authentication() returns a Authentication client -func (c *Client) Authentication() *Authentication { - return &Authentication{c} -} - -// Authorization() returns a Authorization client -func (c *Client) Authorization() *Authorization { - return &Authorization{c} -} - -// Autoupdate returns an Autoupdate client -func (c *Client) Autoupdate() *Autoupdate { - return &Autoupdate{c} -} - -// Automation() returns an Automation client -func (c *Client) Automation() *Automation { - return &Automation{c} -} - -// Break() returns a Break client -func (c *Client) Break() *Break { - return &Break{c} -} - -// Context() returns a Context client -func (c *Client) Context() *Context { - return &Context{c} -} - -// Core() returns a Core client -func (c *Client) Core() *Core { - return &Core{c} -} - -// Exportreport() returns a Exportreport client -func (c *Client) Exportreport() *Exportreport { - return &Exportreport{c} -} - -// ForcedUser() returns a ForcedUser client -func (c *Client) ForcedUser() *ForcedUser { - return &ForcedUser{c} -} - -// Graphql() returns a Graphql client -func (c *Client) Graphql() *Graphql { - return &Graphql{c} -} - -// HttpSessions() returns a HttpSessions client -func (c *Client) HttpSessions() *HttpSessions { - return &HttpSessions{c} -} - -// ImportLogFiles() returns a ImportLogFiles client -func (c *Client) ImportLogFiles() *ImportLogFiles { - return &ImportLogFiles{c} -} - -// Importurls() returns a Importurls client -func (c *Client) Importurls() *Importurls { - return &Importurls{c} -} - -// LocalProxies() returns a LocalProxies client -func (c *Client) LocalProxies() *LocalProxies { - return &LocalProxies{c} -} - -// Openapi() returns a Openapi clinet -func (c *Client) Openapi() *Openapi { - return &Openapi{c} -} - -// Params() returns a Params client -func (c *Client) Params() *Params { - return &Params{c} -} - -// Pnh() returns a Pnh client -func (c *Client) Pnh() *Pnh { - return &Pnh{c} -} - -// Pscan() returns a Pscan client -func (c *Client) Pscan() *Pscan { - return &Pscan{c} -} - -// Replacer() returns a Replacer client -func (c *Client) Replacer() *Replacer { - return &Replacer{c} -} - -// Reports() returns a Reports client -func (c *Client) Reports() *Reports { - return &Reports{c} -} - -// Retest() returns a Retest client -func (c *Client) Retest() *Retest { - return &Retest{c} -} - -// Reveal() returns a Reveal client -func (c *Client) Reveal() *Reveal { - return &Reveal{c} -} - -// Revisit() returns a Revisit client -func (c *Client) Revisit() *Revisit { - return &Revisit{c} -} - -// RuleConfig() returns a RuleConfig client -func (c *Client) RuleConfig() *RuleConfig { - return &RuleConfig{c} -} - -// Script() returns a Script client -func (c *Client) Script() *Script { - return &Script{c} -} - -// Search() returns a Search client -func (c *Client) Search() *Search { - return &Search{c} -} - -// Selenium() returns a Selenium client -func (c *Client) Selenium() *Selenium { - return &Selenium{c} -} - -// SessionManagement() returns a SessionManagement client -func (c *Client) SessionManagement() *SessionManagement { - return &SessionManagement{c} -} - -// Soap() returns a Soap client -func (c *Client) Soap() *Soap { - return &Soap{c} -} - -// Spider() returns a Spider client -func (c *Client) Spider() *Spider { - return &Spider{c} -} - -// Stats() returns a Stats client -func (c *Client) Stats() *Stats { - return &Stats{c} -} - -// Users() returns a Users client -func (c *Client) Users() *Users { - return &Users{c} -} - -// Wappalyzer() returns a Wappalyzer client -func (c *Client) Wappalyzer() *Wappalyzer { - return &Wappalyzer{c} -} - -// Websocket() returns a Websocket client -func (c *Client) Websocket() *Websocket { - return &Websocket{c} -} diff --git a/zap/local-proxies_generated.go b/zap/local-proxies_generated.go deleted file mode 100644 index d80169e..0000000 --- a/zap/local-proxies_generated.go +++ /dev/null @@ -1,52 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type LocalProxies struct { - c *Client -} - -// Gets all of the additional proxies that have been configured. -func (l LocalProxies) AdditionalProxies() (map[string]interface{}, error) { - return l.c.Request("localProxies/view/additionalProxies/", nil) -} - -// Adds an new proxy using the details supplied. -func (l LocalProxies) AddAdditionalProxy(address string, port string, behindnat string, alwaysdecodezip string, removeunsupportedencodings string) (map[string]interface{}, error) { - m := map[string]string{ - "address": address, - "port": port, - "behindNat": behindnat, - "alwaysDecodeZip": alwaysdecodezip, - "removeUnsupportedEncodings": removeunsupportedencodings, - } - return l.c.Request("localProxies/action/addAdditionalProxy/", m) -} - -// Removes the additional proxy with the specified address and port. -func (l LocalProxies) RemoveAdditionalProxy(address string, port string) (map[string]interface{}, error) { - m := map[string]string{ - "address": address, - "port": port, - } - return l.c.Request("localProxies/action/removeAdditionalProxy/", m) -} diff --git a/zap/openapi_generated.go b/zap/openapi_generated.go deleted file mode 100644 index 9daf4dd..0000000 --- a/zap/openapi_generated.go +++ /dev/null @@ -1,50 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Openapi struct { - c *Client -} - -// Imports an OpenAPI definition from a local file. -// -// This component is optional and therefore the API will only work if it is installed -func (o Openapi) ImportFile(file string, target string, contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "file": file, - "target": target, - "contextId": contextid, - } - return o.c.Request("openapi/action/importFile/", m) -} - -// Imports an OpenAPI definition from a URL. -// -// This component is optional and therefore the API will only work if it is installed -func (o Openapi) ImportUrl(url string, hostoverride string, contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - "hostOverride": hostoverride, - "contextId": contextid, - } - return o.c.Request("openapi/action/importUrl/", m) -} diff --git a/zap/params_generated.go b/zap/params_generated.go deleted file mode 100644 index 4fe48c9..0000000 --- a/zap/params_generated.go +++ /dev/null @@ -1,34 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Params struct { - c *Client -} - -// Shows the parameters for the specified site, or for all sites if the site is not specified -func (p Params) Params(site string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - } - return p.c.Request("params/view/params/", m) -} diff --git a/zap/pnh_generated.go b/zap/pnh_generated.go deleted file mode 100644 index 3e5f36d..0000000 --- a/zap/pnh_generated.go +++ /dev/null @@ -1,79 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Pnh struct { - c *Client -} - -// This component is optional and therefore the API will only work if it is installed -func (p Pnh) Monitor(id string, message string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - "message": message, - } - return p.c.Request("pnh/action/monitor/", m) -} - -// This component is optional and therefore the API will only work if it is installed -func (p Pnh) Oracle(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return p.c.Request("pnh/action/oracle/", m) -} - -// This component is optional and therefore the API will only work if it is installed -func (p Pnh) StartMonitoring(url string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - } - return p.c.Request("pnh/action/startMonitoring/", m) -} - -// This component is optional and therefore the API will only work if it is installed -func (p Pnh) StopMonitoring(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return p.c.Request("pnh/action/stopMonitoring/", m) -} - -// This component is optional and therefore the API will only work if it is installed -func (p Pnh) Pnh() ([]byte, error) { - return p.c.RequestOther("pnh/other/pnh/", nil) -} - -// This component is optional and therefore the API will only work if it is installed -func (p Pnh) Manifest() ([]byte, error) { - return p.c.RequestOther("pnh/other/manifest/", nil) -} - -// This component is optional and therefore the API will only work if it is installed -func (p Pnh) Service() ([]byte, error) { - return p.c.RequestOther("pnh/other/service/", nil) -} - -// This component is optional and therefore the API will only work if it is installed -func (p Pnh) Fx_pnhxpi() ([]byte, error) { - return p.c.RequestOther("pnh/other/fx_pnh.xpi/", nil) -} diff --git a/zap/pscan_generated.go b/zap/pscan_generated.go deleted file mode 100644 index b667348..0000000 --- a/zap/pscan_generated.go +++ /dev/null @@ -1,120 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Pscan struct { - c *Client -} - -// Tells whether or not the passive scan should be performed only on messages that are in scope. -func (p Pscan) ScanOnlyInScope() (map[string]interface{}, error) { - return p.c.Request("pscan/view/scanOnlyInScope/", nil) -} - -// The number of records the passive scanner still has to scan -func (p Pscan) RecordsToScan() (map[string]interface{}, error) { - return p.c.Request("pscan/view/recordsToScan/", nil) -} - -// Lists all passive scanners with its ID, name, enabled state and alert threshold. -func (p Pscan) Scanners() (map[string]interface{}, error) { - return p.c.Request("pscan/view/scanners/", nil) -} - -// Show information about the passive scan rule currently being run (if any). -func (p Pscan) CurrentRule() (map[string]interface{}, error) { - return p.c.Request("pscan/view/currentRule/", nil) -} - -// Gets the maximum number of alerts a passive scan rule should raise. -func (p Pscan) MaxAlertsPerRule() (map[string]interface{}, error) { - return p.c.Request("pscan/view/maxAlertsPerRule/", nil) -} - -// Sets whether or not the passive scanning is enabled (Note: the enabled state is not persisted). -func (p Pscan) SetEnabled(enabled string) (map[string]interface{}, error) { - m := map[string]string{ - "enabled": enabled, - } - return p.c.Request("pscan/action/setEnabled/", m) -} - -// Sets whether or not the passive scan should be performed only on messages that are in scope. -func (p Pscan) SetScanOnlyInScope(onlyinscope string) (map[string]interface{}, error) { - m := map[string]string{ - "onlyInScope": onlyinscope, - } - return p.c.Request("pscan/action/setScanOnlyInScope/", m) -} - -// Enables all passive scanners -func (p Pscan) EnableAllScanners() (map[string]interface{}, error) { - return p.c.Request("pscan/action/enableAllScanners/", nil) -} - -// Disables all passive scanners -func (p Pscan) DisableAllScanners() (map[string]interface{}, error) { - return p.c.Request("pscan/action/disableAllScanners/", nil) -} - -// Enables all passive scanners with the given IDs (comma separated list of IDs) -func (p Pscan) EnableScanners(ids string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - } - return p.c.Request("pscan/action/enableScanners/", m) -} - -// Disables all passive scanners with the given IDs (comma separated list of IDs) -func (p Pscan) DisableScanners(ids string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - } - return p.c.Request("pscan/action/disableScanners/", m) -} - -// Sets the alert threshold of the passive scanner with the given ID, accepted values for alert threshold: OFF, DEFAULT, LOW, MEDIUM and HIGH -func (p Pscan) SetScannerAlertThreshold(id string, alertthreshold string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - "alertThreshold": alertthreshold, - } - return p.c.Request("pscan/action/setScannerAlertThreshold/", m) -} - -// Sets the maximum number of alerts a passive scan rule should raise. -func (p Pscan) SetMaxAlertsPerRule(maxalerts string) (map[string]interface{}, error) { - m := map[string]string{ - "maxAlerts": maxalerts, - } - return p.c.Request("pscan/action/setMaxAlertsPerRule/", m) -} - -// Disables all passive scan tags. -func (p Pscan) DisableAllTags() (map[string]interface{}, error) { - return p.c.Request("pscan/action/disableAllTags/", nil) -} - -// Enables all passive scan tags. -func (p Pscan) EnableAllTags() (map[string]interface{}, error) { - return p.c.Request("pscan/action/enableAllTags/", nil) -} diff --git a/zap/replacer_generated.go b/zap/replacer_generated.go deleted file mode 100644 index 8b45c44..0000000 --- a/zap/replacer_generated.go +++ /dev/null @@ -1,70 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Replacer struct { - c *Client -} - -// Returns full details of all of the rules -// -// This component is optional and therefore the API will only work if it is installed -func (r Replacer) Rules() (map[string]interface{}, error) { - return r.c.Request("replacer/view/rules/", nil) -} - -// Adds a replacer rule. For the parameters: desc is a user friendly description, enabled is true or false, matchType is one of [REQ_HEADER, REQ_HEADER_STR, REQ_BODY_STR, RESP_HEADER, RESP_HEADER_STR, RESP_BODY_STR], matchRegex should be true if the matchString should be treated as a regex otherwise false, matchString is the string that will be matched against, replacement is the replacement string, initiators may be blank (for all initiators) or a comma separated list of integers as defined in HttpSender -// -// This component is optional and therefore the API will only work if it is installed -func (r Replacer) AddRule(description string, enabled string, matchtype string, matchregex string, matchstring string, replacement string, initiators string) (map[string]interface{}, error) { - m := map[string]string{ - "description": description, - "enabled": enabled, - "matchType": matchtype, - "matchRegex": matchregex, - "matchString": matchstring, - "replacement": replacement, - "initiators": initiators, - } - return r.c.Request("replacer/action/addRule/", m) -} - -// Removes the rule with the given description -// -// This component is optional and therefore the API will only work if it is installed -func (r Replacer) RemoveRule(description string) (map[string]interface{}, error) { - m := map[string]string{ - "description": description, - } - return r.c.Request("replacer/action/removeRule/", m) -} - -// Enables or disables the rule with the given description based on the bool parameter -// -// This component is optional and therefore the API will only work if it is installed -func (r Replacer) SetEnabled(description string, bool string) (map[string]interface{}, error) { - m := map[string]string{ - "description": description, - "bool": bool, - } - return r.c.Request("replacer/action/setEnabled/", m) -} diff --git a/zap/reports_generated.go b/zap/reports_generated.go deleted file mode 100644 index 0725bfd..0000000 --- a/zap/reports_generated.go +++ /dev/null @@ -1,65 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Reports struct { - c *Client -} - -// View available templates. -// -// This component is optional and therefore the API will only work if it is installed -func (r Reports) Templates() (map[string]interface{}, error) { - return r.c.Request("reports/view/templates/", nil) -} - -// View details of the specified template. -// -// This component is optional and therefore the API will only work if it is installed -func (r Reports) TemplateDetails(template string) (map[string]interface{}, error) { - m := map[string]string{ - "template": template, - } - return r.c.Request("reports/view/templateDetails/", m) -} - -// Generate a report with the supplied parameters. -// -// This component is optional and therefore the API will only work if it is installed -func (r Reports) Generate(title string, template string, theme string, description string, contexts string, sites string, sections string, includedconfidences string, includedrisks string, reportfilename string, reportfilenamepattern string, reportdir string, display string) (map[string]interface{}, error) { - m := map[string]string{ - "title": title, - "template": template, - "theme": theme, - "description": description, - "contexts": contexts, - "sites": sites, - "sections": sections, - "includedConfidences": includedconfidences, - "includedRisks": includedrisks, - "reportFileName": reportfilename, - "reportFileNamePattern": reportfilenamepattern, - "reportDir": reportdir, - "display": display, - } - return r.c.Request("reports/action/generate/", m) -} diff --git a/zap/retest_generated.go b/zap/retest_generated.go deleted file mode 100644 index 3352f6b..0000000 --- a/zap/retest_generated.go +++ /dev/null @@ -1,34 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Retest struct { - c *Client -} - -// This component is optional and therefore the API will only work if it is installed -func (r Retest) Retest(alertids string) (map[string]interface{}, error) { - m := map[string]string{ - "alertIds": alertids, - } - return r.c.Request("retest/action/retest/", m) -} diff --git a/zap/reveal_generated.go b/zap/reveal_generated.go deleted file mode 100644 index 48b0929..0000000 --- a/zap/reveal_generated.go +++ /dev/null @@ -1,43 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Reveal struct { - c *Client -} - -// Tells if shows hidden fields and enables disabled fields -// -// This component is optional and therefore the API will only work if it is installed -func (r Reveal) Reveal() (map[string]interface{}, error) { - return r.c.Request("reveal/view/reveal/", nil) -} - -// Sets if shows hidden fields and enables disabled fields -// -// This component is optional and therefore the API will only work if it is installed -func (r Reveal) SetReveal(reveal string) (map[string]interface{}, error) { - m := map[string]string{ - "reveal": reveal, - } - return r.c.Request("reveal/action/setReveal/", m) -} diff --git a/zap/revisit_generated.go b/zap/revisit_generated.go deleted file mode 100644 index 2b5a2e3..0000000 --- a/zap/revisit_generated.go +++ /dev/null @@ -1,49 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Revisit struct { - c *Client -} - -// This component is optional and therefore the API will only work if it is installed -func (r Revisit) RevisitList() (map[string]interface{}, error) { - return r.c.Request("revisit/view/revisitList/", nil) -} - -// This component is optional and therefore the API will only work if it is installed -func (r Revisit) RevisitSiteOn(site string, starttime string, endtime string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "startTime": starttime, - "endTime": endtime, - } - return r.c.Request("revisit/action/revisitSiteOn/", m) -} - -// This component is optional and therefore the API will only work if it is installed -func (r Revisit) RevisitSiteOff(site string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - } - return r.c.Request("revisit/action/revisitSiteOff/", m) -} diff --git a/zap/rule-config_generated.go b/zap/rule-config_generated.go deleted file mode 100644 index bccf237..0000000 --- a/zap/rule-config_generated.go +++ /dev/null @@ -1,61 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type RuleConfig struct { - c *Client -} - -// Show the specified rule configuration -func (r RuleConfig) RuleConfigValue(key string) (map[string]interface{}, error) { - m := map[string]string{ - "key": key, - } - return r.c.Request("ruleConfig/view/ruleConfigValue/", m) -} - -// Show all of the rule configurations -func (r RuleConfig) AllRuleConfigs() (map[string]interface{}, error) { - return r.c.Request("ruleConfig/view/allRuleConfigs/", nil) -} - -// Reset the specified rule configuration, which must already exist -func (r RuleConfig) ResetRuleConfigValue(key string) (map[string]interface{}, error) { - m := map[string]string{ - "key": key, - } - return r.c.Request("ruleConfig/action/resetRuleConfigValue/", m) -} - -// Reset all of the rule configurations -func (r RuleConfig) ResetAllRuleConfigValues() (map[string]interface{}, error) { - return r.c.Request("ruleConfig/action/resetAllRuleConfigValues/", nil) -} - -// Set the specified rule configuration, which must already exist -func (r RuleConfig) SetRuleConfigValue(key string, value string) (map[string]interface{}, error) { - m := map[string]string{ - "key": key, - "value": value, - } - return r.c.Request("ruleConfig/action/setRuleConfigValue/", m) -} diff --git a/zap/script_generated.go b/zap/script_generated.go deleted file mode 100644 index 5a5a909..0000000 --- a/zap/script_generated.go +++ /dev/null @@ -1,212 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Script struct { - c *Client -} - -// Lists the script engines available -func (s Script) ListEngines() (map[string]interface{}, error) { - return s.c.Request("script/view/listEngines/", nil) -} - -// Lists the script types available. -func (s Script) ListTypes() (map[string]interface{}, error) { - return s.c.Request("script/view/listTypes/", nil) -} - -// Lists the scripts available, with its engine, name, description, type and error state. -func (s Script) ListScripts() (map[string]interface{}, error) { - return s.c.Request("script/view/listScripts/", nil) -} - -// Gets the value of the global variable with the given key. Returns an API error (DOES_NOT_EXIST) if no value was previously set. -func (s Script) GlobalVar(varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "varKey": varkey, - } - return s.c.Request("script/view/globalVar/", m) -} - -// Gets the value (string representation) of a global custom variable. Returns an API error (DOES_NOT_EXIST) if no value was previously set. -func (s Script) GlobalCustomVar(varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "varKey": varkey, - } - return s.c.Request("script/view/globalCustomVar/", m) -} - -// Gets all the global variables (key/value pairs). -func (s Script) GlobalVars() (map[string]interface{}, error) { - return s.c.Request("script/view/globalVars/", nil) -} - -// Gets all the global custom variables (key/value pairs, the value is the string representation). -func (s Script) GlobalCustomVars() (map[string]interface{}, error) { - return s.c.Request("script/view/globalCustomVars/", nil) -} - -// Gets the value of the variable with the given key for the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists or if no value was previously set. -func (s Script) ScriptVar(scriptname string, varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - "varKey": varkey, - } - return s.c.Request("script/view/scriptVar/", m) -} - -// Gets the value (string representation) of a custom variable. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists or if no value was previously set. -func (s Script) ScriptCustomVar(scriptname string, varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - "varKey": varkey, - } - return s.c.Request("script/view/scriptCustomVar/", m) -} - -// Gets all the variables (key/value pairs) of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. -func (s Script) ScriptVars(scriptname string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - } - return s.c.Request("script/view/scriptVars/", m) -} - -// Gets all the custom variables (key/value pairs, the value is the string representation) of a script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. -func (s Script) ScriptCustomVars(scriptname string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - } - return s.c.Request("script/view/scriptCustomVars/", m) -} - -// Enables the script with the given name -func (s Script) Enable(scriptname string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - } - return s.c.Request("script/action/enable/", m) -} - -// Disables the script with the given name -func (s Script) Disable(scriptname string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - } - return s.c.Request("script/action/disable/", m) -} - -// Loads a script into ZAP from the given local file, with the given name, type and engine, optionally with a description, and a charset name to read the script (the charset name is required if the script is not in UTF-8, for example, in ISO-8859-1). -func (s Script) Load(scriptname string, scripttype string, scriptengine string, filename string, scriptdescription string, charset string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - "scriptType": scripttype, - "scriptEngine": scriptengine, - "fileName": filename, - "scriptDescription": scriptdescription, - "charset": charset, - } - return s.c.Request("script/action/load/", m) -} - -// Removes the script with the given name -func (s Script) Remove(scriptname string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - } - return s.c.Request("script/action/remove/", m) -} - -// Runs the stand alone script with the given name -func (s Script) RunStandAloneScript(scriptname string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - } - return s.c.Request("script/action/runStandAloneScript/", m) -} - -// Clears the global variable with the given key. -func (s Script) ClearGlobalVar(varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "varKey": varkey, - } - return s.c.Request("script/action/clearGlobalVar/", m) -} - -// Clears a global custom variable. -func (s Script) ClearGlobalCustomVar(varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "varKey": varkey, - } - return s.c.Request("script/action/clearGlobalCustomVar/", m) -} - -// Clears the global variables. -func (s Script) ClearGlobalVars() (map[string]interface{}, error) { - return s.c.Request("script/action/clearGlobalVars/", nil) -} - -// Clears the variable with the given key of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. -func (s Script) ClearScriptVar(scriptname string, varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - "varKey": varkey, - } - return s.c.Request("script/action/clearScriptVar/", m) -} - -// Clears a script custom variable. -func (s Script) ClearScriptCustomVar(scriptname string, varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - "varKey": varkey, - } - return s.c.Request("script/action/clearScriptCustomVar/", m) -} - -// Clears the variables of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. -func (s Script) ClearScriptVars(scriptname string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - } - return s.c.Request("script/action/clearScriptVars/", m) -} - -// Sets the value of the variable with the given key of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. -func (s Script) SetScriptVar(scriptname string, varkey string, varvalue string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - "varKey": varkey, - "varValue": varvalue, - } - return s.c.Request("script/action/setScriptVar/", m) -} - -// Sets the value of the global variable with the given key. -func (s Script) SetGlobalVar(varkey string, varvalue string) (map[string]interface{}, error) { - m := map[string]string{ - "varKey": varkey, - "varValue": varvalue, - } - return s.c.Request("script/action/setGlobalVar/", m) -} diff --git a/zap/search_generated.go b/zap/search_generated.go deleted file mode 100644 index 6e3e0ba..0000000 --- a/zap/search_generated.go +++ /dev/null @@ -1,158 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Search struct { - c *Client -} - -// Returns the URLs of the HTTP messages that match the given regular expression in the URL optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) UrlsByUrlRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/urlsByUrlRegex/", m) -} - -// 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. -func (s Search) UrlsByRequestRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/urlsByRequestRegex/", m) -} - -// Returns the URLs of the HTTP messages that match the given regular expression in the response optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) UrlsByResponseRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/urlsByResponseRegex/", m) -} - -// Returns the URLs of the HTTP messages that match the given regular expression in the header(s) optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) UrlsByHeaderRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/urlsByHeaderRegex/", m) -} - -// Returns the HTTP messages that match the given regular expression in the URL optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) MessagesByUrlRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/messagesByUrlRegex/", m) -} - -// 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. -func (s Search) MessagesByRequestRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/messagesByRequestRegex/", m) -} - -// Returns the HTTP messages that match the given regular expression in the response optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) MessagesByResponseRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/messagesByResponseRegex/", m) -} - -// Returns the HTTP messages that match the given regular expression in the header(s) optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) MessagesByHeaderRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/messagesByHeaderRegex/", m) -} - -// Returns the HTTP messages, in HAR format, that match the given regular expression in the URL optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) HarByUrlRegex(regex string, baseurl string, start string, count string) ([]byte, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.RequestOther("search/other/harByUrlRegex/", m) -} - -// 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. -func (s Search) HarByRequestRegex(regex string, baseurl string, start string, count string) ([]byte, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.RequestOther("search/other/harByRequestRegex/", m) -} - -// Returns the HTTP messages, in HAR format, that match the given regular expression in the response optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) HarByResponseRegex(regex string, baseurl string, start string, count string) ([]byte, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.RequestOther("search/other/harByResponseRegex/", m) -} - -// Returns the HTTP messages, in HAR format, that match the given regular expression in the header(s) optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) HarByHeaderRegex(regex string, baseurl string, start string, count string) ([]byte, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.RequestOther("search/other/harByHeaderRegex/", m) -} diff --git a/zap/selenium_generated.go b/zap/selenium_generated.go deleted file mode 100644 index 442c80a..0000000 --- a/zap/selenium_generated.go +++ /dev/null @@ -1,125 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Selenium struct { - c *Client -} - -// This component is optional and therefore the API will only work if it is installed -func (s Selenium) OptionBrowserExtensions() (map[string]interface{}, error) { - return s.c.Request("selenium/view/optionBrowserExtensions/", nil) -} - -// Returns the current path to ChromeDriver -// -// This component is optional and therefore the API will only work if it is installed -func (s Selenium) OptionChromeDriverPath() (map[string]interface{}, error) { - return s.c.Request("selenium/view/optionChromeDriverPath/", nil) -} - -// Returns the current path to Firefox binary -// -// This component is optional and therefore the API will only work if it is installed -func (s Selenium) OptionFirefoxBinaryPath() (map[string]interface{}, error) { - return s.c.Request("selenium/view/optionFirefoxBinaryPath/", nil) -} - -// Returns the current path to Firefox driver (geckodriver) -// -// This component is optional and therefore the API will only work if it is installed -func (s Selenium) OptionFirefoxDriverPath() (map[string]interface{}, error) { - return s.c.Request("selenium/view/optionFirefoxDriverPath/", nil) -} - -// This component is optional and therefore the API will only work if it is installed -func (s Selenium) OptionIeDriverPath() (map[string]interface{}, error) { - return s.c.Request("selenium/view/optionIeDriverPath/", nil) -} - -// This component is optional and therefore the API will only work if it is installed -func (s Selenium) OptionLastDirectory() (map[string]interface{}, error) { - return s.c.Request("selenium/view/optionLastDirectory/", nil) -} - -// Returns the current path to PhantomJS binary -// -// This component is optional and therefore the API will only work if it is installed -func (s Selenium) OptionPhantomJsBinaryPath() (map[string]interface{}, error) { - return s.c.Request("selenium/view/optionPhantomJsBinaryPath/", nil) -} - -// Sets the current path to ChromeDriver -// -// This component is optional and therefore the API will only work if it is installed -func (s Selenium) SetOptionChromeDriverPath(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return s.c.Request("selenium/action/setOptionChromeDriverPath/", m) -} - -// Sets the current path to Firefox binary -// -// This component is optional and therefore the API will only work if it is installed -func (s Selenium) SetOptionFirefoxBinaryPath(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return s.c.Request("selenium/action/setOptionFirefoxBinaryPath/", m) -} - -// Sets the current path to Firefox driver (geckodriver) -// -// This component is optional and therefore the API will only work if it is installed -func (s Selenium) SetOptionFirefoxDriverPath(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return s.c.Request("selenium/action/setOptionFirefoxDriverPath/", m) -} - -// This component is optional and therefore the API will only work if it is installed -func (s Selenium) SetOptionIeDriverPath(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return s.c.Request("selenium/action/setOptionIeDriverPath/", m) -} - -// This component is optional and therefore the API will only work if it is installed -func (s Selenium) SetOptionLastDirectory(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return s.c.Request("selenium/action/setOptionLastDirectory/", m) -} - -// Sets the current path to PhantomJS binary -// -// This component is optional and therefore the API will only work if it is installed -func (s Selenium) SetOptionPhantomJsBinaryPath(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return s.c.Request("selenium/action/setOptionPhantomJsBinaryPath/", m) -} diff --git a/zap/session-management_generated.go b/zap/session-management_generated.go deleted file mode 100644 index 448f158..0000000 --- a/zap/session-management_generated.go +++ /dev/null @@ -1,57 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type SessionManagement struct { - c *Client -} - -// Gets the name of the session management methods. -func (s SessionManagement) GetSupportedSessionManagementMethods() (map[string]interface{}, error) { - return s.c.Request("sessionManagement/view/getSupportedSessionManagementMethods/", nil) -} - -// Gets the configuration parameters for the session management method with the given name. -func (s SessionManagement) GetSessionManagementMethodConfigParams(methodname string) (map[string]interface{}, error) { - m := map[string]string{ - "methodName": methodname, - } - return s.c.Request("sessionManagement/view/getSessionManagementMethodConfigParams/", m) -} - -// Gets the name of the session management method for the context with the given ID. -func (s SessionManagement) GetSessionManagementMethod(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return s.c.Request("sessionManagement/view/getSessionManagementMethod/", m) -} - -// Sets the session management method for the context with the given ID. -func (s SessionManagement) SetSessionManagementMethod(contextid string, methodname string, methodconfigparams string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "methodName": methodname, - "methodConfigParams": methodconfigparams, - } - return s.c.Request("sessionManagement/action/setSessionManagementMethod/", m) -} diff --git a/zap/soap_generated.go b/zap/soap_generated.go deleted file mode 100644 index 0798bea..0000000 --- a/zap/soap_generated.go +++ /dev/null @@ -1,46 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Soap struct { - c *Client -} - -// Import a WSDL definition from local file. -// -// This component is optional and therefore the API will only work if it is installed -func (s Soap) ImportFile(file string) (map[string]interface{}, error) { - m := map[string]string{ - "file": file, - } - return s.c.Request("soap/action/importFile/", m) -} - -// Import a WSDL definition from a URL. -// -// This component is optional and therefore the API will only work if it is installed -func (s Soap) ImportUrl(url string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - } - return s.c.Request("soap/action/importUrl/", m) -} diff --git a/zap/spider_generated.go b/zap/spider_generated.go deleted file mode 100644 index 21672fa..0000000 --- a/zap/spider_generated.go +++ /dev/null @@ -1,464 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -import "strconv" - -type Spider struct { - c *Client -} - -func (s Spider) Status(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return s.c.Request("spider/view/status/", m) -} - -func (s Spider) Results(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return s.c.Request("spider/view/results/", m) -} - -func (s Spider) FullResults(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return s.c.Request("spider/view/fullResults/", m) -} - -func (s Spider) Scans() (map[string]interface{}, error) { - return s.c.Request("spider/view/scans/", nil) -} - -// Gets the regexes of URLs excluded from the spider scans. -func (s Spider) ExcludedFromScan() (map[string]interface{}, error) { - return s.c.Request("spider/view/excludedFromScan/", nil) -} - -// Returns a list of unique URLs from the history table based on HTTP messages added by the Spider. -func (s Spider) AllUrls() (map[string]interface{}, error) { - return s.c.Request("spider/view/allUrls/", nil) -} - -// Returns a list of the names of the nodes added to the Sites tree by the specified scan. -func (s Spider) AddedNodes(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return s.c.Request("spider/view/addedNodes/", m) -} - -// Gets all the domains that are always in scope. For each domain the following are shown: the index, the value (domain), if enabled, and if specified as a regex. -func (s Spider) DomainsAlwaysInScope() (map[string]interface{}, error) { - return s.c.Request("spider/view/domainsAlwaysInScope/", nil) -} - -// Use view domainsAlwaysInScope instead. -func (s Spider) OptionDomainsAlwaysInScope() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionDomainsAlwaysInScope/", nil) -} - -// Use view domainsAlwaysInScope instead. -func (s Spider) OptionDomainsAlwaysInScopeEnabled() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionDomainsAlwaysInScopeEnabled/", nil) -} - -func (s Spider) OptionHandleParameters() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionHandleParameters/", nil) -} - -// Gets the maximum number of child nodes (per node) that can be crawled, 0 means no limit. -func (s Spider) OptionMaxChildren() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionMaxChildren/", nil) -} - -// Gets the maximum depth the spider can crawl, 0 if unlimited. -func (s Spider) OptionMaxDepth() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionMaxDepth/", nil) -} - -func (s Spider) OptionMaxDuration() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionMaxDuration/", nil) -} - -// Gets the maximum size, in bytes, that a response might have to be parsed. -func (s Spider) OptionMaxParseSizeBytes() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionMaxParseSizeBytes/", nil) -} - -func (s Spider) OptionMaxScansInUI() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionMaxScansInUI/", nil) -} - -func (s Spider) OptionRequestWaitTime() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionRequestWaitTime/", nil) -} - -func (s Spider) OptionScope() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionScope/", nil) -} - -func (s Spider) OptionScopeText() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionScopeText/", nil) -} - -func (s Spider) OptionSkipURLString() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionSkipURLString/", nil) -} - -func (s Spider) OptionThreadCount() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionThreadCount/", nil) -} - -func (s Spider) OptionUserAgent() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionUserAgent/", nil) -} - -// Gets whether or not a spider process should accept cookies while spidering. -func (s Spider) OptionAcceptCookies() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionAcceptCookies/", nil) -} - -func (s Spider) OptionHandleODataParametersVisited() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionHandleODataParametersVisited/", nil) -} - -func (s Spider) OptionParseComments() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionParseComments/", nil) -} - -func (s Spider) OptionParseGit() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionParseGit/", nil) -} - -func (s Spider) OptionParseRobotsTxt() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionParseRobotsTxt/", nil) -} - -func (s Spider) OptionParseSVNEntries() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionParseSVNEntries/", nil) -} - -func (s Spider) OptionParseSitemapXml() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionParseSitemapXml/", nil) -} - -func (s Spider) OptionPostForm() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionPostForm/", nil) -} - -func (s Spider) OptionProcessForm() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionProcessForm/", nil) -} - -// Gets whether or not the 'Referer' header should be sent while spidering. -func (s Spider) OptionSendRefererHeader() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionSendRefererHeader/", nil) -} - -func (s Spider) OptionShowAdvancedDialog() (map[string]interface{}, error) { - return s.c.Request("spider/view/optionShowAdvancedDialog/", nil) -} - -// Runs the spider against the given URL (or context). Optionally, the 'maxChildren' parameter can be set to limit the number of children scanned, the 'recurse' parameter can be used to prevent the spider from seeding recursively, the parameter 'contextName' can be used to constrain the scan to a Context and the parameter 'subtreeOnly' allows to restrict the spider under a site's subtree (using the specified 'url'). -func (s Spider) Scan(url string, maxchildren string, recurse string, contextname string, subtreeonly string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - "maxChildren": maxchildren, - "recurse": recurse, - "contextName": contextname, - "subtreeOnly": subtreeonly, - } - return s.c.Request("spider/action/scan/", m) -} - -// Runs the spider from the perspective of a User, obtained using the given Context ID and User ID. See 'scan' action for more details. -func (s Spider) ScanAsUser(contextid string, userid string, url string, maxchildren string, recurse string, subtreeonly string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - "url": url, - "maxChildren": maxchildren, - "recurse": recurse, - "subtreeOnly": subtreeonly, - } - return s.c.Request("spider/action/scanAsUser/", m) -} - -func (s Spider) Pause(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return s.c.Request("spider/action/pause/", m) -} - -func (s Spider) Resume(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return s.c.Request("spider/action/resume/", m) -} - -func (s Spider) Stop(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return s.c.Request("spider/action/stop/", m) -} - -func (s Spider) RemoveScan(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return s.c.Request("spider/action/removeScan/", m) -} - -func (s Spider) PauseAllScans() (map[string]interface{}, error) { - return s.c.Request("spider/action/pauseAllScans/", nil) -} - -func (s Spider) ResumeAllScans() (map[string]interface{}, error) { - return s.c.Request("spider/action/resumeAllScans/", nil) -} - -func (s Spider) StopAllScans() (map[string]interface{}, error) { - return s.c.Request("spider/action/stopAllScans/", nil) -} - -func (s Spider) RemoveAllScans() (map[string]interface{}, error) { - return s.c.Request("spider/action/removeAllScans/", nil) -} - -// Clears the regexes of URLs excluded from the spider scans. -func (s Spider) ClearExcludedFromScan() (map[string]interface{}, error) { - return s.c.Request("spider/action/clearExcludedFromScan/", nil) -} - -// Adds a regex of URLs that should be excluded from the spider scans. -func (s Spider) ExcludeFromScan(regex string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - } - return s.c.Request("spider/action/excludeFromScan/", m) -} - -// Adds a new domain that's always in scope, using the specified value. Optionally sets if the new entry is enabled (default, true) and whether or not the new value is specified as a regex (default, false). -func (s Spider) AddDomainAlwaysInScope(value string, isregex string, isenabled string) (map[string]interface{}, error) { - m := map[string]string{ - "value": value, - "isRegex": isregex, - "isEnabled": isenabled, - } - return s.c.Request("spider/action/addDomainAlwaysInScope/", m) -} - -// Modifies a domain that's always in scope. Allows to modify the value, if enabled or if a regex. The domain is selected with its index, which can be obtained with the view domainsAlwaysInScope. -func (s Spider) ModifyDomainAlwaysInScope(idx string, value string, isregex string, isenabled string) (map[string]interface{}, error) { - m := map[string]string{ - "idx": idx, - "value": value, - "isRegex": isregex, - "isEnabled": isenabled, - } - return s.c.Request("spider/action/modifyDomainAlwaysInScope/", m) -} - -// Removes a domain that's always in scope, with the given index. The index can be obtained with the view domainsAlwaysInScope. -func (s Spider) RemoveDomainAlwaysInScope(idx string) (map[string]interface{}, error) { - m := map[string]string{ - "idx": idx, - } - return s.c.Request("spider/action/removeDomainAlwaysInScope/", m) -} - -// Enables all domains that are always in scope. -func (s Spider) EnableAllDomainsAlwaysInScope() (map[string]interface{}, error) { - return s.c.Request("spider/action/enableAllDomainsAlwaysInScope/", nil) -} - -// Disables all domains that are always in scope. -func (s Spider) DisableAllDomainsAlwaysInScope() (map[string]interface{}, error) { - return s.c.Request("spider/action/disableAllDomainsAlwaysInScope/", nil) -} - -func (s Spider) SetOptionHandleParameters(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return s.c.Request("spider/action/setOptionHandleParameters/", m) -} - -// Use actions [add|modify|remove]DomainAlwaysInScope instead. -func (s Spider) SetOptionScopeString(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return s.c.Request("spider/action/setOptionScopeString/", m) -} - -func (s Spider) SetOptionSkipURLString(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return s.c.Request("spider/action/setOptionSkipURLString/", m) -} - -func (s Spider) SetOptionUserAgent(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return s.c.Request("spider/action/setOptionUserAgent/", m) -} - -// Sets whether or not a spider process should accept cookies while spidering. -func (s Spider) SetOptionAcceptCookies(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return s.c.Request("spider/action/setOptionAcceptCookies/", m) -} - -func (s Spider) SetOptionHandleODataParametersVisited(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return s.c.Request("spider/action/setOptionHandleODataParametersVisited/", m) -} - -// Sets the maximum number of child nodes (per node) that can be crawled, 0 means no limit. -func (s Spider) SetOptionMaxChildren(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return s.c.Request("spider/action/setOptionMaxChildren/", m) -} - -// Sets the maximum depth the spider can crawl, 0 for unlimited depth. -func (s Spider) SetOptionMaxDepth(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return s.c.Request("spider/action/setOptionMaxDepth/", m) -} - -func (s Spider) SetOptionMaxDuration(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return s.c.Request("spider/action/setOptionMaxDuration/", m) -} - -// Sets the maximum size, in bytes, that a response might have to be parsed. This allows the spider to skip big responses/files. -func (s Spider) SetOptionMaxParseSizeBytes(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return s.c.Request("spider/action/setOptionMaxParseSizeBytes/", m) -} - -func (s Spider) SetOptionMaxScansInUI(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return s.c.Request("spider/action/setOptionMaxScansInUI/", m) -} - -func (s Spider) SetOptionParseComments(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return s.c.Request("spider/action/setOptionParseComments/", m) -} - -func (s Spider) SetOptionParseGit(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return s.c.Request("spider/action/setOptionParseGit/", m) -} - -func (s Spider) SetOptionParseRobotsTxt(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return s.c.Request("spider/action/setOptionParseRobotsTxt/", m) -} - -func (s Spider) SetOptionParseSVNEntries(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return s.c.Request("spider/action/setOptionParseSVNEntries/", m) -} - -func (s Spider) SetOptionParseSitemapXml(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return s.c.Request("spider/action/setOptionParseSitemapXml/", m) -} - -func (s Spider) SetOptionPostForm(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return s.c.Request("spider/action/setOptionPostForm/", m) -} - -func (s Spider) SetOptionProcessForm(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return s.c.Request("spider/action/setOptionProcessForm/", m) -} - -func (s Spider) SetOptionRequestWaitTime(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return s.c.Request("spider/action/setOptionRequestWaitTime/", m) -} - -// Sets whether or not the 'Referer' header should be sent while spidering. -func (s Spider) SetOptionSendRefererHeader(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return s.c.Request("spider/action/setOptionSendRefererHeader/", m) -} - -func (s Spider) SetOptionShowAdvancedDialog(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return s.c.Request("spider/action/setOptionShowAdvancedDialog/", m) -} - -func (s Spider) SetOptionThreadCount(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return s.c.Request("spider/action/setOptionThreadCount/", m) -} diff --git a/zap/stats_generated.go b/zap/stats_generated.go deleted file mode 100644 index 7de9507..0000000 --- a/zap/stats_generated.go +++ /dev/null @@ -1,118 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -import "strconv" - -type Stats struct { - c *Client -} - -// Statistics -func (s Stats) Stats(keyprefix string) (map[string]interface{}, error) { - m := map[string]string{ - "keyPrefix": keyprefix, - } - return s.c.Request("stats/view/stats/", m) -} - -// Gets all of the site based statistics, optionally filtered by a key prefix -func (s Stats) AllSitesStats(keyprefix string) (map[string]interface{}, error) { - m := map[string]string{ - "keyPrefix": keyprefix, - } - return s.c.Request("stats/view/allSitesStats/", m) -} - -// Gets all of the global statistics, optionally filtered by a key prefix -func (s Stats) SiteStats(site string, keyprefix string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "keyPrefix": keyprefix, - } - return s.c.Request("stats/view/siteStats/", m) -} - -// Gets the Statsd service hostname -func (s Stats) OptionStatsdHost() (map[string]interface{}, error) { - return s.c.Request("stats/view/optionStatsdHost/", nil) -} - -// Gets the Statsd service port -func (s Stats) OptionStatsdPort() (map[string]interface{}, error) { - return s.c.Request("stats/view/optionStatsdPort/", nil) -} - -// Gets the prefix to be applied to all stats sent to the configured Statsd service -func (s Stats) OptionStatsdPrefix() (map[string]interface{}, error) { - return s.c.Request("stats/view/optionStatsdPrefix/", nil) -} - -// Returns 'true' if in memory statistics are enabled, otherwise returns 'false' -func (s Stats) OptionInMemoryEnabled() (map[string]interface{}, error) { - return s.c.Request("stats/view/optionInMemoryEnabled/", nil) -} - -// Returns 'true' if a Statsd server has been correctly configured, otherwise returns 'false' -func (s Stats) OptionStatsdEnabled() (map[string]interface{}, error) { - return s.c.Request("stats/view/optionStatsdEnabled/", nil) -} - -// Clears all of the statistics -func (s Stats) ClearStats(keyprefix string) (map[string]interface{}, error) { - m := map[string]string{ - "keyPrefix": keyprefix, - } - return s.c.Request("stats/action/clearStats/", m) -} - -// Sets the Statsd service hostname, supply an empty string to stop using a Statsd service -func (s Stats) SetOptionStatsdHost(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return s.c.Request("stats/action/setOptionStatsdHost/", m) -} - -// Sets the prefix to be applied to all stats sent to the configured Statsd service -func (s Stats) SetOptionStatsdPrefix(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return s.c.Request("stats/action/setOptionStatsdPrefix/", m) -} - -// Sets whether in memory statistics are enabled -func (s Stats) SetOptionInMemoryEnabled(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return s.c.Request("stats/action/setOptionInMemoryEnabled/", m) -} - -// Sets the Statsd service port -func (s Stats) SetOptionStatsdPort(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return s.c.Request("stats/action/setOptionStatsdPort/", m) -} diff --git a/zap/users_generated.go b/zap/users_generated.go deleted file mode 100644 index 141cf5d..0000000 --- a/zap/users_generated.go +++ /dev/null @@ -1,170 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2022 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Users struct { - c *Client -} - -// Gets a list of users that belong to the context with the given ID, or all users if none provided. -func (u Users) UsersList(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return u.c.Request("users/view/usersList/", m) -} - -// Gets the data of the user with the given ID that belongs to the context with the given ID. -func (u Users) GetUserById(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return u.c.Request("users/view/getUserById/", m) -} - -// Gets the configuration parameters for the credentials of the context with the given ID. -func (u Users) GetAuthenticationCredentialsConfigParams(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return u.c.Request("users/view/getAuthenticationCredentialsConfigParams/", m) -} - -// Gets the authentication credentials of the user with given ID that belongs to the context with the given ID. -func (u Users) GetAuthenticationCredentials(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return u.c.Request("users/view/getAuthenticationCredentials/", m) -} - -// Gets the authentication state information for the user identified by the Context and User Ids. -func (u Users) GetAuthenticationState(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return u.c.Request("users/view/getAuthenticationState/", m) -} - -// Gets the authentication session information for the user identified by the Context and User Ids, e.g. cookies and realm credentials. -func (u Users) GetAuthenticationSession(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return u.c.Request("users/view/getAuthenticationSession/", m) -} - -// Creates a new user with the given name for the context with the given ID. -func (u Users) NewUser(contextid string, name string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "name": name, - } - return u.c.Request("users/action/newUser/", m) -} - -// Removes the user with the given ID that belongs to the context with the given ID. -func (u Users) RemoveUser(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return u.c.Request("users/action/removeUser/", m) -} - -// Sets whether or not the user, with the given ID that belongs to the context with the given ID, should be enabled. -func (u Users) SetUserEnabled(contextid string, userid string, enabled string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - "enabled": enabled, - } - return u.c.Request("users/action/setUserEnabled/", m) -} - -// Renames the user with the given ID that belongs to the context with the given ID. -func (u Users) SetUserName(contextid string, userid string, name string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - "name": name, - } - return u.c.Request("users/action/setUserName/", m) -} - -// Sets the authentication credentials for the user with the given ID that belongs to the context with the given ID. -func (u Users) SetAuthenticationCredentials(contextid string, userid string, authcredentialsconfigparams string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - "authCredentialsConfigParams": authcredentialsconfigparams, - } - return u.c.Request("users/action/setAuthenticationCredentials/", m) -} - -// Tries to authenticate as the identified user, returning the authentication request and whether it appears to have succeeded. -func (u Users) AuthenticateAsUser(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return u.c.Request("users/action/authenticateAsUser/", m) -} - -// Tries to poll as the identified user, returning the authentication request and whether it appears to have succeeded. This will only work if the polling verification strategy has been configured. -func (u Users) PollAsUser(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return u.c.Request("users/action/pollAsUser/", m) -} - -// Sets fields in the authentication state for the user identified by the Context and User Ids. -func (u Users) SetAuthenticationState(contextid string, userid string, lastpollresult string, lastpolltimeinms string, requestssincelastpoll string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - "lastPollResult": lastpollresult, - "lastPollTimeInMs": lastpolltimeinms, - "requestsSinceLastPoll": requestssincelastpoll, - } - return u.c.Request("users/action/setAuthenticationState/", m) -} - -// Sets the specified cookie for the user identified by the Context and User Ids. -func (u Users) SetCookie(contextid string, userid string, domain string, name string, value string, path string, secure string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - "domain": domain, - "name": name, - "value": value, - "path": path, - "secure": secure, - } - return u.c.Request("users/action/setCookie/", m) -} diff --git a/zap/wappalyzer_generated.go b/zap/wappalyzer_generated.go deleted file mode 100644 index 10a494d..0000000 --- a/zap/wappalyzer_generated.go +++ /dev/null @@ -1,50 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Wappalyzer struct { - c *Client -} - -// Lists all the sites recognized by the wappalyzer addon. -// -// This component is optional and therefore the API will only work if it is installed -func (w Wappalyzer) ListSites() (map[string]interface{}, error) { - return w.c.Request("wappalyzer/view/listSites/", nil) -} - -// Lists all sites and their associated applications (technologies). -// -// This component is optional and therefore the API will only work if it is installed -func (w Wappalyzer) ListAll() (map[string]interface{}, error) { - return w.c.Request("wappalyzer/view/listAll/", nil) -} - -// Lists all the applications (technologies) associated with a specific site. -// -// This component is optional and therefore the API will only work if it is installed -func (w Wappalyzer) ListSite(site string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - } - return w.c.Request("wappalyzer/view/listSite/", m) -} diff --git a/zap/websocket_generated.go b/zap/websocket_generated.go deleted file mode 100644 index fbffb34..0000000 --- a/zap/websocket_generated.go +++ /dev/null @@ -1,87 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Websocket struct { - c *Client -} - -// Returns all of the registered web socket channels -// -// This component is optional and therefore the API will only work if it is installed -func (w Websocket) Channels() (map[string]interface{}, error) { - return w.c.Request("websocket/view/channels/", nil) -} - -// Returns full details of the message specified by the channelId and messageId -// -// This component is optional and therefore the API will only work if it is installed -func (w Websocket) Message(channelid string, messageid string) (map[string]interface{}, error) { - m := map[string]string{ - "channelId": channelid, - "messageId": messageid, - } - return w.c.Request("websocket/view/message/", m) -} - -// Returns a list of all of the messages that meet the given criteria (all optional), where channelId is a channel identifier, start is the offset to start returning messages from (starting from 0), count is the number of messages to return (default no limit) and payloadPreviewLength is the maximum number bytes to return for the payload contents -// -// This component is optional and therefore the API will only work if it is installed -func (w Websocket) Messages(channelid string, start string, count string, payloadpreviewlength string) (map[string]interface{}, error) { - m := map[string]string{ - "channelId": channelid, - "start": start, - "count": count, - "payloadPreviewLength": payloadpreviewlength, - } - return w.c.Request("websocket/view/messages/", m) -} - -// Returns a text representation of an intercepted websockets message -// -// This component is optional and therefore the API will only work if it is installed -func (w Websocket) BreakTextMessage() (map[string]interface{}, error) { - return w.c.Request("websocket/view/breakTextMessage/", nil) -} - -// Sends the specified message on the channel specified by channelId, if outgoing is 'True' then the message will be sent to the server and if it is 'False' then it will be sent to the client -// -// This component is optional and therefore the API will only work if it is installed -func (w Websocket) SendTextMessage(channelid string, outgoing string, message string) (map[string]interface{}, error) { - m := map[string]string{ - "channelId": channelid, - "outgoing": outgoing, - "message": message, - } - return w.c.Request("websocket/action/sendTextMessage/", m) -} - -// Sets the text message for an intercepted websockets message -// -// This component is optional and therefore the API will only work if it is installed -func (w Websocket) SetBreakTextMessage(message string, outgoing string) (map[string]interface{}, error) { - m := map[string]string{ - "message": message, - "outgoing": outgoing, - } - return w.c.Request("websocket/action/setBreakTextMessage/", m) -} From 79f4a7149d8dcfc628f48410cf65ec3551b75afc Mon Sep 17 00:00:00 2001 From: Alessio Dalla Piazza Date: Tue, 2 Jul 2024 12:02:24 +0200 Subject: [PATCH 07/14] add new api generated Signed-off-by: Alessio Dalla Piazza --- .idea/.gitignore | 8 + zap-api-go/zap/acsrf_generated.go | 71 ++ zap-api-go/zap/alert_generated.go | 162 +++++ zap-api-go/zap/ascan_generated.go | 617 ++++++++++++++++ zap-api-go/zap/authentication_generated.go | 91 +++ zap-api-go/zap/authorization_generated.go | 46 ++ zap-api-go/zap/autoupdate_generated.go | 199 ++++++ zap-api-go/zap/brk_generated.go | 104 +++ zap-api-go/zap/context_generated.go | 202 ++++++ zap-api-go/zap/core_generated.go | 672 ++++++++++++++++++ zap-api-go/zap/forced-user_generated.go | 58 ++ zap-api-go/zap/http-sessions_generated.go | 161 +++++ zap-api-go/zap/params_generated.go | 34 + zap-api-go/zap/pscan_generated.go | 130 ++++ zap-api-go/zap/rule-config_generated.go | 61 ++ zap-api-go/zap/script_generated.go | 212 ++++++ zap-api-go/zap/search_generated.go | 191 +++++ .../zap/session-management_generated.go | 57 ++ zap-api-go/zap/stats_generated.go | 118 +++ zap-api-go/zap/users_generated.go | 170 +++++ 20 files changed, 3364 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 zap-api-go/zap/acsrf_generated.go create mode 100644 zap-api-go/zap/alert_generated.go create mode 100644 zap-api-go/zap/ascan_generated.go create mode 100644 zap-api-go/zap/authentication_generated.go create mode 100644 zap-api-go/zap/authorization_generated.go create mode 100644 zap-api-go/zap/autoupdate_generated.go create mode 100644 zap-api-go/zap/brk_generated.go create mode 100644 zap-api-go/zap/context_generated.go create mode 100644 zap-api-go/zap/core_generated.go create mode 100644 zap-api-go/zap/forced-user_generated.go create mode 100644 zap-api-go/zap/http-sessions_generated.go create mode 100644 zap-api-go/zap/params_generated.go create mode 100644 zap-api-go/zap/pscan_generated.go create mode 100644 zap-api-go/zap/rule-config_generated.go create mode 100644 zap-api-go/zap/script_generated.go create mode 100644 zap-api-go/zap/search_generated.go create mode 100644 zap-api-go/zap/session-management_generated.go create mode 100644 zap-api-go/zap/stats_generated.go create mode 100644 zap-api-go/zap/users_generated.go diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/zap-api-go/zap/acsrf_generated.go b/zap-api-go/zap/acsrf_generated.go new file mode 100644 index 0000000..1174ea1 --- /dev/null +++ b/zap-api-go/zap/acsrf_generated.go @@ -0,0 +1,71 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +import "strconv" + +type Acsrf struct { + c *Client +} + +// Lists the names of all anti-CSRF tokens +func (a Acsrf) OptionTokensNames() (map[string]interface{}, error) { + return a.c.Request("acsrf/view/optionTokensNames/", nil) +} + +// Define if ZAP should detect CSRF tokens by searching for partial matches +func (a Acsrf) OptionPartialMatchingEnabled() (map[string]interface{}, error) { + return a.c.Request("acsrf/view/optionPartialMatchingEnabled/", nil) +} + +// Adds an anti-CSRF token with the given name, enabled by default +func (a Acsrf) AddOptionToken(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return a.c.Request("acsrf/action/addOptionToken/", m) +} + +// Removes the anti-CSRF token with the given name +func (a Acsrf) RemoveOptionToken(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return a.c.Request("acsrf/action/removeOptionToken/", m) +} + +// Define if ZAP should detect CSRF tokens by searching for partial matches. +func (a Acsrf) SetOptionPartialMatchingEnabled(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("acsrf/action/setOptionPartialMatchingEnabled/", m) +} + +// Generate a form for testing lack of anti-CSRF tokens - typically invoked via ZAP +func (a Acsrf) GenForm(hrefid string, actionurl string) ([]byte, error) { + m := map[string]string{ + "hrefId": hrefid, + "actionUrl": actionurl, + } + return a.c.RequestOther("acsrf/other/genForm/", m) +} diff --git a/zap-api-go/zap/alert_generated.go b/zap-api-go/zap/alert_generated.go new file mode 100644 index 0000000..528e8fe --- /dev/null +++ b/zap-api-go/zap/alert_generated.go @@ -0,0 +1,162 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Alert struct { + c *Client +} + +// Gets the alert with the given ID, the corresponding HTTP message can be obtained with the 'messageId' field and 'message' API method +func (a Alert) Alert(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return a.c.Request("alert/view/alert/", m) +} + +// Gets the alerts raised by ZAP, optionally filtering by URL or riskId, and paginating with 'start' position and 'count' of alerts +func (a Alert) Alerts(baseurl string, start string, count string, riskid string, contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + "start": start, + "count": count, + "riskId": riskid, + "contextName": contextname, + } + return a.c.Request("alert/view/alerts/", m) +} + +// Gets number of alerts grouped by each risk level, optionally filtering by URL +func (a Alert) AlertsSummary(baseurl string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + } + return a.c.Request("alert/view/alertsSummary/", m) +} + +// Gets the number of alerts, optionally filtering by URL or riskId +func (a Alert) NumberOfAlerts(baseurl string, riskid string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + "riskId": riskid, + } + return a.c.Request("alert/view/numberOfAlerts/", m) +} + +// Gets a summary of the alerts, optionally filtered by a 'url'. If 'recurse' is true then all alerts that apply to urls that start with the specified 'url' will be returned, otherwise only those on exactly the same 'url' (ignoring url parameters) +func (a Alert) AlertsByRisk(url string, recurse string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "recurse": recurse, + } + return a.c.Request("alert/view/alertsByRisk/", m) +} + +// Gets a count of the alerts, optionally filtered as per alertsPerRisk +func (a Alert) AlertCountsByRisk(url string, recurse string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "recurse": recurse, + } + return a.c.Request("alert/view/alertCountsByRisk/", m) +} + +// Deletes all alerts of the current session. +func (a Alert) DeleteAllAlerts() (map[string]interface{}, error) { + return a.c.Request("alert/action/deleteAllAlerts/", nil) +} + +// Deletes all the alerts optionally filtered by URL which fall within the Context with the provided name, risk, or base URL. +func (a Alert) DeleteAlerts(contextname string, baseurl string, riskid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "baseurl": baseurl, + "riskId": riskid, + } + return a.c.Request("alert/action/deleteAlerts/", m) +} + +// Deletes the alert with the given ID. +func (a Alert) DeleteAlert(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return a.c.Request("alert/action/deleteAlert/", m) +} + +// Update the confidence of the alerts. +func (a Alert) UpdateAlertsConfidence(ids string, confidenceid string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + "confidenceId": confidenceid, + } + return a.c.Request("alert/action/updateAlertsConfidence/", m) +} + +// Update the risk of the alerts. +func (a Alert) UpdateAlertsRisk(ids string, riskid string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + "riskId": riskid, + } + return a.c.Request("alert/action/updateAlertsRisk/", m) +} + +// Update the alert with the given ID, with the provided details. +func (a Alert) UpdateAlert(id string, name string, riskid string, confidenceid string, description string, param string, attack string, otherinfo string, solution string, references string, evidence string, cweid string, wascid string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + "name": name, + "riskId": riskid, + "confidenceId": confidenceid, + "description": description, + "param": param, + "attack": attack, + "otherInfo": otherinfo, + "solution": solution, + "references": references, + "evidence": evidence, + "cweId": cweid, + "wascId": wascid, + } + return a.c.Request("alert/action/updateAlert/", m) +} + +// Add an alert associated with the given message ID, with the provided details. (The ID of the created alert is returned.) +func (a Alert) AddAlert(messageid string, name string, riskid string, confidenceid string, description string, param string, attack string, otherinfo string, solution string, references string, evidence string, cweid string, wascid string) (map[string]interface{}, error) { + m := map[string]string{ + "messageId": messageid, + "name": name, + "riskId": riskid, + "confidenceId": confidenceid, + "description": description, + "param": param, + "attack": attack, + "otherInfo": otherinfo, + "solution": solution, + "references": references, + "evidence": evidence, + "cweId": cweid, + "wascId": wascid, + } + return a.c.Request("alert/action/addAlert/", m) +} diff --git a/zap-api-go/zap/ascan_generated.go b/zap-api-go/zap/ascan_generated.go new file mode 100644 index 0000000..4ca7b60 --- /dev/null +++ b/zap-api-go/zap/ascan_generated.go @@ -0,0 +1,617 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +import "strconv" + +type Ascan struct { + c *Client +} + +func (a Ascan) Status(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/view/status/", m) +} + +func (a Ascan) ScanProgress(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/view/scanProgress/", m) +} + +// Gets the IDs of the messages sent during the scan with the given ID. A message can be obtained with 'message' core view. +func (a Ascan) MessagesIds(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/view/messagesIds/", m) +} + +// Gets the IDs of the alerts raised during the scan with the given ID. An alert can be obtained with 'alert' core view. +func (a Ascan) AlertsIds(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/view/alertsIds/", m) +} + +func (a Ascan) Scans() (map[string]interface{}, error) { + return a.c.Request("ascan/view/scans/", nil) +} + +func (a Ascan) ScanPolicyNames() (map[string]interface{}, error) { + return a.c.Request("ascan/view/scanPolicyNames/", nil) +} + +// Gets the regexes of URLs excluded from the active scans. +func (a Ascan) ExcludedFromScan() (map[string]interface{}, error) { + return a.c.Request("ascan/view/excludedFromScan/", nil) +} + +// Gets the scan rules, optionally, of the given scan policy or scanner policy/category ID. +func (a Ascan) Scanners(scanpolicyname string, policyid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanPolicyName": scanpolicyname, + "policyId": policyid, + } + return a.c.Request("ascan/view/scanners/", m) +} + +func (a Ascan) Policies(scanpolicyname string, policyid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanPolicyName": scanpolicyname, + "policyId": policyid, + } + return a.c.Request("ascan/view/policies/", m) +} + +func (a Ascan) AttackModeQueue() (map[string]interface{}, error) { + return a.c.Request("ascan/view/attackModeQueue/", nil) +} + +// Gets all the parameters that are excluded. For each parameter the following are shown: the name, the URL, and the parameter type. +func (a Ascan) ExcludedParams() (map[string]interface{}, error) { + return a.c.Request("ascan/view/excludedParams/", nil) +} + +// Use view excludedParams instead. +func (a Ascan) OptionExcludedParamList() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionExcludedParamList/", nil) +} + +// Gets all the types of excluded parameters. For each type the following are shown: the ID and the name. +func (a Ascan) ExcludedParamTypes() (map[string]interface{}, error) { + return a.c.Request("ascan/view/excludedParamTypes/", nil) +} + +func (a Ascan) OptionAttackPolicy() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionAttackPolicy/", nil) +} + +func (a Ascan) OptionDefaultPolicy() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionDefaultPolicy/", nil) +} + +func (a Ascan) OptionDelayInMs() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionDelayInMs/", nil) +} + +func (a Ascan) OptionHandleAntiCSRFTokens() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionHandleAntiCSRFTokens/", nil) +} + +func (a Ascan) OptionHostPerScan() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionHostPerScan/", nil) +} + +// Gets the maximum number of alerts that a rule can raise before being skipped. +func (a Ascan) OptionMaxAlertsPerRule() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionMaxAlertsPerRule/", nil) +} + +func (a Ascan) OptionMaxChartTimeInMins() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionMaxChartTimeInMins/", nil) +} + +func (a Ascan) OptionMaxResultsToList() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionMaxResultsToList/", nil) +} + +func (a Ascan) OptionMaxRuleDurationInMins() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionMaxRuleDurationInMins/", nil) +} + +func (a Ascan) OptionMaxScanDurationInMins() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionMaxScanDurationInMins/", nil) +} + +func (a Ascan) OptionMaxScansInUI() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionMaxScansInUI/", nil) +} + +func (a Ascan) OptionTargetParamsEnabledRPC() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionTargetParamsEnabledRPC/", nil) +} + +func (a Ascan) OptionTargetParamsInjectable() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionTargetParamsInjectable/", nil) +} + +func (a Ascan) OptionThreadPerHost() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionThreadPerHost/", nil) +} + +// Tells whether or not the active scanner should add a query parameter to GET request that don't have parameters to start with. +func (a Ascan) OptionAddQueryParam() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionAddQueryParam/", nil) +} + +func (a Ascan) OptionAllowAttackOnStart() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionAllowAttackOnStart/", nil) +} + +// Tells whether or not the active scanner should encode cookie values. +func (a Ascan) OptionEncodeCookieValues() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionEncodeCookieValues/", nil) +} + +// 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. +func (a Ascan) OptionInjectPluginIdInHeader() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionInjectPluginIdInHeader/", nil) +} + +func (a Ascan) OptionPromptInAttackMode() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionPromptInAttackMode/", nil) +} + +func (a Ascan) OptionPromptToClearFinishedScans() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionPromptToClearFinishedScans/", nil) +} + +func (a Ascan) OptionRescanInAttackMode() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionRescanInAttackMode/", nil) +} + +// Tells whether or not the HTTP Headers of all requests should be scanned. Not just requests that send parameters, through the query or request body. +func (a Ascan) OptionScanHeadersAllRequests() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionScanHeadersAllRequests/", nil) +} + +// Tells whether or not the active scanner should scan null JSON values. +func (a Ascan) OptionScanNullJsonValues() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionScanNullJsonValues/", nil) +} + +func (a Ascan) OptionShowAdvancedDialog() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionShowAdvancedDialog/", nil) +} + +// Runs the active scanner against the given URL or Context. Optionally, the 'recurse' parameter can be used to scan URLs under the given URL, the parameter 'inScopeOnly' can be used to constrain the scan to URLs that are in scope (ignored if a Context is specified), the parameter 'scanPolicyName' allows to specify the scan policy (if none is given it uses the default scan policy), the parameters 'method' and 'postData' allow to select a given request in conjunction with the given URL. +func (a Ascan) Scan(url string, recurse string, inscopeonly string, scanpolicyname string, method string, postdata string, contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "recurse": recurse, + "inScopeOnly": inscopeonly, + "scanPolicyName": scanpolicyname, + "method": method, + "postData": postdata, + "contextId": contextid, + } + return a.c.Request("ascan/action/scan/", m) +} + +// Active Scans from the perspective of a User, obtained using the given Context ID and User ID. See 'scan' action for more details. +func (a Ascan) ScanAsUser(url string, contextid string, userid string, recurse string, scanpolicyname string, method string, postdata string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "contextId": contextid, + "userId": userid, + "recurse": recurse, + "scanPolicyName": scanpolicyname, + "method": method, + "postData": postdata, + } + return a.c.Request("ascan/action/scanAsUser/", m) +} + +func (a Ascan) Pause(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/action/pause/", m) +} + +func (a Ascan) Resume(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/action/resume/", m) +} + +func (a Ascan) Stop(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/action/stop/", m) +} + +func (a Ascan) RemoveScan(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/action/removeScan/", m) +} + +func (a Ascan) PauseAllScans() (map[string]interface{}, error) { + return a.c.Request("ascan/action/pauseAllScans/", nil) +} + +func (a Ascan) ResumeAllScans() (map[string]interface{}, error) { + return a.c.Request("ascan/action/resumeAllScans/", nil) +} + +func (a Ascan) StopAllScans() (map[string]interface{}, error) { + return a.c.Request("ascan/action/stopAllScans/", nil) +} + +func (a Ascan) RemoveAllScans() (map[string]interface{}, error) { + return a.c.Request("ascan/action/removeAllScans/", nil) +} + +// Clears the regexes of URLs excluded from the active scans. +func (a Ascan) ClearExcludedFromScan() (map[string]interface{}, error) { + return a.c.Request("ascan/action/clearExcludedFromScan/", nil) +} + +// Adds a regex of URLs that should be excluded from the active scans. +func (a Ascan) ExcludeFromScan(regex string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + } + return a.c.Request("ascan/action/excludeFromScan/", m) +} + +// Enables all scan rules of the scan policy with the given name, or the default if none given. +func (a Ascan) EnableAllScanners(scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/enableAllScanners/", m) +} + +// Disables all scan rules of the scan policy with the given name, or the default if none given. +func (a Ascan) DisableAllScanners(scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/disableAllScanners/", m) +} + +// Enables the scan rules with the given IDs (comma separated list of IDs) of the scan policy with the given name, or the default if none given. +func (a Ascan) EnableScanners(ids string, scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/enableScanners/", m) +} + +// Disables the scan rules with the given IDs (comma separated list of IDs) of the scan policy with the given name, or the default if none given. +func (a Ascan) DisableScanners(ids string, scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/disableScanners/", m) +} + +func (a Ascan) SetEnabledPolicies(ids string, scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/setEnabledPolicies/", m) +} + +func (a Ascan) SetPolicyAttackStrength(id string, attackstrength string, scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + "attackStrength": attackstrength, + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/setPolicyAttackStrength/", m) +} + +func (a Ascan) SetPolicyAlertThreshold(id string, alertthreshold string, scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + "alertThreshold": alertthreshold, + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/setPolicyAlertThreshold/", m) +} + +func (a Ascan) SetScannerAttackStrength(id string, attackstrength string, scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + "attackStrength": attackstrength, + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/setScannerAttackStrength/", m) +} + +func (a Ascan) SetScannerAlertThreshold(id string, alertthreshold string, scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + "alertThreshold": alertthreshold, + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/setScannerAlertThreshold/", m) +} + +func (a Ascan) AddScanPolicy(scanpolicyname string, alertthreshold string, attackstrength string) (map[string]interface{}, error) { + m := map[string]string{ + "scanPolicyName": scanpolicyname, + "alertThreshold": alertthreshold, + "attackStrength": attackstrength, + } + return a.c.Request("ascan/action/addScanPolicy/", m) +} + +func (a Ascan) RemoveScanPolicy(scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/removeScanPolicy/", m) +} + +func (a Ascan) UpdateScanPolicy(scanpolicyname string, alertthreshold string, attackstrength string) (map[string]interface{}, error) { + m := map[string]string{ + "scanPolicyName": scanpolicyname, + "alertThreshold": alertthreshold, + "attackStrength": attackstrength, + } + return a.c.Request("ascan/action/updateScanPolicy/", m) +} + +// Imports a Scan Policy using the given file system path. +func (a Ascan) ImportScanPolicy(path string) (map[string]interface{}, error) { + m := map[string]string{ + "path": path, + } + return a.c.Request("ascan/action/importScanPolicy/", m) +} + +// Adds a new parameter excluded from the scan, using the specified name. Optionally sets if the new entry applies to a specific URL (default, all URLs) and sets the ID of the type of the parameter (default, ID of any type). The type IDs can be obtained with the view excludedParamTypes. +func (a Ascan) AddExcludedParam(name string, t string, url string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + "type": t, + "url": url, + } + return a.c.Request("ascan/action/addExcludedParam/", m) +} + +// Modifies a parameter excluded from the scan. Allows to modify the name, the URL and the type of parameter. The parameter is selected with its index, which can be obtained with the view excludedParams. +func (a Ascan) ModifyExcludedParam(idx string, name string, t string, url string) (map[string]interface{}, error) { + m := map[string]string{ + "idx": idx, + "name": name, + "type": t, + "url": url, + } + return a.c.Request("ascan/action/modifyExcludedParam/", m) +} + +// Removes a parameter excluded from the scan, with the given index. The index can be obtained with the view excludedParams. +func (a Ascan) RemoveExcludedParam(idx string) (map[string]interface{}, error) { + m := map[string]string{ + "idx": idx, + } + return a.c.Request("ascan/action/removeExcludedParam/", m) +} + +// Skips the scan rule using the given IDs of the scan and the scan rule. +func (a Ascan) SkipScanner(scanid string, scannerid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + "scannerId": scannerid, + } + return a.c.Request("ascan/action/skipScanner/", m) +} + +func (a Ascan) SetOptionAttackPolicy(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return a.c.Request("ascan/action/setOptionAttackPolicy/", m) +} + +func (a Ascan) SetOptionDefaultPolicy(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return a.c.Request("ascan/action/setOptionDefaultPolicy/", m) +} + +// Sets whether or not the active scanner should add a query param to GET requests which do not have parameters to start with. +func (a Ascan) SetOptionAddQueryParam(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionAddQueryParam/", m) +} + +func (a Ascan) SetOptionAllowAttackOnStart(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionAllowAttackOnStart/", m) +} + +func (a Ascan) SetOptionDelayInMs(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionDelayInMs/", m) +} + +// Sets whether or not the active scanner should encode cookie values. +func (a Ascan) SetOptionEncodeCookieValues(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionEncodeCookieValues/", m) +} + +func (a Ascan) SetOptionHandleAntiCSRFTokens(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionHandleAntiCSRFTokens/", m) +} + +func (a Ascan) SetOptionHostPerScan(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionHostPerScan/", m) +} + +// Sets 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. +func (a Ascan) SetOptionInjectPluginIdInHeader(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionInjectPluginIdInHeader/", m) +} + +// Sets the maximum number of alerts that a rule can raise before being skipped. +func (a Ascan) SetOptionMaxAlertsPerRule(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionMaxAlertsPerRule/", m) +} + +func (a Ascan) SetOptionMaxChartTimeInMins(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionMaxChartTimeInMins/", m) +} + +func (a Ascan) SetOptionMaxResultsToList(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionMaxResultsToList/", m) +} + +func (a Ascan) SetOptionMaxRuleDurationInMins(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionMaxRuleDurationInMins/", m) +} + +func (a Ascan) SetOptionMaxScanDurationInMins(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionMaxScanDurationInMins/", m) +} + +func (a Ascan) SetOptionMaxScansInUI(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionMaxScansInUI/", m) +} + +func (a Ascan) SetOptionPromptInAttackMode(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionPromptInAttackMode/", m) +} + +func (a Ascan) SetOptionPromptToClearFinishedScans(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionPromptToClearFinishedScans/", m) +} + +func (a Ascan) SetOptionRescanInAttackMode(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionRescanInAttackMode/", m) +} + +// Sets whether or not the HTTP Headers of all requests should be scanned. Not just requests that send parameters, through the query or request body. +func (a Ascan) SetOptionScanHeadersAllRequests(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionScanHeadersAllRequests/", m) +} + +// Sets whether or not the active scanner should scan null JSON values. +func (a Ascan) SetOptionScanNullJsonValues(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionScanNullJsonValues/", m) +} + +func (a Ascan) SetOptionShowAdvancedDialog(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionShowAdvancedDialog/", m) +} + +func (a Ascan) SetOptionTargetParamsEnabledRPC(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionTargetParamsEnabledRPC/", m) +} + +func (a Ascan) SetOptionTargetParamsInjectable(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionTargetParamsInjectable/", m) +} + +func (a Ascan) SetOptionThreadPerHost(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionThreadPerHost/", m) +} diff --git a/zap-api-go/zap/authentication_generated.go b/zap-api-go/zap/authentication_generated.go new file mode 100644 index 0000000..771edfd --- /dev/null +++ b/zap-api-go/zap/authentication_generated.go @@ -0,0 +1,91 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Authentication struct { + c *Client +} + +// Gets the name of the authentication methods. +func (a Authentication) GetSupportedAuthenticationMethods() (map[string]interface{}, error) { + return a.c.Request("authentication/view/getSupportedAuthenticationMethods/", nil) +} + +// Gets the configuration parameters for the authentication method with the given name. +func (a Authentication) GetAuthenticationMethodConfigParams(authmethodname string) (map[string]interface{}, error) { + m := map[string]string{ + "authMethodName": authmethodname, + } + return a.c.Request("authentication/view/getAuthenticationMethodConfigParams/", m) +} + +// Gets the name of the authentication method for the context with the given ID. +func (a Authentication) GetAuthenticationMethod(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return a.c.Request("authentication/view/getAuthenticationMethod/", m) +} + +// Gets the logged in indicator for the context with the given ID. +func (a Authentication) GetLoggedInIndicator(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return a.c.Request("authentication/view/getLoggedInIndicator/", m) +} + +// Gets the logged out indicator for the context with the given ID. +func (a Authentication) GetLoggedOutIndicator(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return a.c.Request("authentication/view/getLoggedOutIndicator/", m) +} + +// Sets the authentication method for the context with the given ID. +func (a Authentication) SetAuthenticationMethod(contextid string, authmethodname string, authmethodconfigparams string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "authMethodName": authmethodname, + "authMethodConfigParams": authmethodconfigparams, + } + return a.c.Request("authentication/action/setAuthenticationMethod/", m) +} + +// Sets the logged in indicator for the context with the given ID. +func (a Authentication) SetLoggedInIndicator(contextid string, loggedinindicatorregex string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "loggedInIndicatorRegex": loggedinindicatorregex, + } + return a.c.Request("authentication/action/setLoggedInIndicator/", m) +} + +// Sets the logged out indicator for the context with the given ID. +func (a Authentication) SetLoggedOutIndicator(contextid string, loggedoutindicatorregex string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "loggedOutIndicatorRegex": loggedoutindicatorregex, + } + return a.c.Request("authentication/action/setLoggedOutIndicator/", m) +} diff --git a/zap-api-go/zap/authorization_generated.go b/zap-api-go/zap/authorization_generated.go new file mode 100644 index 0000000..dbb8fd6 --- /dev/null +++ b/zap-api-go/zap/authorization_generated.go @@ -0,0 +1,46 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Authorization struct { + c *Client +} + +// Obtains all the configuration of the authorization detection method that is currently set for a context. +func (a Authorization) GetAuthorizationDetectionMethod(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return a.c.Request("authorization/view/getAuthorizationDetectionMethod/", m) +} + +// Sets the authorization detection method for a context as one that identifies un-authorized messages based on: the message's status code or a regex pattern in the response's header or body. Also, whether all conditions must match or just some can be specified via the logicalOperator parameter, which accepts two values: "AND" (default), "OR". +func (a Authorization) SetBasicAuthorizationDetectionMethod(contextid string, headerregex string, bodyregex string, statuscode string, logicaloperator string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "headerRegex": headerregex, + "bodyRegex": bodyregex, + "statusCode": statuscode, + "logicalOperator": logicaloperator, + } + return a.c.Request("authorization/action/setBasicAuthorizationDetectionMethod/", m) +} diff --git a/zap-api-go/zap/autoupdate_generated.go b/zap-api-go/zap/autoupdate_generated.go new file mode 100644 index 0000000..48e40da --- /dev/null +++ b/zap-api-go/zap/autoupdate_generated.go @@ -0,0 +1,199 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +import "strconv" + +type Autoupdate struct { + c *Client +} + +// Returns the latest version number +func (a Autoupdate) LatestVersionNumber() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/latestVersionNumber/", nil) +} + +// Returns 'true' if ZAP is on the latest version +func (a Autoupdate) IsLatestVersion() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/isLatestVersion/", nil) +} + +// Return a list of all of the installed add-ons +func (a Autoupdate) InstalledAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/installedAddons/", nil) +} + +// Returns a list with all local add-ons, installed or not. +func (a Autoupdate) LocalAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/localAddons/", nil) +} + +// Return a list of any add-ons that have been added to the Marketplace since the last check for updates +func (a Autoupdate) NewAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/newAddons/", nil) +} + +// Return a list of any add-ons that have been changed in the Marketplace since the last check for updates +func (a Autoupdate) UpdatedAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/updatedAddons/", nil) +} + +// Return a list of all of the add-ons on the ZAP Marketplace (this information is read once and then cached) +func (a Autoupdate) MarketplaceAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/marketplaceAddons/", nil) +} + +func (a Autoupdate) OptionAddonDirectories() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionAddonDirectories/", nil) +} + +func (a Autoupdate) OptionDayLastChecked() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionDayLastChecked/", nil) +} + +func (a Autoupdate) OptionDayLastInstallWarned() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionDayLastInstallWarned/", nil) +} + +func (a Autoupdate) OptionDayLastUpdateWarned() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionDayLastUpdateWarned/", nil) +} + +func (a Autoupdate) OptionDownloadDirectory() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionDownloadDirectory/", nil) +} + +func (a Autoupdate) OptionCheckAddonUpdates() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionCheckAddonUpdates/", nil) +} + +func (a Autoupdate) OptionCheckOnStart() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionCheckOnStart/", nil) +} + +func (a Autoupdate) OptionDownloadNewRelease() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionDownloadNewRelease/", nil) +} + +func (a Autoupdate) OptionInstallAddonUpdates() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionInstallAddonUpdates/", nil) +} + +func (a Autoupdate) OptionInstallScannerRules() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionInstallScannerRules/", nil) +} + +func (a Autoupdate) OptionReportAlphaAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionReportAlphaAddons/", nil) +} + +func (a Autoupdate) OptionReportBetaAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionReportBetaAddons/", nil) +} + +func (a Autoupdate) OptionReportReleaseAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionReportReleaseAddons/", nil) +} + +// Downloads the latest release, if any +func (a Autoupdate) DownloadLatestRelease() (map[string]interface{}, error) { + return a.c.Request("autoupdate/action/downloadLatestRelease/", nil) +} + +// Installs or updates the specified add-on, returning when complete (i.e. not asynchronously) +func (a Autoupdate) InstallAddon(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return a.c.Request("autoupdate/action/installAddon/", m) +} + +func (a Autoupdate) InstallLocalAddon(file string) (map[string]interface{}, error) { + m := map[string]string{ + "file": file, + } + return a.c.Request("autoupdate/action/installLocalAddon/", m) +} + +// Uninstalls the specified add-on +func (a Autoupdate) UninstallAddon(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return a.c.Request("autoupdate/action/uninstallAddon/", m) +} + +func (a Autoupdate) SetOptionCheckAddonUpdates(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionCheckAddonUpdates/", m) +} + +func (a Autoupdate) SetOptionCheckOnStart(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionCheckOnStart/", m) +} + +func (a Autoupdate) SetOptionDownloadNewRelease(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionDownloadNewRelease/", m) +} + +func (a Autoupdate) SetOptionInstallAddonUpdates(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionInstallAddonUpdates/", m) +} + +func (a Autoupdate) SetOptionInstallScannerRules(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionInstallScannerRules/", m) +} + +func (a Autoupdate) SetOptionReportAlphaAddons(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionReportAlphaAddons/", m) +} + +func (a Autoupdate) SetOptionReportBetaAddons(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionReportBetaAddons/", m) +} + +func (a Autoupdate) SetOptionReportReleaseAddons(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionReportReleaseAddons/", m) +} diff --git a/zap-api-go/zap/brk_generated.go b/zap-api-go/zap/brk_generated.go new file mode 100644 index 0000000..5dc1521 --- /dev/null +++ b/zap-api-go/zap/brk_generated.go @@ -0,0 +1,104 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Break struct { + c *Client +} + +// Returns True if ZAP will break on both requests and responses +func (b Break) IsBreakAll() (map[string]interface{}, error) { + return b.c.Request("break/view/isBreakAll/", nil) +} + +// Returns True if ZAP will break on requests +func (b Break) IsBreakRequest() (map[string]interface{}, error) { + return b.c.Request("break/view/isBreakRequest/", nil) +} + +// Returns True if ZAP will break on responses +func (b Break) IsBreakResponse() (map[string]interface{}, error) { + return b.c.Request("break/view/isBreakResponse/", nil) +} + +// Returns the HTTP message currently intercepted (if any) +func (b Break) HttpMessage() (map[string]interface{}, error) { + return b.c.Request("break/view/httpMessage/", nil) +} + +// Controls the global break functionality. The type may be one of: http-all, http-request or http-response. The state may be true (for turning break on for the specified type) or false (for turning break off). Scope is not currently used. +func (b Break) Brk(t string, state string, scope string) (map[string]interface{}, error) { + m := map[string]string{ + "type": t, + "state": state, + "scope": scope, + } + return b.c.Request("break/action/break/", m) +} + +// Overwrites the currently intercepted message with the data provided +func (b Break) SetHttpMessage(httpheader string, httpbody string) (map[string]interface{}, error) { + m := map[string]string{ + "httpHeader": httpheader, + "httpBody": httpbody, + } + return b.c.Request("break/action/setHttpMessage/", m) +} + +// Submits the currently intercepted message and unsets the global request/response breakpoints +func (b Break) Cont() (map[string]interface{}, error) { + return b.c.Request("break/action/continue/", nil) +} + +// Submits the currently intercepted message, the next request or response will automatically be intercepted +func (b Break) Step() (map[string]interface{}, error) { + return b.c.Request("break/action/step/", nil) +} + +// Drops the currently intercepted message +func (b Break) Drop() (map[string]interface{}, error) { + return b.c.Request("break/action/drop/", nil) +} + +// Adds a custom HTTP breakpoint. The string is the string to match. Location may be one of: url, request_header, request_body, response_header or response_body. Match may be: contains or regex. Inverse (match) may be true or false. Lastly, ignorecase (when matching the string) may be true or false. +func (b Break) AddHttpBreakpoint(str string, location string, match string, inverse string, ignorecase string) (map[string]interface{}, error) { + m := map[string]string{ + "string": str, + "location": location, + "match": match, + "inverse": inverse, + "ignorecase": ignorecase, + } + return b.c.Request("break/action/addHttpBreakpoint/", m) +} + +// Removes the specified breakpoint +func (b Break) RemoveHttpBreakpoint(str string, location string, match string, inverse string, ignorecase string) (map[string]interface{}, error) { + m := map[string]string{ + "string": str, + "location": location, + "match": match, + "inverse": inverse, + "ignorecase": ignorecase, + } + return b.c.Request("break/action/removeHttpBreakpoint/", m) +} diff --git a/zap-api-go/zap/context_generated.go b/zap-api-go/zap/context_generated.go new file mode 100644 index 0000000..acc5e7d --- /dev/null +++ b/zap-api-go/zap/context_generated.go @@ -0,0 +1,202 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Context struct { + c *Client +} + +// List context names of current session +func (c Context) ContextList() (map[string]interface{}, error) { + return c.c.Request("context/view/contextList/", nil) +} + +// List excluded regexs for context +func (c Context) ExcludeRegexs(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/view/excludeRegexs/", m) +} + +// List included regexs for context +func (c Context) IncludeRegexs(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/view/includeRegexs/", m) +} + +// List the information about the named context +func (c Context) Context(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/view/context/", m) +} + +// Lists the names of all built in technologies +func (c Context) TechnologyList() (map[string]interface{}, error) { + return c.c.Request("context/view/technologyList/", nil) +} + +// Lists the names of all technologies included in a context +func (c Context) IncludedTechnologyList(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/view/includedTechnologyList/", m) +} + +// Lists the names of all technologies excluded from a context +func (c Context) ExcludedTechnologyList(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/view/excludedTechnologyList/", m) +} + +// Lists the URLs accessed through/by ZAP, that belong to the context with the given name. +func (c Context) Urls(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/view/urls/", m) +} + +// Add exclude regex to context +func (c Context) ExcludeFromContext(contextname string, regex string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "regex": regex, + } + return c.c.Request("context/action/excludeFromContext/", m) +} + +// Add include regex to context +func (c Context) IncludeInContext(contextname string, regex string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "regex": regex, + } + return c.c.Request("context/action/includeInContext/", m) +} + +// Set the regexs to include and exclude for a context, both supplied as JSON string arrays +func (c Context) SetContextRegexs(contextname string, incregexs string, excregexs string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "incRegexs": incregexs, + "excRegexs": excregexs, + } + return c.c.Request("context/action/setContextRegexs/", m) +} + +// Set the checking strategy for a context - this defines how ZAP checks that a request is authenticated +func (c Context) SetContextCheckingStrategy(contextname string, checkingstrategy string, pollurl string, polldata string, pollheaders string, pollfrequency string, pollfrequencyunits string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "checkingStrategy": checkingstrategy, + "pollUrl": pollurl, + "pollData": polldata, + "pollHeaders": pollheaders, + "pollFrequency": pollfrequency, + "pollFrequencyUnits": pollfrequencyunits, + } + return c.c.Request("context/action/setContextCheckingStrategy/", m) +} + +// Creates a new context with the given name in the current session +func (c Context) NewContext(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/action/newContext/", m) +} + +// Removes a context in the current session +func (c Context) RemoveContext(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/action/removeContext/", m) +} + +// Exports the context with the given name to a file. If a relative file path is specified it will be resolved against the "contexts" directory in ZAP "home" dir. +func (c Context) ExportContext(contextname string, contextfile string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "contextFile": contextfile, + } + return c.c.Request("context/action/exportContext/", m) +} + +// Imports a context from a file. If a relative file path is specified it will be resolved against the "contexts" directory in ZAP "home" dir. +func (c Context) ImportContext(contextfile string) (map[string]interface{}, error) { + m := map[string]string{ + "contextFile": contextfile, + } + return c.c.Request("context/action/importContext/", m) +} + +// Includes technologies with the given names, separated by a comma, to a context +func (c Context) IncludeContextTechnologies(contextname string, technologynames string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "technologyNames": technologynames, + } + return c.c.Request("context/action/includeContextTechnologies/", m) +} + +// Includes all built in technologies in to a context +func (c Context) IncludeAllContextTechnologies(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/action/includeAllContextTechnologies/", m) +} + +// Excludes technologies with the given names, separated by a comma, from a context +func (c Context) ExcludeContextTechnologies(contextname string, technologynames string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "technologyNames": technologynames, + } + return c.c.Request("context/action/excludeContextTechnologies/", m) +} + +// Excludes all built in technologies from a context +func (c Context) ExcludeAllContextTechnologies(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/action/excludeAllContextTechnologies/", m) +} + +// Sets a context to in scope (contexts are in scope by default) +func (c Context) SetContextInScope(contextname string, booleaninscope string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "booleanInScope": booleaninscope, + } + return c.c.Request("context/action/setContextInScope/", m) +} diff --git a/zap-api-go/zap/core_generated.go b/zap-api-go/zap/core_generated.go new file mode 100644 index 0000000..ca7741d --- /dev/null +++ b/zap-api-go/zap/core_generated.go @@ -0,0 +1,672 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +import "strconv" + +type Core struct { + c *Client +} + +// Gets the name of the hosts accessed through/by ZAP +func (c Core) Hosts() (map[string]interface{}, error) { + return c.c.Request("core/view/hosts/", nil) +} + +// Gets the sites accessed through/by ZAP (scheme and domain) +func (c Core) Sites() (map[string]interface{}, error) { + return c.c.Request("core/view/sites/", nil) +} + +// Gets the URLs accessed through/by ZAP, optionally filtering by (base) URL. +func (c Core) Urls(baseurl string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + } + return c.c.Request("core/view/urls/", m) +} + +// Gets the child nodes underneath the specified URL in the Sites tree +func (c Core) ChildNodes(url string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + } + return c.c.Request("core/view/childNodes/", m) +} + +// Gets the HTTP message with the given ID. Returns the ID, request/response headers and bodies, cookies, note, type, RTT, and timestamp. +func (c Core) Message(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return c.c.Request("core/view/message/", m) +} + +// Gets the HTTP messages sent by ZAP, request and response, optionally filtered by URL and paginated with 'start' position and 'count' of messages +func (c Core) Messages(baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + "start": start, + "count": count, + } + return c.c.Request("core/view/messages/", m) +} + +// Gets the HTTP messages with the given IDs. +func (c Core) MessagesById(ids string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + } + return c.c.Request("core/view/messagesById/", m) +} + +// Gets the number of messages, optionally filtering by URL +func (c Core) NumberOfMessages(baseurl string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + } + return c.c.Request("core/view/numberOfMessages/", m) +} + +// Gets the mode +func (c Core) Mode() (map[string]interface{}, error) { + return c.c.Request("core/view/mode/", nil) +} + +// Gets ZAP version +func (c Core) Version() (map[string]interface{}, error) { + return c.c.Request("core/view/version/", nil) +} + +// Gets the regular expressions, applied to URLs, to exclude from the local proxies. +func (c Core) ExcludedFromProxy() (map[string]interface{}, error) { + return c.c.Request("core/view/excludedFromProxy/", nil) +} + +// Gets the location of the current session file +func (c Core) SessionLocation() (map[string]interface{}, error) { + return c.c.Request("core/view/sessionLocation/", nil) +} + +// Gets all the domains that are excluded from the outgoing proxy. For each domain the following are shown: the index, the value (domain), if enabled, and if specified as a regex. +func (c Core) ProxyChainExcludedDomains() (map[string]interface{}, error) { + return c.c.Request("core/view/proxyChainExcludedDomains/", nil) +} + +// Gets the path to ZAP's home directory. +func (c Core) ZapHomePath() (map[string]interface{}, error) { + return c.c.Request("core/view/zapHomePath/", nil) +} + +// Gets the maximum number of alert instances to include in a report. +func (c Core) OptionMaximumAlertInstances() (map[string]interface{}, error) { + return c.c.Request("core/view/optionMaximumAlertInstances/", nil) +} + +// Gets whether or not related alerts will be merged in any reports generated. +func (c Core) OptionMergeRelatedAlerts() (map[string]interface{}, error) { + return c.c.Request("core/view/optionMergeRelatedAlerts/", nil) +} + +// Gets the path to the file with alert overrides. +func (c Core) OptionAlertOverridesFilePath() (map[string]interface{}, error) { + return c.c.Request("core/view/optionAlertOverridesFilePath/", nil) +} + +func (c Core) HomeDirectory() (map[string]interface{}, error) { + return c.c.Request("core/view/homeDirectory/", nil) +} + +// Use view proxyChainExcludedDomains instead. +func (c Core) OptionProxyChainSkipName() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyChainSkipName/", nil) +} + +// Use view proxyChainExcludedDomains instead. +func (c Core) OptionProxyExcludedDomains() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyExcludedDomains/", nil) +} + +// Use view proxyChainExcludedDomains instead. +func (c Core) OptionProxyExcludedDomainsEnabled() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyExcludedDomainsEnabled/", nil) +} + +// Gets the alert with the given ID, the corresponding HTTP message can be obtained with the 'messageId' field and 'message' API method +func (c Core) Alert(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return c.c.Request("core/view/alert/", m) +} + +// Gets the alerts raised by ZAP, optionally filtering by URL or riskId, and paginating with 'start' position and 'count' of alerts +func (c Core) Alerts(baseurl string, start string, count string, riskid string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + "start": start, + "count": count, + "riskId": riskid, + } + return c.c.Request("core/view/alerts/", m) +} + +// Gets number of alerts grouped by each risk level, optionally filtering by URL +func (c Core) AlertsSummary(baseurl string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + } + return c.c.Request("core/view/alertsSummary/", m) +} + +// Gets the number of alerts, optionally filtering by URL or riskId +func (c Core) NumberOfAlerts(baseurl string, riskid string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + "riskId": riskid, + } + return c.c.Request("core/view/numberOfAlerts/", m) +} + +// The detailed logging config, optionally filtered based on a name (ex: starts with). +func (c Core) GetLogLevel(name string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + } + return c.c.Request("core/view/getLogLevel/", m) +} + +// Gets the user agent that ZAP should use when creating HTTP messages (for example, spider messages or CONNECT requests to outgoing proxy). +func (c Core) OptionDefaultUserAgent() (map[string]interface{}, error) { + return c.c.Request("core/view/optionDefaultUserAgent/", nil) +} + +// Gets the TTL (in seconds) of successful DNS queries. +func (c Core) OptionDnsTtlSuccessfulQueries() (map[string]interface{}, error) { + return c.c.Request("core/view/optionDnsTtlSuccessfulQueries/", nil) +} + +func (c Core) OptionHttpState() (map[string]interface{}, error) { + return c.c.Request("core/view/optionHttpState/", nil) +} + +func (c Core) OptionHttpStateEnabled() (map[string]interface{}, error) { + return c.c.Request("core/view/optionHttpStateEnabled/", nil) +} + +func (c Core) OptionProxyChainName() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyChainName/", nil) +} + +func (c Core) OptionProxyChainPassword() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyChainPassword/", nil) +} + +func (c Core) OptionProxyChainPort() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyChainPort/", nil) +} + +func (c Core) OptionProxyChainPrompt() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyChainPrompt/", nil) +} + +func (c Core) OptionProxyChainRealm() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyChainRealm/", nil) +} + +func (c Core) OptionProxyChainUserName() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyChainUserName/", nil) +} + +func (c Core) OptionSingleCookieRequestHeader() (map[string]interface{}, error) { + return c.c.Request("core/view/optionSingleCookieRequestHeader/", nil) +} + +// Gets the connection time out (in seconds). +func (c Core) OptionTimeoutInSecs() (map[string]interface{}, error) { + return c.c.Request("core/view/optionTimeoutInSecs/", nil) +} + +func (c Core) OptionUseProxyChain() (map[string]interface{}, error) { + return c.c.Request("core/view/optionUseProxyChain/", nil) +} + +func (c Core) OptionUseProxyChainAuth() (map[string]interface{}, error) { + return c.c.Request("core/view/optionUseProxyChainAuth/", nil) +} + +// Gets whether or not the SOCKS proxy should be used. +func (c Core) OptionUseSocksProxy() (map[string]interface{}, error) { + return c.c.Request("core/view/optionUseSocksProxy/", nil) +} + +// Convenient and simple action to access a URL, optionally following redirections. Returns the request sent and response received and followed redirections, if any. Other actions are available which offer more control on what is sent, like, 'sendRequest' or 'sendHarRequest'. +func (c Core) AccessUrl(url string, followredirects string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "followRedirects": followredirects, + } + return c.c.Request("core/action/accessUrl/", m) +} + +// Shuts down ZAP +func (c Core) Shutdown() (map[string]interface{}, error) { + return c.c.Request("core/action/shutdown/", nil) +} + +// Creates a new session, optionally overwriting existing files. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir. +func (c Core) NewSession(name string, overwrite string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + "overwrite": overwrite, + } + return c.c.Request("core/action/newSession/", m) +} + +// Loads the session with the given name. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir. +func (c Core) LoadSession(name string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + } + return c.c.Request("core/action/loadSession/", m) +} + +// Saves the session. +func (c Core) SaveSession(name string, overwrite string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + "overwrite": overwrite, + } + return c.c.Request("core/action/saveSession/", m) +} + +// Snapshots the session, optionally with the given name, and overwriting existing files. If no name is specified the name of the current session with a timestamp appended is used. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir. +func (c Core) SnapshotSession(name string, overwrite string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + "overwrite": overwrite, + } + return c.c.Request("core/action/snapshotSession/", m) +} + +// Clears the regexes of URLs excluded from the local proxies. +func (c Core) ClearExcludedFromProxy() (map[string]interface{}, error) { + return c.c.Request("core/action/clearExcludedFromProxy/", nil) +} + +// Adds a regex of URLs that should be excluded from the local proxies. +func (c Core) ExcludeFromProxy(regex string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + } + return c.c.Request("core/action/excludeFromProxy/", m) +} + +func (c Core) SetHomeDirectory(dir string) (map[string]interface{}, error) { + m := map[string]string{ + "dir": dir, + } + return c.c.Request("core/action/setHomeDirectory/", m) +} + +// Sets the mode, which may be one of [safe, protect, standard, attack] +func (c Core) SetMode(mode string) (map[string]interface{}, error) { + m := map[string]string{ + "mode": mode, + } + return c.c.Request("core/action/setMode/", m) +} + +// Generates a new Root CA certificate for the local proxies. +func (c Core) GenerateRootCA() (map[string]interface{}, error) { + return c.c.Request("core/action/generateRootCA/", nil) +} + +// Sends the HTTP request, optionally following redirections. Returns the request sent and response received and followed redirections, if any. The Mode is enforced when sending the request (and following redirections), custom manual requests are not allowed in 'Safe' mode nor in 'Protected' mode if out of scope. +func (c Core) SendRequest(request string, followredirects string) (map[string]interface{}, error) { + m := map[string]string{ + "request": request, + "followRedirects": followredirects, + } + return c.c.Request("core/action/sendRequest/", m) +} + +func (c Core) RunGarbageCollection() (map[string]interface{}, error) { + return c.c.Request("core/action/runGarbageCollection/", nil) +} + +// Deletes the site node found in the Sites Tree on the basis of the URL, HTTP method, and post data (if applicable and specified). +func (c Core) DeleteSiteNode(url string, method string, postdata string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "method": method, + "postData": postdata, + } + return c.c.Request("core/action/deleteSiteNode/", m) +} + +// Adds a domain to be excluded from the outgoing proxy, using the specified value. Optionally sets if the new entry is enabled (default, true) and whether or not the new value is specified as a regex (default, false). +func (c Core) AddProxyChainExcludedDomain(value string, isregex string, isenabled string) (map[string]interface{}, error) { + m := map[string]string{ + "value": value, + "isRegex": isregex, + "isEnabled": isenabled, + } + return c.c.Request("core/action/addProxyChainExcludedDomain/", m) +} + +// Modifies a domain excluded from the outgoing proxy. Allows to modify the value, if enabled or if a regex. The domain is selected with its index, which can be obtained with the view proxyChainExcludedDomains. +func (c Core) ModifyProxyChainExcludedDomain(idx string, value string, isregex string, isenabled string) (map[string]interface{}, error) { + m := map[string]string{ + "idx": idx, + "value": value, + "isRegex": isregex, + "isEnabled": isenabled, + } + return c.c.Request("core/action/modifyProxyChainExcludedDomain/", m) +} + +// Removes a domain excluded from the outgoing proxy, with the given index. The index can be obtained with the view proxyChainExcludedDomains. +func (c Core) RemoveProxyChainExcludedDomain(idx string) (map[string]interface{}, error) { + m := map[string]string{ + "idx": idx, + } + return c.c.Request("core/action/removeProxyChainExcludedDomain/", m) +} + +// Enables all domains excluded from the outgoing proxy. +func (c Core) EnableAllProxyChainExcludedDomains() (map[string]interface{}, error) { + return c.c.Request("core/action/enableAllProxyChainExcludedDomains/", nil) +} + +// Disables all domains excluded from the outgoing proxy. +func (c Core) DisableAllProxyChainExcludedDomains() (map[string]interface{}, error) { + return c.c.Request("core/action/disableAllProxyChainExcludedDomains/", nil) +} + +// Sets the maximum number of alert instances to include in a report. A value of zero is treated as unlimited. +func (c Core) SetOptionMaximumAlertInstances(numberofinstances string) (map[string]interface{}, error) { + m := map[string]string{ + "numberOfInstances": numberofinstances, + } + return c.c.Request("core/action/setOptionMaximumAlertInstances/", m) +} + +// Sets whether or not related alerts will be merged in any reports generated. +func (c Core) SetOptionMergeRelatedAlerts(enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "enabled": enabled, + } + return c.c.Request("core/action/setOptionMergeRelatedAlerts/", m) +} + +// Sets (or clears, if empty) the path to the file with alert overrides. +func (c Core) SetOptionAlertOverridesFilePath(filepath string) (map[string]interface{}, error) { + m := map[string]string{ + "filePath": filepath, + } + return c.c.Request("core/action/setOptionAlertOverridesFilePath/", m) +} + +// Enables use of a PKCS12 client certificate for the certificate with the given file system path, password, and optional index. +func (c Core) EnablePKCS12ClientCertificate(filepath string, password string, index string) (map[string]interface{}, error) { + m := map[string]string{ + "filePath": filepath, + "password": password, + "index": index, + } + return c.c.Request("core/action/enablePKCS12ClientCertificate/", m) +} + +// Disables the option for use of client certificates. +func (c Core) DisableClientCertificate() (map[string]interface{}, error) { + return c.c.Request("core/action/disableClientCertificate/", nil) +} + +// Create a zip file of the ZAP core and add-on SBOMs +func (c Core) CreateSbomZip(filepath string) (map[string]interface{}, error) { + m := map[string]string{ + "filePath": filepath, + } + return c.c.Request("core/action/createSbomZip/", m) +} + +// Deletes all alerts of the current session. +func (c Core) DeleteAllAlerts() (map[string]interface{}, error) { + return c.c.Request("core/action/deleteAllAlerts/", nil) +} + +// Deletes the alert with the given ID. +func (c Core) DeleteAlert(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return c.c.Request("core/action/deleteAlert/", m) +} + +// Sets the logging level for a given logger name. +func (c Core) SetLogLevel(name string, loglevel string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + "logLevel": loglevel, + } + return c.c.Request("core/action/setLogLevel/", m) +} + +// Sets the user agent that ZAP should use when creating HTTP messages (for example, spider messages or CONNECT requests to outgoing proxy). +func (c Core) SetOptionDefaultUserAgent(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return c.c.Request("core/action/setOptionDefaultUserAgent/", m) +} + +// Sets the TTL (in seconds) of successful DNS queries (applies after ZAP restart). +func (c Core) SetOptionDnsTtlSuccessfulQueries(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return c.c.Request("core/action/setOptionDnsTtlSuccessfulQueries/", m) +} + +func (c Core) SetOptionHttpStateEnabled(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return c.c.Request("core/action/setOptionHttpStateEnabled/", m) +} + +func (c Core) SetOptionProxyChainName(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return c.c.Request("core/action/setOptionProxyChainName/", m) +} + +func (c Core) SetOptionProxyChainPassword(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return c.c.Request("core/action/setOptionProxyChainPassword/", m) +} + +func (c Core) SetOptionProxyChainPort(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return c.c.Request("core/action/setOptionProxyChainPort/", m) +} + +func (c Core) SetOptionProxyChainPrompt(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return c.c.Request("core/action/setOptionProxyChainPrompt/", m) +} + +func (c Core) SetOptionProxyChainRealm(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return c.c.Request("core/action/setOptionProxyChainRealm/", m) +} + +// Use actions [add|modify|remove]ProxyChainExcludedDomain instead. +func (c Core) SetOptionProxyChainSkipName(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return c.c.Request("core/action/setOptionProxyChainSkipName/", m) +} + +func (c Core) SetOptionProxyChainUserName(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return c.c.Request("core/action/setOptionProxyChainUserName/", m) +} + +func (c Core) SetOptionSingleCookieRequestHeader(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return c.c.Request("core/action/setOptionSingleCookieRequestHeader/", m) +} + +// Sets the connection time out (in seconds). +func (c Core) SetOptionTimeoutInSecs(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return c.c.Request("core/action/setOptionTimeoutInSecs/", m) +} + +// Sets whether or not the outgoing proxy should be used. The address/hostname of the outgoing proxy must be set to enable this option. +func (c Core) SetOptionUseProxyChain(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return c.c.Request("core/action/setOptionUseProxyChain/", m) +} + +func (c Core) SetOptionUseProxyChainAuth(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return c.c.Request("core/action/setOptionUseProxyChainAuth/", m) +} + +// Sets whether or not the SOCKS proxy should be used. +func (c Core) SetOptionUseSocksProxy(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return c.c.Request("core/action/setOptionUseSocksProxy/", m) +} + +func (c Core) Proxypac() ([]byte, error) { + return c.c.RequestOther("core/other/proxy.pac/", nil) +} + +// Gets the Root CA certificate used by the local proxies. +func (c Core) Rootcert() ([]byte, error) { + return c.c.RequestOther("core/other/rootcert/", nil) +} + +func (c Core) Setproxy(proxy string) ([]byte, error) { + m := map[string]string{ + "proxy": proxy, + } + return c.c.RequestOther("core/other/setproxy/", m) +} + +// Generates a report in XML format +func (c Core) Xmlreport() ([]byte, error) { + return c.c.RequestOther("core/other/xmlreport/", nil) +} + +// Generates a report in HTML format +func (c Core) Htmlreport() ([]byte, error) { + return c.c.RequestOther("core/other/htmlreport/", nil) +} + +// Generates a report in JSON format +func (c Core) Jsonreport() ([]byte, error) { + return c.c.RequestOther("core/other/jsonreport/", nil) +} + +// Generates a report in Markdown format +func (c Core) Mdreport() ([]byte, error) { + return c.c.RequestOther("core/other/mdreport/", nil) +} + +// Gets the message with the given ID in HAR format +func (c Core) MessageHar(id string) ([]byte, error) { + m := map[string]string{ + "id": id, + } + return c.c.RequestOther("core/other/messageHar/", m) +} + +// Gets the HTTP messages sent through/by ZAP, in HAR format, optionally filtered by URL and paginated with 'start' position and 'count' of messages +func (c Core) MessagesHar(baseurl string, start string, count string) ([]byte, error) { + m := map[string]string{ + "baseurl": baseurl, + "start": start, + "count": count, + } + return c.c.RequestOther("core/other/messagesHar/", m) +} + +// Gets the HTTP messages with the given IDs, in HAR format. +func (c Core) MessagesHarById(ids string) ([]byte, error) { + m := map[string]string{ + "ids": ids, + } + return c.c.RequestOther("core/other/messagesHarById/", m) +} + +// Sends the first HAR request entry, optionally following redirections. Returns, in HAR format, the request sent and response received and followed redirections, if any. The Mode is enforced when sending the request (and following redirections), custom manual requests are not allowed in 'Safe' mode nor in 'Protected' mode if out of scope. +func (c Core) SendHarRequest(request string, followredirects string) ([]byte, error) { + m := map[string]string{ + "request": request, + "followRedirects": followredirects, + } + return c.c.RequestOther("core/other/sendHarRequest/", m) +} + +// Download a file from the transfer directory +func (c Core) FileDownload(filename string) ([]byte, error) { + m := map[string]string{ + "fileName": filename, + } + return c.c.RequestOther("core/other/fileDownload/", m) +} + +// Upload a file to the transfer directory. Only POST requests accepted with encodings of "multipart/form-data" or "application/x-www-form-urlencoded". +func (c Core) FileUpload(filename string, filecontents string) ([]byte, error) { + m := map[string]string{ + "fileName": filename, + "fileContents": filecontents, + } + return c.c.RequestOther("core/other/fileUpload/", m) +} diff --git a/zap-api-go/zap/forced-user_generated.go b/zap-api-go/zap/forced-user_generated.go new file mode 100644 index 0000000..118386b --- /dev/null +++ b/zap-api-go/zap/forced-user_generated.go @@ -0,0 +1,58 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +import "strconv" + +type ForcedUser struct { + c *Client +} + +// Returns 'true' if 'forced user' mode is enabled, 'false' otherwise +func (f ForcedUser) IsForcedUserModeEnabled() (map[string]interface{}, error) { + return f.c.Request("forcedUser/view/isForcedUserModeEnabled/", nil) +} + +// Gets the user (ID) set as 'forced user' for the given context (ID) +func (f ForcedUser) GetForcedUser(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return f.c.Request("forcedUser/view/getForcedUser/", m) +} + +// Sets the user (ID) that should be used in 'forced user' mode for the given context (ID) +func (f ForcedUser) SetForcedUser(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return f.c.Request("forcedUser/action/setForcedUser/", m) +} + +// Sets if 'forced user' mode should be enabled or not +func (f ForcedUser) SetForcedUserModeEnabled(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "boolean": strconv.FormatBool(boolean), + } + return f.c.Request("forcedUser/action/setForcedUserModeEnabled/", m) +} diff --git a/zap-api-go/zap/http-sessions_generated.go b/zap-api-go/zap/http-sessions_generated.go new file mode 100644 index 0000000..c5ab160 --- /dev/null +++ b/zap-api-go/zap/http-sessions_generated.go @@ -0,0 +1,161 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type HttpSessions struct { + c *Client +} + +// Gets all of the sites that have sessions. +func (h HttpSessions) Sites() (map[string]interface{}, error) { + return h.c.Request("httpSessions/view/sites/", nil) +} + +// Gets the sessions for the given site. Optionally returning just the session with the given name. +func (h HttpSessions) Sessions(site string, session string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "session": session, + } + return h.c.Request("httpSessions/view/sessions/", m) +} + +// Gets the name of the active session for the given site. +func (h HttpSessions) ActiveSession(site string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + } + return h.c.Request("httpSessions/view/activeSession/", m) +} + +// Gets the names of the session tokens for the given site. +func (h HttpSessions) SessionTokens(site string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + } + return h.c.Request("httpSessions/view/sessionTokens/", m) +} + +// Gets the default session tokens. +func (h HttpSessions) DefaultSessionTokens() (map[string]interface{}, error) { + return h.c.Request("httpSessions/view/defaultSessionTokens/", nil) +} + +// Creates an empty session for the given site. Optionally with the given name. +func (h HttpSessions) CreateEmptySession(site string, session string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "session": session, + } + return h.c.Request("httpSessions/action/createEmptySession/", m) +} + +// Removes the session from the given site. +func (h HttpSessions) RemoveSession(site string, session string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "session": session, + } + return h.c.Request("httpSessions/action/removeSession/", m) +} + +// Sets the given session as active for the given site. +func (h HttpSessions) SetActiveSession(site string, session string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "session": session, + } + return h.c.Request("httpSessions/action/setActiveSession/", m) +} + +// Unsets the active session of the given site. +func (h HttpSessions) UnsetActiveSession(site string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + } + return h.c.Request("httpSessions/action/unsetActiveSession/", m) +} + +// Adds the session token to the given site. +func (h HttpSessions) AddSessionToken(site string, sessiontoken string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "sessionToken": sessiontoken, + } + return h.c.Request("httpSessions/action/addSessionToken/", m) +} + +// Removes the session token from the given site. +func (h HttpSessions) RemoveSessionToken(site string, sessiontoken string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "sessionToken": sessiontoken, + } + return h.c.Request("httpSessions/action/removeSessionToken/", m) +} + +// Sets the value of the session token of the given session for the given site. +func (h HttpSessions) SetSessionTokenValue(site string, session string, sessiontoken string, tokenvalue string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "session": session, + "sessionToken": sessiontoken, + "tokenValue": tokenvalue, + } + return h.c.Request("httpSessions/action/setSessionTokenValue/", m) +} + +// Renames the session of the given site. +func (h HttpSessions) RenameSession(site string, oldsessionname string, newsessionname string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "oldSessionName": oldsessionname, + "newSessionName": newsessionname, + } + return h.c.Request("httpSessions/action/renameSession/", m) +} + +// Adds a default session token with the given name and enabled state. +func (h HttpSessions) AddDefaultSessionToken(sessiontoken string, tokenenabled string) (map[string]interface{}, error) { + m := map[string]string{ + "sessionToken": sessiontoken, + "tokenEnabled": tokenenabled, + } + return h.c.Request("httpSessions/action/addDefaultSessionToken/", m) +} + +// Sets whether or not the default session token with the given name is enabled. +func (h HttpSessions) SetDefaultSessionTokenEnabled(sessiontoken string, tokenenabled string) (map[string]interface{}, error) { + m := map[string]string{ + "sessionToken": sessiontoken, + "tokenEnabled": tokenenabled, + } + return h.c.Request("httpSessions/action/setDefaultSessionTokenEnabled/", m) +} + +// Removes the default session token with the given name. +func (h HttpSessions) RemoveDefaultSessionToken(sessiontoken string) (map[string]interface{}, error) { + m := map[string]string{ + "sessionToken": sessiontoken, + } + return h.c.Request("httpSessions/action/removeDefaultSessionToken/", m) +} diff --git a/zap-api-go/zap/params_generated.go b/zap-api-go/zap/params_generated.go new file mode 100644 index 0000000..3504084 --- /dev/null +++ b/zap-api-go/zap/params_generated.go @@ -0,0 +1,34 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Params struct { + c *Client +} + +// Shows the parameters for the specified site, or for all sites if the site is not specified +func (p Params) Params(site string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + } + return p.c.Request("params/view/params/", m) +} diff --git a/zap-api-go/zap/pscan_generated.go b/zap-api-go/zap/pscan_generated.go new file mode 100644 index 0000000..8046f05 --- /dev/null +++ b/zap-api-go/zap/pscan_generated.go @@ -0,0 +1,130 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Pscan struct { + c *Client +} + +// Tells whether or not the passive scan should be performed only on messages that are in scope. +func (p Pscan) ScanOnlyInScope() (map[string]interface{}, error) { + return p.c.Request("pscan/view/scanOnlyInScope/", nil) +} + +// The number of records the passive scanner still has to scan +func (p Pscan) RecordsToScan() (map[string]interface{}, error) { + return p.c.Request("pscan/view/recordsToScan/", nil) +} + +// Lists all passive scan rules with their ID, name, enabled state, and alert threshold. +func (p Pscan) Scanners() (map[string]interface{}, error) { + return p.c.Request("pscan/view/scanners/", nil) +} + +// Show information about the passive scan rule currently being run (if any). +func (p Pscan) CurrentRule() (map[string]interface{}, error) { + return p.c.Request("pscan/view/currentRule/", nil) +} + +// Show information about the passive scan tasks currently being run (if any). +func (p Pscan) CurrentTasks() (map[string]interface{}, error) { + return p.c.Request("pscan/view/currentTasks/", nil) +} + +// Gets the maximum number of alerts a passive scan rule should raise. +func (p Pscan) MaxAlertsPerRule() (map[string]interface{}, error) { + return p.c.Request("pscan/view/maxAlertsPerRule/", nil) +} + +// Sets whether or not the passive scanning is enabled (Note: the enabled state is not persisted). +func (p Pscan) SetEnabled(enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "enabled": enabled, + } + return p.c.Request("pscan/action/setEnabled/", m) +} + +// Sets whether or not the passive scan should be performed only on messages that are in scope. +func (p Pscan) SetScanOnlyInScope(onlyinscope string) (map[string]interface{}, error) { + m := map[string]string{ + "onlyInScope": onlyinscope, + } + return p.c.Request("pscan/action/setScanOnlyInScope/", m) +} + +// Enables all passive scan rules +func (p Pscan) EnableAllScanners() (map[string]interface{}, error) { + return p.c.Request("pscan/action/enableAllScanners/", nil) +} + +// Disables all passive scan rules +func (p Pscan) DisableAllScanners() (map[string]interface{}, error) { + return p.c.Request("pscan/action/disableAllScanners/", nil) +} + +// Enables all passive scan rules with the given IDs (comma separated list of IDs) +func (p Pscan) EnableScanners(ids string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + } + return p.c.Request("pscan/action/enableScanners/", m) +} + +// Disables all passive scan rules with the given IDs (comma separated list of IDs) +func (p Pscan) DisableScanners(ids string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + } + return p.c.Request("pscan/action/disableScanners/", m) +} + +// Sets the alert threshold of the passive scan rule with the given ID, accepted values for alert threshold: OFF, DEFAULT, LOW, MEDIUM and HIGH +func (p Pscan) SetScannerAlertThreshold(id string, alertthreshold string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + "alertThreshold": alertthreshold, + } + return p.c.Request("pscan/action/setScannerAlertThreshold/", m) +} + +// Sets the maximum number of alerts a passive scan rule should raise. +func (p Pscan) SetMaxAlertsPerRule(maxalerts string) (map[string]interface{}, error) { + m := map[string]string{ + "maxAlerts": maxalerts, + } + return p.c.Request("pscan/action/setMaxAlertsPerRule/", m) +} + +// Disables all passive scan tags. +func (p Pscan) DisableAllTags() (map[string]interface{}, error) { + return p.c.Request("pscan/action/disableAllTags/", nil) +} + +// Enables all passive scan tags. +func (p Pscan) EnableAllTags() (map[string]interface{}, error) { + return p.c.Request("pscan/action/enableAllTags/", nil) +} + +// Clears the passive scan queue. +func (p Pscan) ClearQueue() (map[string]interface{}, error) { + return p.c.Request("pscan/action/clearQueue/", nil) +} diff --git a/zap-api-go/zap/rule-config_generated.go b/zap-api-go/zap/rule-config_generated.go new file mode 100644 index 0000000..2c62970 --- /dev/null +++ b/zap-api-go/zap/rule-config_generated.go @@ -0,0 +1,61 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type RuleConfig struct { + c *Client +} + +// Show the specified rule configuration +func (r RuleConfig) RuleConfigValue(key string) (map[string]interface{}, error) { + m := map[string]string{ + "key": key, + } + return r.c.Request("ruleConfig/view/ruleConfigValue/", m) +} + +// Show all of the rule configurations +func (r RuleConfig) AllRuleConfigs() (map[string]interface{}, error) { + return r.c.Request("ruleConfig/view/allRuleConfigs/", nil) +} + +// Reset the specified rule configuration, which must already exist +func (r RuleConfig) ResetRuleConfigValue(key string) (map[string]interface{}, error) { + m := map[string]string{ + "key": key, + } + return r.c.Request("ruleConfig/action/resetRuleConfigValue/", m) +} + +// Reset all of the rule configurations +func (r RuleConfig) ResetAllRuleConfigValues() (map[string]interface{}, error) { + return r.c.Request("ruleConfig/action/resetAllRuleConfigValues/", nil) +} + +// Set the specified rule configuration, which must already exist +func (r RuleConfig) SetRuleConfigValue(key string, value string) (map[string]interface{}, error) { + m := map[string]string{ + "key": key, + "value": value, + } + return r.c.Request("ruleConfig/action/setRuleConfigValue/", m) +} diff --git a/zap-api-go/zap/script_generated.go b/zap-api-go/zap/script_generated.go new file mode 100644 index 0000000..8a78bb5 --- /dev/null +++ b/zap-api-go/zap/script_generated.go @@ -0,0 +1,212 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Script struct { + c *Client +} + +// Lists the script engines available +func (s Script) ListEngines() (map[string]interface{}, error) { + return s.c.Request("script/view/listEngines/", nil) +} + +// Lists the script types available. +func (s Script) ListTypes() (map[string]interface{}, error) { + return s.c.Request("script/view/listTypes/", nil) +} + +// Lists the scripts available, with its engine, name, description, type and error state. +func (s Script) ListScripts() (map[string]interface{}, error) { + return s.c.Request("script/view/listScripts/", nil) +} + +// Gets the value of the global variable with the given key. Returns an API error (DOES_NOT_EXIST) if no value was previously set. +func (s Script) GlobalVar(varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "varKey": varkey, + } + return s.c.Request("script/view/globalVar/", m) +} + +// Gets the value (string representation) of a global custom variable. Returns an API error (DOES_NOT_EXIST) if no value was previously set. +func (s Script) GlobalCustomVar(varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "varKey": varkey, + } + return s.c.Request("script/view/globalCustomVar/", m) +} + +// Gets all the global variables (key/value pairs). +func (s Script) GlobalVars() (map[string]interface{}, error) { + return s.c.Request("script/view/globalVars/", nil) +} + +// Gets all the global custom variables (key/value pairs, the value is the string representation). +func (s Script) GlobalCustomVars() (map[string]interface{}, error) { + return s.c.Request("script/view/globalCustomVars/", nil) +} + +// Gets the value of the variable with the given key for the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists or if no value was previously set. +func (s Script) ScriptVar(scriptname string, varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + "varKey": varkey, + } + return s.c.Request("script/view/scriptVar/", m) +} + +// Gets the value (string representation) of a custom variable. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists or if no value was previously set. +func (s Script) ScriptCustomVar(scriptname string, varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + "varKey": varkey, + } + return s.c.Request("script/view/scriptCustomVar/", m) +} + +// Gets all the variables (key/value pairs) of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. +func (s Script) ScriptVars(scriptname string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + } + return s.c.Request("script/view/scriptVars/", m) +} + +// Gets all the custom variables (key/value pairs, the value is the string representation) of a script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. +func (s Script) ScriptCustomVars(scriptname string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + } + return s.c.Request("script/view/scriptCustomVars/", m) +} + +// Enables the script with the given name +func (s Script) Enable(scriptname string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + } + return s.c.Request("script/action/enable/", m) +} + +// Disables the script with the given name +func (s Script) Disable(scriptname string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + } + return s.c.Request("script/action/disable/", m) +} + +// Loads a script into ZAP from the given local file, with the given name, type and engine, optionally with a description, and a charset name to read the script (the charset name is required if the script is not in UTF-8, for example, in ISO-8859-1). +func (s Script) Load(scriptname string, scripttype string, scriptengine string, filename string, scriptdescription string, charset string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + "scriptType": scripttype, + "scriptEngine": scriptengine, + "fileName": filename, + "scriptDescription": scriptdescription, + "charset": charset, + } + return s.c.Request("script/action/load/", m) +} + +// Removes the script with the given name +func (s Script) Remove(scriptname string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + } + return s.c.Request("script/action/remove/", m) +} + +// Runs the stand alone script with the given name +func (s Script) RunStandAloneScript(scriptname string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + } + return s.c.Request("script/action/runStandAloneScript/", m) +} + +// Clears the global variable with the given key. +func (s Script) ClearGlobalVar(varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "varKey": varkey, + } + return s.c.Request("script/action/clearGlobalVar/", m) +} + +// Clears a global custom variable. +func (s Script) ClearGlobalCustomVar(varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "varKey": varkey, + } + return s.c.Request("script/action/clearGlobalCustomVar/", m) +} + +// Clears the global variables. +func (s Script) ClearGlobalVars() (map[string]interface{}, error) { + return s.c.Request("script/action/clearGlobalVars/", nil) +} + +// Clears the variable with the given key of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. +func (s Script) ClearScriptVar(scriptname string, varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + "varKey": varkey, + } + return s.c.Request("script/action/clearScriptVar/", m) +} + +// Clears a script custom variable. +func (s Script) ClearScriptCustomVar(scriptname string, varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + "varKey": varkey, + } + return s.c.Request("script/action/clearScriptCustomVar/", m) +} + +// Clears the variables of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. +func (s Script) ClearScriptVars(scriptname string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + } + return s.c.Request("script/action/clearScriptVars/", m) +} + +// Sets the value of the variable with the given key of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. +func (s Script) SetScriptVar(scriptname string, varkey string, varvalue string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + "varKey": varkey, + "varValue": varvalue, + } + return s.c.Request("script/action/setScriptVar/", m) +} + +// Sets the value of the global variable with the given key. +func (s Script) SetGlobalVar(varkey string, varvalue string) (map[string]interface{}, error) { + m := map[string]string{ + "varKey": varkey, + "varValue": varvalue, + } + return s.c.Request("script/action/setGlobalVar/", m) +} diff --git a/zap-api-go/zap/search_generated.go b/zap-api-go/zap/search_generated.go new file mode 100644 index 0000000..9eae81d --- /dev/null +++ b/zap-api-go/zap/search_generated.go @@ -0,0 +1,191 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Search struct { + c *Client +} + +// Returns the URLs of the HTTP messages that match the given regular expression in the URL optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) UrlsByUrlRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/urlsByUrlRegex/", m) +} + +// 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. +func (s Search) UrlsByTagRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/urlsByTagRegex/", m) +} + +// 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. +func (s Search) UrlsByRequestRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/urlsByRequestRegex/", m) +} + +// Returns the URLs of the HTTP messages that match the given regular expression in the response optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) UrlsByResponseRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/urlsByResponseRegex/", m) +} + +// Returns the URLs of the HTTP messages that match the given regular expression in the header(s) optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) UrlsByHeaderRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/urlsByHeaderRegex/", m) +} + +// Returns the HTTP messages that match the given regular expression in the URL optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) MessagesByUrlRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/messagesByUrlRegex/", m) +} + +// 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. +func (s Search) MessagesByTagRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/messagesByTagRegex/", m) +} + +// 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. +func (s Search) MessagesByRequestRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/messagesByRequestRegex/", m) +} + +// Returns the HTTP messages that match the given regular expression in the response optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) MessagesByResponseRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/messagesByResponseRegex/", m) +} + +// Returns the HTTP messages that match the given regular expression in the header(s) optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) MessagesByHeaderRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/messagesByHeaderRegex/", m) +} + +// Returns the HTTP messages, in HAR format, that match the given regular expression in the URL optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) HarByUrlRegex(regex string, baseurl string, start string, count string) ([]byte, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.RequestOther("search/other/harByUrlRegex/", m) +} + +// 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. +func (s Search) HarByTagRegex(regex string, baseurl string, start string, count string) ([]byte, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.RequestOther("search/other/harByTagRegex/", m) +} + +// 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. +func (s Search) HarByRequestRegex(regex string, baseurl string, start string, count string) ([]byte, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.RequestOther("search/other/harByRequestRegex/", m) +} + +// Returns the HTTP messages, in HAR format, that match the given regular expression in the response optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) HarByResponseRegex(regex string, baseurl string, start string, count string) ([]byte, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.RequestOther("search/other/harByResponseRegex/", m) +} + +// Returns the HTTP messages, in HAR format, that match the given regular expression in the header(s) optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) HarByHeaderRegex(regex string, baseurl string, start string, count string) ([]byte, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.RequestOther("search/other/harByHeaderRegex/", m) +} diff --git a/zap-api-go/zap/session-management_generated.go b/zap-api-go/zap/session-management_generated.go new file mode 100644 index 0000000..50ae76b --- /dev/null +++ b/zap-api-go/zap/session-management_generated.go @@ -0,0 +1,57 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type SessionManagement struct { + c *Client +} + +// Gets the name of the session management methods. +func (s SessionManagement) GetSupportedSessionManagementMethods() (map[string]interface{}, error) { + return s.c.Request("sessionManagement/view/getSupportedSessionManagementMethods/", nil) +} + +// Gets the configuration parameters for the session management method with the given name. +func (s SessionManagement) GetSessionManagementMethodConfigParams(methodname string) (map[string]interface{}, error) { + m := map[string]string{ + "methodName": methodname, + } + return s.c.Request("sessionManagement/view/getSessionManagementMethodConfigParams/", m) +} + +// Gets the name of the session management method for the context with the given ID. +func (s SessionManagement) GetSessionManagementMethod(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return s.c.Request("sessionManagement/view/getSessionManagementMethod/", m) +} + +// Sets the session management method for the context with the given ID. +func (s SessionManagement) SetSessionManagementMethod(contextid string, methodname string, methodconfigparams string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "methodName": methodname, + "methodConfigParams": methodconfigparams, + } + return s.c.Request("sessionManagement/action/setSessionManagementMethod/", m) +} diff --git a/zap-api-go/zap/stats_generated.go b/zap-api-go/zap/stats_generated.go new file mode 100644 index 0000000..ea96b6e --- /dev/null +++ b/zap-api-go/zap/stats_generated.go @@ -0,0 +1,118 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +import "strconv" + +type Stats struct { + c *Client +} + +// Statistics +func (s Stats) Stats(keyprefix string) (map[string]interface{}, error) { + m := map[string]string{ + "keyPrefix": keyprefix, + } + return s.c.Request("stats/view/stats/", m) +} + +// Gets all of the site based statistics, optionally filtered by a key prefix +func (s Stats) AllSitesStats(keyprefix string) (map[string]interface{}, error) { + m := map[string]string{ + "keyPrefix": keyprefix, + } + return s.c.Request("stats/view/allSitesStats/", m) +} + +// Gets all of the global statistics, optionally filtered by a key prefix +func (s Stats) SiteStats(site string, keyprefix string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "keyPrefix": keyprefix, + } + return s.c.Request("stats/view/siteStats/", m) +} + +// Gets the Statsd service hostname +func (s Stats) OptionStatsdHost() (map[string]interface{}, error) { + return s.c.Request("stats/view/optionStatsdHost/", nil) +} + +// Gets the Statsd service port +func (s Stats) OptionStatsdPort() (map[string]interface{}, error) { + return s.c.Request("stats/view/optionStatsdPort/", nil) +} + +// Gets the prefix to be applied to all stats sent to the configured Statsd service +func (s Stats) OptionStatsdPrefix() (map[string]interface{}, error) { + return s.c.Request("stats/view/optionStatsdPrefix/", nil) +} + +// Returns 'true' if in memory statistics are enabled, otherwise returns 'false' +func (s Stats) OptionInMemoryEnabled() (map[string]interface{}, error) { + return s.c.Request("stats/view/optionInMemoryEnabled/", nil) +} + +// Returns 'true' if a Statsd server has been correctly configured, otherwise returns 'false' +func (s Stats) OptionStatsdEnabled() (map[string]interface{}, error) { + return s.c.Request("stats/view/optionStatsdEnabled/", nil) +} + +// Clears all of the statistics +func (s Stats) ClearStats(keyprefix string) (map[string]interface{}, error) { + m := map[string]string{ + "keyPrefix": keyprefix, + } + return s.c.Request("stats/action/clearStats/", m) +} + +// Sets the Statsd service hostname, supply an empty string to stop using a Statsd service +func (s Stats) SetOptionStatsdHost(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return s.c.Request("stats/action/setOptionStatsdHost/", m) +} + +// Sets the prefix to be applied to all stats sent to the configured Statsd service +func (s Stats) SetOptionStatsdPrefix(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return s.c.Request("stats/action/setOptionStatsdPrefix/", m) +} + +// Sets whether in memory statistics are enabled +func (s Stats) SetOptionInMemoryEnabled(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return s.c.Request("stats/action/setOptionInMemoryEnabled/", m) +} + +// Sets the Statsd service port +func (s Stats) SetOptionStatsdPort(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return s.c.Request("stats/action/setOptionStatsdPort/", m) +} diff --git a/zap-api-go/zap/users_generated.go b/zap-api-go/zap/users_generated.go new file mode 100644 index 0000000..212efca --- /dev/null +++ b/zap-api-go/zap/users_generated.go @@ -0,0 +1,170 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Users struct { + c *Client +} + +// Gets a list of users that belong to the context with the given ID, or all users if none provided. +func (u Users) UsersList(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return u.c.Request("users/view/usersList/", m) +} + +// Gets the data of the user with the given ID that belongs to the context with the given ID. +func (u Users) GetUserById(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return u.c.Request("users/view/getUserById/", m) +} + +// Gets the configuration parameters for the credentials of the context with the given ID. +func (u Users) GetAuthenticationCredentialsConfigParams(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return u.c.Request("users/view/getAuthenticationCredentialsConfigParams/", m) +} + +// Gets the authentication credentials of the user with given ID that belongs to the context with the given ID. +func (u Users) GetAuthenticationCredentials(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return u.c.Request("users/view/getAuthenticationCredentials/", m) +} + +// Gets the authentication state information for the user identified by the Context and User Ids. +func (u Users) GetAuthenticationState(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return u.c.Request("users/view/getAuthenticationState/", m) +} + +// Gets the authentication session information for the user identified by the Context and User Ids, e.g. cookies and realm credentials. +func (u Users) GetAuthenticationSession(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return u.c.Request("users/view/getAuthenticationSession/", m) +} + +// Creates a new user with the given name for the context with the given ID. +func (u Users) NewUser(contextid string, name string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "name": name, + } + return u.c.Request("users/action/newUser/", m) +} + +// Removes the user with the given ID that belongs to the context with the given ID. +func (u Users) RemoveUser(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return u.c.Request("users/action/removeUser/", m) +} + +// Sets whether or not the user, with the given ID that belongs to the context with the given ID, should be enabled. +func (u Users) SetUserEnabled(contextid string, userid string, enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + "enabled": enabled, + } + return u.c.Request("users/action/setUserEnabled/", m) +} + +// Renames the user with the given ID that belongs to the context with the given ID. +func (u Users) SetUserName(contextid string, userid string, name string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + "name": name, + } + return u.c.Request("users/action/setUserName/", m) +} + +// Sets the authentication credentials for the user with the given ID that belongs to the context with the given ID. +func (u Users) SetAuthenticationCredentials(contextid string, userid string, authcredentialsconfigparams string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + "authCredentialsConfigParams": authcredentialsconfigparams, + } + return u.c.Request("users/action/setAuthenticationCredentials/", m) +} + +// Tries to authenticate as the identified user, returning the authentication request and whether it appears to have succeeded. +func (u Users) AuthenticateAsUser(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return u.c.Request("users/action/authenticateAsUser/", m) +} + +// Tries to poll as the identified user, returning the authentication request and whether it appears to have succeeded. This will only work if the polling verification strategy has been configured. +func (u Users) PollAsUser(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return u.c.Request("users/action/pollAsUser/", m) +} + +// Sets fields in the authentication state for the user identified by the Context and User Ids. +func (u Users) SetAuthenticationState(contextid string, userid string, lastpollresult string, lastpolltimeinms string, requestssincelastpoll string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + "lastPollResult": lastpollresult, + "lastPollTimeInMs": lastpolltimeinms, + "requestsSinceLastPoll": requestssincelastpoll, + } + return u.c.Request("users/action/setAuthenticationState/", m) +} + +// Sets the specified cookie for the user identified by the Context and User Ids. +func (u Users) SetCookie(contextid string, userid string, domain string, name string, value string, path string, secure string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + "domain": domain, + "name": name, + "value": value, + "path": path, + "secure": secure, + } + return u.c.Request("users/action/setCookie/", m) +} From 5425811daa02328a7bd1a5e0f855aa8340bfb617 Mon Sep 17 00:00:00 2001 From: Alessio Dalla Piazza Date: Tue, 2 Jul 2024 12:13:45 +0200 Subject: [PATCH 08/14] delete generated files Signed-off-by: Alessio Dalla Piazza --- zap-api-go/zap/acsrf_generated.go | 71 -- zap-api-go/zap/alert_generated.go | 162 ----- zap-api-go/zap/ascan_generated.go | 617 ---------------- zap-api-go/zap/authentication_generated.go | 91 --- zap-api-go/zap/authorization_generated.go | 46 -- zap-api-go/zap/autoupdate_generated.go | 199 ------ zap-api-go/zap/brk_generated.go | 104 --- zap-api-go/zap/context_generated.go | 202 ------ zap-api-go/zap/core_generated.go | 672 ------------------ zap-api-go/zap/forced-user_generated.go | 58 -- zap-api-go/zap/http-sessions_generated.go | 161 ----- zap-api-go/zap/params_generated.go | 34 - zap-api-go/zap/pscan_generated.go | 130 ---- zap-api-go/zap/rule-config_generated.go | 61 -- zap-api-go/zap/script_generated.go | 212 ------ zap-api-go/zap/search_generated.go | 191 ----- .../zap/session-management_generated.go | 57 -- zap-api-go/zap/stats_generated.go | 118 --- zap-api-go/zap/users_generated.go | 170 ----- 19 files changed, 3356 deletions(-) delete mode 100644 zap-api-go/zap/acsrf_generated.go delete mode 100644 zap-api-go/zap/alert_generated.go delete mode 100644 zap-api-go/zap/ascan_generated.go delete mode 100644 zap-api-go/zap/authentication_generated.go delete mode 100644 zap-api-go/zap/authorization_generated.go delete mode 100644 zap-api-go/zap/autoupdate_generated.go delete mode 100644 zap-api-go/zap/brk_generated.go delete mode 100644 zap-api-go/zap/context_generated.go delete mode 100644 zap-api-go/zap/core_generated.go delete mode 100644 zap-api-go/zap/forced-user_generated.go delete mode 100644 zap-api-go/zap/http-sessions_generated.go delete mode 100644 zap-api-go/zap/params_generated.go delete mode 100644 zap-api-go/zap/pscan_generated.go delete mode 100644 zap-api-go/zap/rule-config_generated.go delete mode 100644 zap-api-go/zap/script_generated.go delete mode 100644 zap-api-go/zap/search_generated.go delete mode 100644 zap-api-go/zap/session-management_generated.go delete mode 100644 zap-api-go/zap/stats_generated.go delete mode 100644 zap-api-go/zap/users_generated.go diff --git a/zap-api-go/zap/acsrf_generated.go b/zap-api-go/zap/acsrf_generated.go deleted file mode 100644 index 1174ea1..0000000 --- a/zap-api-go/zap/acsrf_generated.go +++ /dev/null @@ -1,71 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -import "strconv" - -type Acsrf struct { - c *Client -} - -// Lists the names of all anti-CSRF tokens -func (a Acsrf) OptionTokensNames() (map[string]interface{}, error) { - return a.c.Request("acsrf/view/optionTokensNames/", nil) -} - -// Define if ZAP should detect CSRF tokens by searching for partial matches -func (a Acsrf) OptionPartialMatchingEnabled() (map[string]interface{}, error) { - return a.c.Request("acsrf/view/optionPartialMatchingEnabled/", nil) -} - -// Adds an anti-CSRF token with the given name, enabled by default -func (a Acsrf) AddOptionToken(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return a.c.Request("acsrf/action/addOptionToken/", m) -} - -// Removes the anti-CSRF token with the given name -func (a Acsrf) RemoveOptionToken(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return a.c.Request("acsrf/action/removeOptionToken/", m) -} - -// Define if ZAP should detect CSRF tokens by searching for partial matches. -func (a Acsrf) SetOptionPartialMatchingEnabled(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("acsrf/action/setOptionPartialMatchingEnabled/", m) -} - -// Generate a form for testing lack of anti-CSRF tokens - typically invoked via ZAP -func (a Acsrf) GenForm(hrefid string, actionurl string) ([]byte, error) { - m := map[string]string{ - "hrefId": hrefid, - "actionUrl": actionurl, - } - return a.c.RequestOther("acsrf/other/genForm/", m) -} diff --git a/zap-api-go/zap/alert_generated.go b/zap-api-go/zap/alert_generated.go deleted file mode 100644 index 528e8fe..0000000 --- a/zap-api-go/zap/alert_generated.go +++ /dev/null @@ -1,162 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Alert struct { - c *Client -} - -// Gets the alert with the given ID, the corresponding HTTP message can be obtained with the 'messageId' field and 'message' API method -func (a Alert) Alert(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return a.c.Request("alert/view/alert/", m) -} - -// Gets the alerts raised by ZAP, optionally filtering by URL or riskId, and paginating with 'start' position and 'count' of alerts -func (a Alert) Alerts(baseurl string, start string, count string, riskid string, contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - "start": start, - "count": count, - "riskId": riskid, - "contextName": contextname, - } - return a.c.Request("alert/view/alerts/", m) -} - -// Gets number of alerts grouped by each risk level, optionally filtering by URL -func (a Alert) AlertsSummary(baseurl string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - } - return a.c.Request("alert/view/alertsSummary/", m) -} - -// Gets the number of alerts, optionally filtering by URL or riskId -func (a Alert) NumberOfAlerts(baseurl string, riskid string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - "riskId": riskid, - } - return a.c.Request("alert/view/numberOfAlerts/", m) -} - -// Gets a summary of the alerts, optionally filtered by a 'url'. If 'recurse' is true then all alerts that apply to urls that start with the specified 'url' will be returned, otherwise only those on exactly the same 'url' (ignoring url parameters) -func (a Alert) AlertsByRisk(url string, recurse string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - "recurse": recurse, - } - return a.c.Request("alert/view/alertsByRisk/", m) -} - -// Gets a count of the alerts, optionally filtered as per alertsPerRisk -func (a Alert) AlertCountsByRisk(url string, recurse string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - "recurse": recurse, - } - return a.c.Request("alert/view/alertCountsByRisk/", m) -} - -// Deletes all alerts of the current session. -func (a Alert) DeleteAllAlerts() (map[string]interface{}, error) { - return a.c.Request("alert/action/deleteAllAlerts/", nil) -} - -// Deletes all the alerts optionally filtered by URL which fall within the Context with the provided name, risk, or base URL. -func (a Alert) DeleteAlerts(contextname string, baseurl string, riskid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "baseurl": baseurl, - "riskId": riskid, - } - return a.c.Request("alert/action/deleteAlerts/", m) -} - -// Deletes the alert with the given ID. -func (a Alert) DeleteAlert(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return a.c.Request("alert/action/deleteAlert/", m) -} - -// Update the confidence of the alerts. -func (a Alert) UpdateAlertsConfidence(ids string, confidenceid string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - "confidenceId": confidenceid, - } - return a.c.Request("alert/action/updateAlertsConfidence/", m) -} - -// Update the risk of the alerts. -func (a Alert) UpdateAlertsRisk(ids string, riskid string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - "riskId": riskid, - } - return a.c.Request("alert/action/updateAlertsRisk/", m) -} - -// Update the alert with the given ID, with the provided details. -func (a Alert) UpdateAlert(id string, name string, riskid string, confidenceid string, description string, param string, attack string, otherinfo string, solution string, references string, evidence string, cweid string, wascid string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - "name": name, - "riskId": riskid, - "confidenceId": confidenceid, - "description": description, - "param": param, - "attack": attack, - "otherInfo": otherinfo, - "solution": solution, - "references": references, - "evidence": evidence, - "cweId": cweid, - "wascId": wascid, - } - return a.c.Request("alert/action/updateAlert/", m) -} - -// Add an alert associated with the given message ID, with the provided details. (The ID of the created alert is returned.) -func (a Alert) AddAlert(messageid string, name string, riskid string, confidenceid string, description string, param string, attack string, otherinfo string, solution string, references string, evidence string, cweid string, wascid string) (map[string]interface{}, error) { - m := map[string]string{ - "messageId": messageid, - "name": name, - "riskId": riskid, - "confidenceId": confidenceid, - "description": description, - "param": param, - "attack": attack, - "otherInfo": otherinfo, - "solution": solution, - "references": references, - "evidence": evidence, - "cweId": cweid, - "wascId": wascid, - } - return a.c.Request("alert/action/addAlert/", m) -} diff --git a/zap-api-go/zap/ascan_generated.go b/zap-api-go/zap/ascan_generated.go deleted file mode 100644 index 4ca7b60..0000000 --- a/zap-api-go/zap/ascan_generated.go +++ /dev/null @@ -1,617 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -import "strconv" - -type Ascan struct { - c *Client -} - -func (a Ascan) Status(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/view/status/", m) -} - -func (a Ascan) ScanProgress(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/view/scanProgress/", m) -} - -// Gets the IDs of the messages sent during the scan with the given ID. A message can be obtained with 'message' core view. -func (a Ascan) MessagesIds(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/view/messagesIds/", m) -} - -// Gets the IDs of the alerts raised during the scan with the given ID. An alert can be obtained with 'alert' core view. -func (a Ascan) AlertsIds(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/view/alertsIds/", m) -} - -func (a Ascan) Scans() (map[string]interface{}, error) { - return a.c.Request("ascan/view/scans/", nil) -} - -func (a Ascan) ScanPolicyNames() (map[string]interface{}, error) { - return a.c.Request("ascan/view/scanPolicyNames/", nil) -} - -// Gets the regexes of URLs excluded from the active scans. -func (a Ascan) ExcludedFromScan() (map[string]interface{}, error) { - return a.c.Request("ascan/view/excludedFromScan/", nil) -} - -// Gets the scan rules, optionally, of the given scan policy or scanner policy/category ID. -func (a Ascan) Scanners(scanpolicyname string, policyid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanPolicyName": scanpolicyname, - "policyId": policyid, - } - return a.c.Request("ascan/view/scanners/", m) -} - -func (a Ascan) Policies(scanpolicyname string, policyid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanPolicyName": scanpolicyname, - "policyId": policyid, - } - return a.c.Request("ascan/view/policies/", m) -} - -func (a Ascan) AttackModeQueue() (map[string]interface{}, error) { - return a.c.Request("ascan/view/attackModeQueue/", nil) -} - -// Gets all the parameters that are excluded. For each parameter the following are shown: the name, the URL, and the parameter type. -func (a Ascan) ExcludedParams() (map[string]interface{}, error) { - return a.c.Request("ascan/view/excludedParams/", nil) -} - -// Use view excludedParams instead. -func (a Ascan) OptionExcludedParamList() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionExcludedParamList/", nil) -} - -// Gets all the types of excluded parameters. For each type the following are shown: the ID and the name. -func (a Ascan) ExcludedParamTypes() (map[string]interface{}, error) { - return a.c.Request("ascan/view/excludedParamTypes/", nil) -} - -func (a Ascan) OptionAttackPolicy() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionAttackPolicy/", nil) -} - -func (a Ascan) OptionDefaultPolicy() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionDefaultPolicy/", nil) -} - -func (a Ascan) OptionDelayInMs() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionDelayInMs/", nil) -} - -func (a Ascan) OptionHandleAntiCSRFTokens() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionHandleAntiCSRFTokens/", nil) -} - -func (a Ascan) OptionHostPerScan() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionHostPerScan/", nil) -} - -// Gets the maximum number of alerts that a rule can raise before being skipped. -func (a Ascan) OptionMaxAlertsPerRule() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionMaxAlertsPerRule/", nil) -} - -func (a Ascan) OptionMaxChartTimeInMins() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionMaxChartTimeInMins/", nil) -} - -func (a Ascan) OptionMaxResultsToList() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionMaxResultsToList/", nil) -} - -func (a Ascan) OptionMaxRuleDurationInMins() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionMaxRuleDurationInMins/", nil) -} - -func (a Ascan) OptionMaxScanDurationInMins() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionMaxScanDurationInMins/", nil) -} - -func (a Ascan) OptionMaxScansInUI() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionMaxScansInUI/", nil) -} - -func (a Ascan) OptionTargetParamsEnabledRPC() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionTargetParamsEnabledRPC/", nil) -} - -func (a Ascan) OptionTargetParamsInjectable() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionTargetParamsInjectable/", nil) -} - -func (a Ascan) OptionThreadPerHost() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionThreadPerHost/", nil) -} - -// Tells whether or not the active scanner should add a query parameter to GET request that don't have parameters to start with. -func (a Ascan) OptionAddQueryParam() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionAddQueryParam/", nil) -} - -func (a Ascan) OptionAllowAttackOnStart() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionAllowAttackOnStart/", nil) -} - -// Tells whether or not the active scanner should encode cookie values. -func (a Ascan) OptionEncodeCookieValues() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionEncodeCookieValues/", nil) -} - -// 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. -func (a Ascan) OptionInjectPluginIdInHeader() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionInjectPluginIdInHeader/", nil) -} - -func (a Ascan) OptionPromptInAttackMode() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionPromptInAttackMode/", nil) -} - -func (a Ascan) OptionPromptToClearFinishedScans() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionPromptToClearFinishedScans/", nil) -} - -func (a Ascan) OptionRescanInAttackMode() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionRescanInAttackMode/", nil) -} - -// Tells whether or not the HTTP Headers of all requests should be scanned. Not just requests that send parameters, through the query or request body. -func (a Ascan) OptionScanHeadersAllRequests() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionScanHeadersAllRequests/", nil) -} - -// Tells whether or not the active scanner should scan null JSON values. -func (a Ascan) OptionScanNullJsonValues() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionScanNullJsonValues/", nil) -} - -func (a Ascan) OptionShowAdvancedDialog() (map[string]interface{}, error) { - return a.c.Request("ascan/view/optionShowAdvancedDialog/", nil) -} - -// Runs the active scanner against the given URL or Context. Optionally, the 'recurse' parameter can be used to scan URLs under the given URL, the parameter 'inScopeOnly' can be used to constrain the scan to URLs that are in scope (ignored if a Context is specified), the parameter 'scanPolicyName' allows to specify the scan policy (if none is given it uses the default scan policy), the parameters 'method' and 'postData' allow to select a given request in conjunction with the given URL. -func (a Ascan) Scan(url string, recurse string, inscopeonly string, scanpolicyname string, method string, postdata string, contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - "recurse": recurse, - "inScopeOnly": inscopeonly, - "scanPolicyName": scanpolicyname, - "method": method, - "postData": postdata, - "contextId": contextid, - } - return a.c.Request("ascan/action/scan/", m) -} - -// Active Scans from the perspective of a User, obtained using the given Context ID and User ID. See 'scan' action for more details. -func (a Ascan) ScanAsUser(url string, contextid string, userid string, recurse string, scanpolicyname string, method string, postdata string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - "contextId": contextid, - "userId": userid, - "recurse": recurse, - "scanPolicyName": scanpolicyname, - "method": method, - "postData": postdata, - } - return a.c.Request("ascan/action/scanAsUser/", m) -} - -func (a Ascan) Pause(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/action/pause/", m) -} - -func (a Ascan) Resume(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/action/resume/", m) -} - -func (a Ascan) Stop(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/action/stop/", m) -} - -func (a Ascan) RemoveScan(scanid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - } - return a.c.Request("ascan/action/removeScan/", m) -} - -func (a Ascan) PauseAllScans() (map[string]interface{}, error) { - return a.c.Request("ascan/action/pauseAllScans/", nil) -} - -func (a Ascan) ResumeAllScans() (map[string]interface{}, error) { - return a.c.Request("ascan/action/resumeAllScans/", nil) -} - -func (a Ascan) StopAllScans() (map[string]interface{}, error) { - return a.c.Request("ascan/action/stopAllScans/", nil) -} - -func (a Ascan) RemoveAllScans() (map[string]interface{}, error) { - return a.c.Request("ascan/action/removeAllScans/", nil) -} - -// Clears the regexes of URLs excluded from the active scans. -func (a Ascan) ClearExcludedFromScan() (map[string]interface{}, error) { - return a.c.Request("ascan/action/clearExcludedFromScan/", nil) -} - -// Adds a regex of URLs that should be excluded from the active scans. -func (a Ascan) ExcludeFromScan(regex string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - } - return a.c.Request("ascan/action/excludeFromScan/", m) -} - -// Enables all scan rules of the scan policy with the given name, or the default if none given. -func (a Ascan) EnableAllScanners(scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/enableAllScanners/", m) -} - -// Disables all scan rules of the scan policy with the given name, or the default if none given. -func (a Ascan) DisableAllScanners(scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/disableAllScanners/", m) -} - -// Enables the scan rules with the given IDs (comma separated list of IDs) of the scan policy with the given name, or the default if none given. -func (a Ascan) EnableScanners(ids string, scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/enableScanners/", m) -} - -// Disables the scan rules with the given IDs (comma separated list of IDs) of the scan policy with the given name, or the default if none given. -func (a Ascan) DisableScanners(ids string, scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/disableScanners/", m) -} - -func (a Ascan) SetEnabledPolicies(ids string, scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/setEnabledPolicies/", m) -} - -func (a Ascan) SetPolicyAttackStrength(id string, attackstrength string, scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - "attackStrength": attackstrength, - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/setPolicyAttackStrength/", m) -} - -func (a Ascan) SetPolicyAlertThreshold(id string, alertthreshold string, scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - "alertThreshold": alertthreshold, - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/setPolicyAlertThreshold/", m) -} - -func (a Ascan) SetScannerAttackStrength(id string, attackstrength string, scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - "attackStrength": attackstrength, - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/setScannerAttackStrength/", m) -} - -func (a Ascan) SetScannerAlertThreshold(id string, alertthreshold string, scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - "alertThreshold": alertthreshold, - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/setScannerAlertThreshold/", m) -} - -func (a Ascan) AddScanPolicy(scanpolicyname string, alertthreshold string, attackstrength string) (map[string]interface{}, error) { - m := map[string]string{ - "scanPolicyName": scanpolicyname, - "alertThreshold": alertthreshold, - "attackStrength": attackstrength, - } - return a.c.Request("ascan/action/addScanPolicy/", m) -} - -func (a Ascan) RemoveScanPolicy(scanpolicyname string) (map[string]interface{}, error) { - m := map[string]string{ - "scanPolicyName": scanpolicyname, - } - return a.c.Request("ascan/action/removeScanPolicy/", m) -} - -func (a Ascan) UpdateScanPolicy(scanpolicyname string, alertthreshold string, attackstrength string) (map[string]interface{}, error) { - m := map[string]string{ - "scanPolicyName": scanpolicyname, - "alertThreshold": alertthreshold, - "attackStrength": attackstrength, - } - return a.c.Request("ascan/action/updateScanPolicy/", m) -} - -// Imports a Scan Policy using the given file system path. -func (a Ascan) ImportScanPolicy(path string) (map[string]interface{}, error) { - m := map[string]string{ - "path": path, - } - return a.c.Request("ascan/action/importScanPolicy/", m) -} - -// Adds a new parameter excluded from the scan, using the specified name. Optionally sets if the new entry applies to a specific URL (default, all URLs) and sets the ID of the type of the parameter (default, ID of any type). The type IDs can be obtained with the view excludedParamTypes. -func (a Ascan) AddExcludedParam(name string, t string, url string) (map[string]interface{}, error) { - m := map[string]string{ - "name": name, - "type": t, - "url": url, - } - return a.c.Request("ascan/action/addExcludedParam/", m) -} - -// Modifies a parameter excluded from the scan. Allows to modify the name, the URL and the type of parameter. The parameter is selected with its index, which can be obtained with the view excludedParams. -func (a Ascan) ModifyExcludedParam(idx string, name string, t string, url string) (map[string]interface{}, error) { - m := map[string]string{ - "idx": idx, - "name": name, - "type": t, - "url": url, - } - return a.c.Request("ascan/action/modifyExcludedParam/", m) -} - -// Removes a parameter excluded from the scan, with the given index. The index can be obtained with the view excludedParams. -func (a Ascan) RemoveExcludedParam(idx string) (map[string]interface{}, error) { - m := map[string]string{ - "idx": idx, - } - return a.c.Request("ascan/action/removeExcludedParam/", m) -} - -// Skips the scan rule using the given IDs of the scan and the scan rule. -func (a Ascan) SkipScanner(scanid string, scannerid string) (map[string]interface{}, error) { - m := map[string]string{ - "scanId": scanid, - "scannerId": scannerid, - } - return a.c.Request("ascan/action/skipScanner/", m) -} - -func (a Ascan) SetOptionAttackPolicy(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return a.c.Request("ascan/action/setOptionAttackPolicy/", m) -} - -func (a Ascan) SetOptionDefaultPolicy(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return a.c.Request("ascan/action/setOptionDefaultPolicy/", m) -} - -// Sets whether or not the active scanner should add a query param to GET requests which do not have parameters to start with. -func (a Ascan) SetOptionAddQueryParam(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionAddQueryParam/", m) -} - -func (a Ascan) SetOptionAllowAttackOnStart(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionAllowAttackOnStart/", m) -} - -func (a Ascan) SetOptionDelayInMs(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionDelayInMs/", m) -} - -// Sets whether or not the active scanner should encode cookie values. -func (a Ascan) SetOptionEncodeCookieValues(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionEncodeCookieValues/", m) -} - -func (a Ascan) SetOptionHandleAntiCSRFTokens(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionHandleAntiCSRFTokens/", m) -} - -func (a Ascan) SetOptionHostPerScan(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionHostPerScan/", m) -} - -// Sets 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. -func (a Ascan) SetOptionInjectPluginIdInHeader(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionInjectPluginIdInHeader/", m) -} - -// Sets the maximum number of alerts that a rule can raise before being skipped. -func (a Ascan) SetOptionMaxAlertsPerRule(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionMaxAlertsPerRule/", m) -} - -func (a Ascan) SetOptionMaxChartTimeInMins(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionMaxChartTimeInMins/", m) -} - -func (a Ascan) SetOptionMaxResultsToList(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionMaxResultsToList/", m) -} - -func (a Ascan) SetOptionMaxRuleDurationInMins(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionMaxRuleDurationInMins/", m) -} - -func (a Ascan) SetOptionMaxScanDurationInMins(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionMaxScanDurationInMins/", m) -} - -func (a Ascan) SetOptionMaxScansInUI(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionMaxScansInUI/", m) -} - -func (a Ascan) SetOptionPromptInAttackMode(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionPromptInAttackMode/", m) -} - -func (a Ascan) SetOptionPromptToClearFinishedScans(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionPromptToClearFinishedScans/", m) -} - -func (a Ascan) SetOptionRescanInAttackMode(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionRescanInAttackMode/", m) -} - -// Sets whether or not the HTTP Headers of all requests should be scanned. Not just requests that send parameters, through the query or request body. -func (a Ascan) SetOptionScanHeadersAllRequests(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionScanHeadersAllRequests/", m) -} - -// Sets whether or not the active scanner should scan null JSON values. -func (a Ascan) SetOptionScanNullJsonValues(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionScanNullJsonValues/", m) -} - -func (a Ascan) SetOptionShowAdvancedDialog(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("ascan/action/setOptionShowAdvancedDialog/", m) -} - -func (a Ascan) SetOptionTargetParamsEnabledRPC(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionTargetParamsEnabledRPC/", m) -} - -func (a Ascan) SetOptionTargetParamsInjectable(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionTargetParamsInjectable/", m) -} - -func (a Ascan) SetOptionThreadPerHost(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return a.c.Request("ascan/action/setOptionThreadPerHost/", m) -} diff --git a/zap-api-go/zap/authentication_generated.go b/zap-api-go/zap/authentication_generated.go deleted file mode 100644 index 771edfd..0000000 --- a/zap-api-go/zap/authentication_generated.go +++ /dev/null @@ -1,91 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Authentication struct { - c *Client -} - -// Gets the name of the authentication methods. -func (a Authentication) GetSupportedAuthenticationMethods() (map[string]interface{}, error) { - return a.c.Request("authentication/view/getSupportedAuthenticationMethods/", nil) -} - -// Gets the configuration parameters for the authentication method with the given name. -func (a Authentication) GetAuthenticationMethodConfigParams(authmethodname string) (map[string]interface{}, error) { - m := map[string]string{ - "authMethodName": authmethodname, - } - return a.c.Request("authentication/view/getAuthenticationMethodConfigParams/", m) -} - -// Gets the name of the authentication method for the context with the given ID. -func (a Authentication) GetAuthenticationMethod(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return a.c.Request("authentication/view/getAuthenticationMethod/", m) -} - -// Gets the logged in indicator for the context with the given ID. -func (a Authentication) GetLoggedInIndicator(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return a.c.Request("authentication/view/getLoggedInIndicator/", m) -} - -// Gets the logged out indicator for the context with the given ID. -func (a Authentication) GetLoggedOutIndicator(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return a.c.Request("authentication/view/getLoggedOutIndicator/", m) -} - -// Sets the authentication method for the context with the given ID. -func (a Authentication) SetAuthenticationMethod(contextid string, authmethodname string, authmethodconfigparams string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "authMethodName": authmethodname, - "authMethodConfigParams": authmethodconfigparams, - } - return a.c.Request("authentication/action/setAuthenticationMethod/", m) -} - -// Sets the logged in indicator for the context with the given ID. -func (a Authentication) SetLoggedInIndicator(contextid string, loggedinindicatorregex string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "loggedInIndicatorRegex": loggedinindicatorregex, - } - return a.c.Request("authentication/action/setLoggedInIndicator/", m) -} - -// Sets the logged out indicator for the context with the given ID. -func (a Authentication) SetLoggedOutIndicator(contextid string, loggedoutindicatorregex string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "loggedOutIndicatorRegex": loggedoutindicatorregex, - } - return a.c.Request("authentication/action/setLoggedOutIndicator/", m) -} diff --git a/zap-api-go/zap/authorization_generated.go b/zap-api-go/zap/authorization_generated.go deleted file mode 100644 index dbb8fd6..0000000 --- a/zap-api-go/zap/authorization_generated.go +++ /dev/null @@ -1,46 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Authorization struct { - c *Client -} - -// Obtains all the configuration of the authorization detection method that is currently set for a context. -func (a Authorization) GetAuthorizationDetectionMethod(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return a.c.Request("authorization/view/getAuthorizationDetectionMethod/", m) -} - -// Sets the authorization detection method for a context as one that identifies un-authorized messages based on: the message's status code or a regex pattern in the response's header or body. Also, whether all conditions must match or just some can be specified via the logicalOperator parameter, which accepts two values: "AND" (default), "OR". -func (a Authorization) SetBasicAuthorizationDetectionMethod(contextid string, headerregex string, bodyregex string, statuscode string, logicaloperator string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "headerRegex": headerregex, - "bodyRegex": bodyregex, - "statusCode": statuscode, - "logicalOperator": logicaloperator, - } - return a.c.Request("authorization/action/setBasicAuthorizationDetectionMethod/", m) -} diff --git a/zap-api-go/zap/autoupdate_generated.go b/zap-api-go/zap/autoupdate_generated.go deleted file mode 100644 index 48e40da..0000000 --- a/zap-api-go/zap/autoupdate_generated.go +++ /dev/null @@ -1,199 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -import "strconv" - -type Autoupdate struct { - c *Client -} - -// Returns the latest version number -func (a Autoupdate) LatestVersionNumber() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/latestVersionNumber/", nil) -} - -// Returns 'true' if ZAP is on the latest version -func (a Autoupdate) IsLatestVersion() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/isLatestVersion/", nil) -} - -// Return a list of all of the installed add-ons -func (a Autoupdate) InstalledAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/installedAddons/", nil) -} - -// Returns a list with all local add-ons, installed or not. -func (a Autoupdate) LocalAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/localAddons/", nil) -} - -// Return a list of any add-ons that have been added to the Marketplace since the last check for updates -func (a Autoupdate) NewAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/newAddons/", nil) -} - -// Return a list of any add-ons that have been changed in the Marketplace since the last check for updates -func (a Autoupdate) UpdatedAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/updatedAddons/", nil) -} - -// Return a list of all of the add-ons on the ZAP Marketplace (this information is read once and then cached) -func (a Autoupdate) MarketplaceAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/marketplaceAddons/", nil) -} - -func (a Autoupdate) OptionAddonDirectories() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionAddonDirectories/", nil) -} - -func (a Autoupdate) OptionDayLastChecked() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionDayLastChecked/", nil) -} - -func (a Autoupdate) OptionDayLastInstallWarned() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionDayLastInstallWarned/", nil) -} - -func (a Autoupdate) OptionDayLastUpdateWarned() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionDayLastUpdateWarned/", nil) -} - -func (a Autoupdate) OptionDownloadDirectory() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionDownloadDirectory/", nil) -} - -func (a Autoupdate) OptionCheckAddonUpdates() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionCheckAddonUpdates/", nil) -} - -func (a Autoupdate) OptionCheckOnStart() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionCheckOnStart/", nil) -} - -func (a Autoupdate) OptionDownloadNewRelease() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionDownloadNewRelease/", nil) -} - -func (a Autoupdate) OptionInstallAddonUpdates() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionInstallAddonUpdates/", nil) -} - -func (a Autoupdate) OptionInstallScannerRules() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionInstallScannerRules/", nil) -} - -func (a Autoupdate) OptionReportAlphaAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionReportAlphaAddons/", nil) -} - -func (a Autoupdate) OptionReportBetaAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionReportBetaAddons/", nil) -} - -func (a Autoupdate) OptionReportReleaseAddons() (map[string]interface{}, error) { - return a.c.Request("autoupdate/view/optionReportReleaseAddons/", nil) -} - -// Downloads the latest release, if any -func (a Autoupdate) DownloadLatestRelease() (map[string]interface{}, error) { - return a.c.Request("autoupdate/action/downloadLatestRelease/", nil) -} - -// Installs or updates the specified add-on, returning when complete (i.e. not asynchronously) -func (a Autoupdate) InstallAddon(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return a.c.Request("autoupdate/action/installAddon/", m) -} - -func (a Autoupdate) InstallLocalAddon(file string) (map[string]interface{}, error) { - m := map[string]string{ - "file": file, - } - return a.c.Request("autoupdate/action/installLocalAddon/", m) -} - -// Uninstalls the specified add-on -func (a Autoupdate) UninstallAddon(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return a.c.Request("autoupdate/action/uninstallAddon/", m) -} - -func (a Autoupdate) SetOptionCheckAddonUpdates(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionCheckAddonUpdates/", m) -} - -func (a Autoupdate) SetOptionCheckOnStart(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionCheckOnStart/", m) -} - -func (a Autoupdate) SetOptionDownloadNewRelease(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionDownloadNewRelease/", m) -} - -func (a Autoupdate) SetOptionInstallAddonUpdates(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionInstallAddonUpdates/", m) -} - -func (a Autoupdate) SetOptionInstallScannerRules(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionInstallScannerRules/", m) -} - -func (a Autoupdate) SetOptionReportAlphaAddons(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionReportAlphaAddons/", m) -} - -func (a Autoupdate) SetOptionReportBetaAddons(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionReportBetaAddons/", m) -} - -func (a Autoupdate) SetOptionReportReleaseAddons(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return a.c.Request("autoupdate/action/setOptionReportReleaseAddons/", m) -} diff --git a/zap-api-go/zap/brk_generated.go b/zap-api-go/zap/brk_generated.go deleted file mode 100644 index 5dc1521..0000000 --- a/zap-api-go/zap/brk_generated.go +++ /dev/null @@ -1,104 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Break struct { - c *Client -} - -// Returns True if ZAP will break on both requests and responses -func (b Break) IsBreakAll() (map[string]interface{}, error) { - return b.c.Request("break/view/isBreakAll/", nil) -} - -// Returns True if ZAP will break on requests -func (b Break) IsBreakRequest() (map[string]interface{}, error) { - return b.c.Request("break/view/isBreakRequest/", nil) -} - -// Returns True if ZAP will break on responses -func (b Break) IsBreakResponse() (map[string]interface{}, error) { - return b.c.Request("break/view/isBreakResponse/", nil) -} - -// Returns the HTTP message currently intercepted (if any) -func (b Break) HttpMessage() (map[string]interface{}, error) { - return b.c.Request("break/view/httpMessage/", nil) -} - -// Controls the global break functionality. The type may be one of: http-all, http-request or http-response. The state may be true (for turning break on for the specified type) or false (for turning break off). Scope is not currently used. -func (b Break) Brk(t string, state string, scope string) (map[string]interface{}, error) { - m := map[string]string{ - "type": t, - "state": state, - "scope": scope, - } - return b.c.Request("break/action/break/", m) -} - -// Overwrites the currently intercepted message with the data provided -func (b Break) SetHttpMessage(httpheader string, httpbody string) (map[string]interface{}, error) { - m := map[string]string{ - "httpHeader": httpheader, - "httpBody": httpbody, - } - return b.c.Request("break/action/setHttpMessage/", m) -} - -// Submits the currently intercepted message and unsets the global request/response breakpoints -func (b Break) Cont() (map[string]interface{}, error) { - return b.c.Request("break/action/continue/", nil) -} - -// Submits the currently intercepted message, the next request or response will automatically be intercepted -func (b Break) Step() (map[string]interface{}, error) { - return b.c.Request("break/action/step/", nil) -} - -// Drops the currently intercepted message -func (b Break) Drop() (map[string]interface{}, error) { - return b.c.Request("break/action/drop/", nil) -} - -// Adds a custom HTTP breakpoint. The string is the string to match. Location may be one of: url, request_header, request_body, response_header or response_body. Match may be: contains or regex. Inverse (match) may be true or false. Lastly, ignorecase (when matching the string) may be true or false. -func (b Break) AddHttpBreakpoint(str string, location string, match string, inverse string, ignorecase string) (map[string]interface{}, error) { - m := map[string]string{ - "string": str, - "location": location, - "match": match, - "inverse": inverse, - "ignorecase": ignorecase, - } - return b.c.Request("break/action/addHttpBreakpoint/", m) -} - -// Removes the specified breakpoint -func (b Break) RemoveHttpBreakpoint(str string, location string, match string, inverse string, ignorecase string) (map[string]interface{}, error) { - m := map[string]string{ - "string": str, - "location": location, - "match": match, - "inverse": inverse, - "ignorecase": ignorecase, - } - return b.c.Request("break/action/removeHttpBreakpoint/", m) -} diff --git a/zap-api-go/zap/context_generated.go b/zap-api-go/zap/context_generated.go deleted file mode 100644 index acc5e7d..0000000 --- a/zap-api-go/zap/context_generated.go +++ /dev/null @@ -1,202 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Context struct { - c *Client -} - -// List context names of current session -func (c Context) ContextList() (map[string]interface{}, error) { - return c.c.Request("context/view/contextList/", nil) -} - -// List excluded regexs for context -func (c Context) ExcludeRegexs(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/view/excludeRegexs/", m) -} - -// List included regexs for context -func (c Context) IncludeRegexs(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/view/includeRegexs/", m) -} - -// List the information about the named context -func (c Context) Context(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/view/context/", m) -} - -// Lists the names of all built in technologies -func (c Context) TechnologyList() (map[string]interface{}, error) { - return c.c.Request("context/view/technologyList/", nil) -} - -// Lists the names of all technologies included in a context -func (c Context) IncludedTechnologyList(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/view/includedTechnologyList/", m) -} - -// Lists the names of all technologies excluded from a context -func (c Context) ExcludedTechnologyList(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/view/excludedTechnologyList/", m) -} - -// Lists the URLs accessed through/by ZAP, that belong to the context with the given name. -func (c Context) Urls(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/view/urls/", m) -} - -// Add exclude regex to context -func (c Context) ExcludeFromContext(contextname string, regex string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "regex": regex, - } - return c.c.Request("context/action/excludeFromContext/", m) -} - -// Add include regex to context -func (c Context) IncludeInContext(contextname string, regex string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "regex": regex, - } - return c.c.Request("context/action/includeInContext/", m) -} - -// Set the regexs to include and exclude for a context, both supplied as JSON string arrays -func (c Context) SetContextRegexs(contextname string, incregexs string, excregexs string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "incRegexs": incregexs, - "excRegexs": excregexs, - } - return c.c.Request("context/action/setContextRegexs/", m) -} - -// Set the checking strategy for a context - this defines how ZAP checks that a request is authenticated -func (c Context) SetContextCheckingStrategy(contextname string, checkingstrategy string, pollurl string, polldata string, pollheaders string, pollfrequency string, pollfrequencyunits string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "checkingStrategy": checkingstrategy, - "pollUrl": pollurl, - "pollData": polldata, - "pollHeaders": pollheaders, - "pollFrequency": pollfrequency, - "pollFrequencyUnits": pollfrequencyunits, - } - return c.c.Request("context/action/setContextCheckingStrategy/", m) -} - -// Creates a new context with the given name in the current session -func (c Context) NewContext(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/action/newContext/", m) -} - -// Removes a context in the current session -func (c Context) RemoveContext(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/action/removeContext/", m) -} - -// Exports the context with the given name to a file. If a relative file path is specified it will be resolved against the "contexts" directory in ZAP "home" dir. -func (c Context) ExportContext(contextname string, contextfile string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "contextFile": contextfile, - } - return c.c.Request("context/action/exportContext/", m) -} - -// Imports a context from a file. If a relative file path is specified it will be resolved against the "contexts" directory in ZAP "home" dir. -func (c Context) ImportContext(contextfile string) (map[string]interface{}, error) { - m := map[string]string{ - "contextFile": contextfile, - } - return c.c.Request("context/action/importContext/", m) -} - -// Includes technologies with the given names, separated by a comma, to a context -func (c Context) IncludeContextTechnologies(contextname string, technologynames string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "technologyNames": technologynames, - } - return c.c.Request("context/action/includeContextTechnologies/", m) -} - -// Includes all built in technologies in to a context -func (c Context) IncludeAllContextTechnologies(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/action/includeAllContextTechnologies/", m) -} - -// Excludes technologies with the given names, separated by a comma, from a context -func (c Context) ExcludeContextTechnologies(contextname string, technologynames string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "technologyNames": technologynames, - } - return c.c.Request("context/action/excludeContextTechnologies/", m) -} - -// Excludes all built in technologies from a context -func (c Context) ExcludeAllContextTechnologies(contextname string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - } - return c.c.Request("context/action/excludeAllContextTechnologies/", m) -} - -// Sets a context to in scope (contexts are in scope by default) -func (c Context) SetContextInScope(contextname string, booleaninscope string) (map[string]interface{}, error) { - m := map[string]string{ - "contextName": contextname, - "booleanInScope": booleaninscope, - } - return c.c.Request("context/action/setContextInScope/", m) -} diff --git a/zap-api-go/zap/core_generated.go b/zap-api-go/zap/core_generated.go deleted file mode 100644 index ca7741d..0000000 --- a/zap-api-go/zap/core_generated.go +++ /dev/null @@ -1,672 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -import "strconv" - -type Core struct { - c *Client -} - -// Gets the name of the hosts accessed through/by ZAP -func (c Core) Hosts() (map[string]interface{}, error) { - return c.c.Request("core/view/hosts/", nil) -} - -// Gets the sites accessed through/by ZAP (scheme and domain) -func (c Core) Sites() (map[string]interface{}, error) { - return c.c.Request("core/view/sites/", nil) -} - -// Gets the URLs accessed through/by ZAP, optionally filtering by (base) URL. -func (c Core) Urls(baseurl string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - } - return c.c.Request("core/view/urls/", m) -} - -// Gets the child nodes underneath the specified URL in the Sites tree -func (c Core) ChildNodes(url string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - } - return c.c.Request("core/view/childNodes/", m) -} - -// Gets the HTTP message with the given ID. Returns the ID, request/response headers and bodies, cookies, note, type, RTT, and timestamp. -func (c Core) Message(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return c.c.Request("core/view/message/", m) -} - -// Gets the HTTP messages sent by ZAP, request and response, optionally filtered by URL and paginated with 'start' position and 'count' of messages -func (c Core) Messages(baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - "start": start, - "count": count, - } - return c.c.Request("core/view/messages/", m) -} - -// Gets the HTTP messages with the given IDs. -func (c Core) MessagesById(ids string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - } - return c.c.Request("core/view/messagesById/", m) -} - -// Gets the number of messages, optionally filtering by URL -func (c Core) NumberOfMessages(baseurl string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - } - return c.c.Request("core/view/numberOfMessages/", m) -} - -// Gets the mode -func (c Core) Mode() (map[string]interface{}, error) { - return c.c.Request("core/view/mode/", nil) -} - -// Gets ZAP version -func (c Core) Version() (map[string]interface{}, error) { - return c.c.Request("core/view/version/", nil) -} - -// Gets the regular expressions, applied to URLs, to exclude from the local proxies. -func (c Core) ExcludedFromProxy() (map[string]interface{}, error) { - return c.c.Request("core/view/excludedFromProxy/", nil) -} - -// Gets the location of the current session file -func (c Core) SessionLocation() (map[string]interface{}, error) { - return c.c.Request("core/view/sessionLocation/", nil) -} - -// Gets all the domains that are excluded from the outgoing proxy. For each domain the following are shown: the index, the value (domain), if enabled, and if specified as a regex. -func (c Core) ProxyChainExcludedDomains() (map[string]interface{}, error) { - return c.c.Request("core/view/proxyChainExcludedDomains/", nil) -} - -// Gets the path to ZAP's home directory. -func (c Core) ZapHomePath() (map[string]interface{}, error) { - return c.c.Request("core/view/zapHomePath/", nil) -} - -// Gets the maximum number of alert instances to include in a report. -func (c Core) OptionMaximumAlertInstances() (map[string]interface{}, error) { - return c.c.Request("core/view/optionMaximumAlertInstances/", nil) -} - -// Gets whether or not related alerts will be merged in any reports generated. -func (c Core) OptionMergeRelatedAlerts() (map[string]interface{}, error) { - return c.c.Request("core/view/optionMergeRelatedAlerts/", nil) -} - -// Gets the path to the file with alert overrides. -func (c Core) OptionAlertOverridesFilePath() (map[string]interface{}, error) { - return c.c.Request("core/view/optionAlertOverridesFilePath/", nil) -} - -func (c Core) HomeDirectory() (map[string]interface{}, error) { - return c.c.Request("core/view/homeDirectory/", nil) -} - -// Use view proxyChainExcludedDomains instead. -func (c Core) OptionProxyChainSkipName() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyChainSkipName/", nil) -} - -// Use view proxyChainExcludedDomains instead. -func (c Core) OptionProxyExcludedDomains() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyExcludedDomains/", nil) -} - -// Use view proxyChainExcludedDomains instead. -func (c Core) OptionProxyExcludedDomainsEnabled() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyExcludedDomainsEnabled/", nil) -} - -// Gets the alert with the given ID, the corresponding HTTP message can be obtained with the 'messageId' field and 'message' API method -func (c Core) Alert(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return c.c.Request("core/view/alert/", m) -} - -// Gets the alerts raised by ZAP, optionally filtering by URL or riskId, and paginating with 'start' position and 'count' of alerts -func (c Core) Alerts(baseurl string, start string, count string, riskid string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - "start": start, - "count": count, - "riskId": riskid, - } - return c.c.Request("core/view/alerts/", m) -} - -// Gets number of alerts grouped by each risk level, optionally filtering by URL -func (c Core) AlertsSummary(baseurl string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - } - return c.c.Request("core/view/alertsSummary/", m) -} - -// Gets the number of alerts, optionally filtering by URL or riskId -func (c Core) NumberOfAlerts(baseurl string, riskid string) (map[string]interface{}, error) { - m := map[string]string{ - "baseurl": baseurl, - "riskId": riskid, - } - return c.c.Request("core/view/numberOfAlerts/", m) -} - -// The detailed logging config, optionally filtered based on a name (ex: starts with). -func (c Core) GetLogLevel(name string) (map[string]interface{}, error) { - m := map[string]string{ - "name": name, - } - return c.c.Request("core/view/getLogLevel/", m) -} - -// Gets the user agent that ZAP should use when creating HTTP messages (for example, spider messages or CONNECT requests to outgoing proxy). -func (c Core) OptionDefaultUserAgent() (map[string]interface{}, error) { - return c.c.Request("core/view/optionDefaultUserAgent/", nil) -} - -// Gets the TTL (in seconds) of successful DNS queries. -func (c Core) OptionDnsTtlSuccessfulQueries() (map[string]interface{}, error) { - return c.c.Request("core/view/optionDnsTtlSuccessfulQueries/", nil) -} - -func (c Core) OptionHttpState() (map[string]interface{}, error) { - return c.c.Request("core/view/optionHttpState/", nil) -} - -func (c Core) OptionHttpStateEnabled() (map[string]interface{}, error) { - return c.c.Request("core/view/optionHttpStateEnabled/", nil) -} - -func (c Core) OptionProxyChainName() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyChainName/", nil) -} - -func (c Core) OptionProxyChainPassword() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyChainPassword/", nil) -} - -func (c Core) OptionProxyChainPort() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyChainPort/", nil) -} - -func (c Core) OptionProxyChainPrompt() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyChainPrompt/", nil) -} - -func (c Core) OptionProxyChainRealm() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyChainRealm/", nil) -} - -func (c Core) OptionProxyChainUserName() (map[string]interface{}, error) { - return c.c.Request("core/view/optionProxyChainUserName/", nil) -} - -func (c Core) OptionSingleCookieRequestHeader() (map[string]interface{}, error) { - return c.c.Request("core/view/optionSingleCookieRequestHeader/", nil) -} - -// Gets the connection time out (in seconds). -func (c Core) OptionTimeoutInSecs() (map[string]interface{}, error) { - return c.c.Request("core/view/optionTimeoutInSecs/", nil) -} - -func (c Core) OptionUseProxyChain() (map[string]interface{}, error) { - return c.c.Request("core/view/optionUseProxyChain/", nil) -} - -func (c Core) OptionUseProxyChainAuth() (map[string]interface{}, error) { - return c.c.Request("core/view/optionUseProxyChainAuth/", nil) -} - -// Gets whether or not the SOCKS proxy should be used. -func (c Core) OptionUseSocksProxy() (map[string]interface{}, error) { - return c.c.Request("core/view/optionUseSocksProxy/", nil) -} - -// Convenient and simple action to access a URL, optionally following redirections. Returns the request sent and response received and followed redirections, if any. Other actions are available which offer more control on what is sent, like, 'sendRequest' or 'sendHarRequest'. -func (c Core) AccessUrl(url string, followredirects string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - "followRedirects": followredirects, - } - return c.c.Request("core/action/accessUrl/", m) -} - -// Shuts down ZAP -func (c Core) Shutdown() (map[string]interface{}, error) { - return c.c.Request("core/action/shutdown/", nil) -} - -// Creates a new session, optionally overwriting existing files. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir. -func (c Core) NewSession(name string, overwrite string) (map[string]interface{}, error) { - m := map[string]string{ - "name": name, - "overwrite": overwrite, - } - return c.c.Request("core/action/newSession/", m) -} - -// Loads the session with the given name. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir. -func (c Core) LoadSession(name string) (map[string]interface{}, error) { - m := map[string]string{ - "name": name, - } - return c.c.Request("core/action/loadSession/", m) -} - -// Saves the session. -func (c Core) SaveSession(name string, overwrite string) (map[string]interface{}, error) { - m := map[string]string{ - "name": name, - "overwrite": overwrite, - } - return c.c.Request("core/action/saveSession/", m) -} - -// Snapshots the session, optionally with the given name, and overwriting existing files. If no name is specified the name of the current session with a timestamp appended is used. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir. -func (c Core) SnapshotSession(name string, overwrite string) (map[string]interface{}, error) { - m := map[string]string{ - "name": name, - "overwrite": overwrite, - } - return c.c.Request("core/action/snapshotSession/", m) -} - -// Clears the regexes of URLs excluded from the local proxies. -func (c Core) ClearExcludedFromProxy() (map[string]interface{}, error) { - return c.c.Request("core/action/clearExcludedFromProxy/", nil) -} - -// Adds a regex of URLs that should be excluded from the local proxies. -func (c Core) ExcludeFromProxy(regex string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - } - return c.c.Request("core/action/excludeFromProxy/", m) -} - -func (c Core) SetHomeDirectory(dir string) (map[string]interface{}, error) { - m := map[string]string{ - "dir": dir, - } - return c.c.Request("core/action/setHomeDirectory/", m) -} - -// Sets the mode, which may be one of [safe, protect, standard, attack] -func (c Core) SetMode(mode string) (map[string]interface{}, error) { - m := map[string]string{ - "mode": mode, - } - return c.c.Request("core/action/setMode/", m) -} - -// Generates a new Root CA certificate for the local proxies. -func (c Core) GenerateRootCA() (map[string]interface{}, error) { - return c.c.Request("core/action/generateRootCA/", nil) -} - -// Sends the HTTP request, optionally following redirections. Returns the request sent and response received and followed redirections, if any. The Mode is enforced when sending the request (and following redirections), custom manual requests are not allowed in 'Safe' mode nor in 'Protected' mode if out of scope. -func (c Core) SendRequest(request string, followredirects string) (map[string]interface{}, error) { - m := map[string]string{ - "request": request, - "followRedirects": followredirects, - } - return c.c.Request("core/action/sendRequest/", m) -} - -func (c Core) RunGarbageCollection() (map[string]interface{}, error) { - return c.c.Request("core/action/runGarbageCollection/", nil) -} - -// Deletes the site node found in the Sites Tree on the basis of the URL, HTTP method, and post data (if applicable and specified). -func (c Core) DeleteSiteNode(url string, method string, postdata string) (map[string]interface{}, error) { - m := map[string]string{ - "url": url, - "method": method, - "postData": postdata, - } - return c.c.Request("core/action/deleteSiteNode/", m) -} - -// Adds a domain to be excluded from the outgoing proxy, using the specified value. Optionally sets if the new entry is enabled (default, true) and whether or not the new value is specified as a regex (default, false). -func (c Core) AddProxyChainExcludedDomain(value string, isregex string, isenabled string) (map[string]interface{}, error) { - m := map[string]string{ - "value": value, - "isRegex": isregex, - "isEnabled": isenabled, - } - return c.c.Request("core/action/addProxyChainExcludedDomain/", m) -} - -// Modifies a domain excluded from the outgoing proxy. Allows to modify the value, if enabled or if a regex. The domain is selected with its index, which can be obtained with the view proxyChainExcludedDomains. -func (c Core) ModifyProxyChainExcludedDomain(idx string, value string, isregex string, isenabled string) (map[string]interface{}, error) { - m := map[string]string{ - "idx": idx, - "value": value, - "isRegex": isregex, - "isEnabled": isenabled, - } - return c.c.Request("core/action/modifyProxyChainExcludedDomain/", m) -} - -// Removes a domain excluded from the outgoing proxy, with the given index. The index can be obtained with the view proxyChainExcludedDomains. -func (c Core) RemoveProxyChainExcludedDomain(idx string) (map[string]interface{}, error) { - m := map[string]string{ - "idx": idx, - } - return c.c.Request("core/action/removeProxyChainExcludedDomain/", m) -} - -// Enables all domains excluded from the outgoing proxy. -func (c Core) EnableAllProxyChainExcludedDomains() (map[string]interface{}, error) { - return c.c.Request("core/action/enableAllProxyChainExcludedDomains/", nil) -} - -// Disables all domains excluded from the outgoing proxy. -func (c Core) DisableAllProxyChainExcludedDomains() (map[string]interface{}, error) { - return c.c.Request("core/action/disableAllProxyChainExcludedDomains/", nil) -} - -// Sets the maximum number of alert instances to include in a report. A value of zero is treated as unlimited. -func (c Core) SetOptionMaximumAlertInstances(numberofinstances string) (map[string]interface{}, error) { - m := map[string]string{ - "numberOfInstances": numberofinstances, - } - return c.c.Request("core/action/setOptionMaximumAlertInstances/", m) -} - -// Sets whether or not related alerts will be merged in any reports generated. -func (c Core) SetOptionMergeRelatedAlerts(enabled string) (map[string]interface{}, error) { - m := map[string]string{ - "enabled": enabled, - } - return c.c.Request("core/action/setOptionMergeRelatedAlerts/", m) -} - -// Sets (or clears, if empty) the path to the file with alert overrides. -func (c Core) SetOptionAlertOverridesFilePath(filepath string) (map[string]interface{}, error) { - m := map[string]string{ - "filePath": filepath, - } - return c.c.Request("core/action/setOptionAlertOverridesFilePath/", m) -} - -// Enables use of a PKCS12 client certificate for the certificate with the given file system path, password, and optional index. -func (c Core) EnablePKCS12ClientCertificate(filepath string, password string, index string) (map[string]interface{}, error) { - m := map[string]string{ - "filePath": filepath, - "password": password, - "index": index, - } - return c.c.Request("core/action/enablePKCS12ClientCertificate/", m) -} - -// Disables the option for use of client certificates. -func (c Core) DisableClientCertificate() (map[string]interface{}, error) { - return c.c.Request("core/action/disableClientCertificate/", nil) -} - -// Create a zip file of the ZAP core and add-on SBOMs -func (c Core) CreateSbomZip(filepath string) (map[string]interface{}, error) { - m := map[string]string{ - "filePath": filepath, - } - return c.c.Request("core/action/createSbomZip/", m) -} - -// Deletes all alerts of the current session. -func (c Core) DeleteAllAlerts() (map[string]interface{}, error) { - return c.c.Request("core/action/deleteAllAlerts/", nil) -} - -// Deletes the alert with the given ID. -func (c Core) DeleteAlert(id string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - } - return c.c.Request("core/action/deleteAlert/", m) -} - -// Sets the logging level for a given logger name. -func (c Core) SetLogLevel(name string, loglevel string) (map[string]interface{}, error) { - m := map[string]string{ - "name": name, - "logLevel": loglevel, - } - return c.c.Request("core/action/setLogLevel/", m) -} - -// Sets the user agent that ZAP should use when creating HTTP messages (for example, spider messages or CONNECT requests to outgoing proxy). -func (c Core) SetOptionDefaultUserAgent(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return c.c.Request("core/action/setOptionDefaultUserAgent/", m) -} - -// Sets the TTL (in seconds) of successful DNS queries (applies after ZAP restart). -func (c Core) SetOptionDnsTtlSuccessfulQueries(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return c.c.Request("core/action/setOptionDnsTtlSuccessfulQueries/", m) -} - -func (c Core) SetOptionHttpStateEnabled(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return c.c.Request("core/action/setOptionHttpStateEnabled/", m) -} - -func (c Core) SetOptionProxyChainName(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return c.c.Request("core/action/setOptionProxyChainName/", m) -} - -func (c Core) SetOptionProxyChainPassword(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return c.c.Request("core/action/setOptionProxyChainPassword/", m) -} - -func (c Core) SetOptionProxyChainPort(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return c.c.Request("core/action/setOptionProxyChainPort/", m) -} - -func (c Core) SetOptionProxyChainPrompt(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return c.c.Request("core/action/setOptionProxyChainPrompt/", m) -} - -func (c Core) SetOptionProxyChainRealm(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return c.c.Request("core/action/setOptionProxyChainRealm/", m) -} - -// Use actions [add|modify|remove]ProxyChainExcludedDomain instead. -func (c Core) SetOptionProxyChainSkipName(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return c.c.Request("core/action/setOptionProxyChainSkipName/", m) -} - -func (c Core) SetOptionProxyChainUserName(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return c.c.Request("core/action/setOptionProxyChainUserName/", m) -} - -func (c Core) SetOptionSingleCookieRequestHeader(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return c.c.Request("core/action/setOptionSingleCookieRequestHeader/", m) -} - -// Sets the connection time out (in seconds). -func (c Core) SetOptionTimeoutInSecs(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return c.c.Request("core/action/setOptionTimeoutInSecs/", m) -} - -// Sets whether or not the outgoing proxy should be used. The address/hostname of the outgoing proxy must be set to enable this option. -func (c Core) SetOptionUseProxyChain(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return c.c.Request("core/action/setOptionUseProxyChain/", m) -} - -func (c Core) SetOptionUseProxyChainAuth(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return c.c.Request("core/action/setOptionUseProxyChainAuth/", m) -} - -// Sets whether or not the SOCKS proxy should be used. -func (c Core) SetOptionUseSocksProxy(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return c.c.Request("core/action/setOptionUseSocksProxy/", m) -} - -func (c Core) Proxypac() ([]byte, error) { - return c.c.RequestOther("core/other/proxy.pac/", nil) -} - -// Gets the Root CA certificate used by the local proxies. -func (c Core) Rootcert() ([]byte, error) { - return c.c.RequestOther("core/other/rootcert/", nil) -} - -func (c Core) Setproxy(proxy string) ([]byte, error) { - m := map[string]string{ - "proxy": proxy, - } - return c.c.RequestOther("core/other/setproxy/", m) -} - -// Generates a report in XML format -func (c Core) Xmlreport() ([]byte, error) { - return c.c.RequestOther("core/other/xmlreport/", nil) -} - -// Generates a report in HTML format -func (c Core) Htmlreport() ([]byte, error) { - return c.c.RequestOther("core/other/htmlreport/", nil) -} - -// Generates a report in JSON format -func (c Core) Jsonreport() ([]byte, error) { - return c.c.RequestOther("core/other/jsonreport/", nil) -} - -// Generates a report in Markdown format -func (c Core) Mdreport() ([]byte, error) { - return c.c.RequestOther("core/other/mdreport/", nil) -} - -// Gets the message with the given ID in HAR format -func (c Core) MessageHar(id string) ([]byte, error) { - m := map[string]string{ - "id": id, - } - return c.c.RequestOther("core/other/messageHar/", m) -} - -// Gets the HTTP messages sent through/by ZAP, in HAR format, optionally filtered by URL and paginated with 'start' position and 'count' of messages -func (c Core) MessagesHar(baseurl string, start string, count string) ([]byte, error) { - m := map[string]string{ - "baseurl": baseurl, - "start": start, - "count": count, - } - return c.c.RequestOther("core/other/messagesHar/", m) -} - -// Gets the HTTP messages with the given IDs, in HAR format. -func (c Core) MessagesHarById(ids string) ([]byte, error) { - m := map[string]string{ - "ids": ids, - } - return c.c.RequestOther("core/other/messagesHarById/", m) -} - -// Sends the first HAR request entry, optionally following redirections. Returns, in HAR format, the request sent and response received and followed redirections, if any. The Mode is enforced when sending the request (and following redirections), custom manual requests are not allowed in 'Safe' mode nor in 'Protected' mode if out of scope. -func (c Core) SendHarRequest(request string, followredirects string) ([]byte, error) { - m := map[string]string{ - "request": request, - "followRedirects": followredirects, - } - return c.c.RequestOther("core/other/sendHarRequest/", m) -} - -// Download a file from the transfer directory -func (c Core) FileDownload(filename string) ([]byte, error) { - m := map[string]string{ - "fileName": filename, - } - return c.c.RequestOther("core/other/fileDownload/", m) -} - -// Upload a file to the transfer directory. Only POST requests accepted with encodings of "multipart/form-data" or "application/x-www-form-urlencoded". -func (c Core) FileUpload(filename string, filecontents string) ([]byte, error) { - m := map[string]string{ - "fileName": filename, - "fileContents": filecontents, - } - return c.c.RequestOther("core/other/fileUpload/", m) -} diff --git a/zap-api-go/zap/forced-user_generated.go b/zap-api-go/zap/forced-user_generated.go deleted file mode 100644 index 118386b..0000000 --- a/zap-api-go/zap/forced-user_generated.go +++ /dev/null @@ -1,58 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -import "strconv" - -type ForcedUser struct { - c *Client -} - -// Returns 'true' if 'forced user' mode is enabled, 'false' otherwise -func (f ForcedUser) IsForcedUserModeEnabled() (map[string]interface{}, error) { - return f.c.Request("forcedUser/view/isForcedUserModeEnabled/", nil) -} - -// Gets the user (ID) set as 'forced user' for the given context (ID) -func (f ForcedUser) GetForcedUser(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return f.c.Request("forcedUser/view/getForcedUser/", m) -} - -// Sets the user (ID) that should be used in 'forced user' mode for the given context (ID) -func (f ForcedUser) SetForcedUser(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return f.c.Request("forcedUser/action/setForcedUser/", m) -} - -// Sets if 'forced user' mode should be enabled or not -func (f ForcedUser) SetForcedUserModeEnabled(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "boolean": strconv.FormatBool(boolean), - } - return f.c.Request("forcedUser/action/setForcedUserModeEnabled/", m) -} diff --git a/zap-api-go/zap/http-sessions_generated.go b/zap-api-go/zap/http-sessions_generated.go deleted file mode 100644 index c5ab160..0000000 --- a/zap-api-go/zap/http-sessions_generated.go +++ /dev/null @@ -1,161 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type HttpSessions struct { - c *Client -} - -// Gets all of the sites that have sessions. -func (h HttpSessions) Sites() (map[string]interface{}, error) { - return h.c.Request("httpSessions/view/sites/", nil) -} - -// Gets the sessions for the given site. Optionally returning just the session with the given name. -func (h HttpSessions) Sessions(site string, session string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "session": session, - } - return h.c.Request("httpSessions/view/sessions/", m) -} - -// Gets the name of the active session for the given site. -func (h HttpSessions) ActiveSession(site string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - } - return h.c.Request("httpSessions/view/activeSession/", m) -} - -// Gets the names of the session tokens for the given site. -func (h HttpSessions) SessionTokens(site string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - } - return h.c.Request("httpSessions/view/sessionTokens/", m) -} - -// Gets the default session tokens. -func (h HttpSessions) DefaultSessionTokens() (map[string]interface{}, error) { - return h.c.Request("httpSessions/view/defaultSessionTokens/", nil) -} - -// Creates an empty session for the given site. Optionally with the given name. -func (h HttpSessions) CreateEmptySession(site string, session string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "session": session, - } - return h.c.Request("httpSessions/action/createEmptySession/", m) -} - -// Removes the session from the given site. -func (h HttpSessions) RemoveSession(site string, session string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "session": session, - } - return h.c.Request("httpSessions/action/removeSession/", m) -} - -// Sets the given session as active for the given site. -func (h HttpSessions) SetActiveSession(site string, session string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "session": session, - } - return h.c.Request("httpSessions/action/setActiveSession/", m) -} - -// Unsets the active session of the given site. -func (h HttpSessions) UnsetActiveSession(site string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - } - return h.c.Request("httpSessions/action/unsetActiveSession/", m) -} - -// Adds the session token to the given site. -func (h HttpSessions) AddSessionToken(site string, sessiontoken string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "sessionToken": sessiontoken, - } - return h.c.Request("httpSessions/action/addSessionToken/", m) -} - -// Removes the session token from the given site. -func (h HttpSessions) RemoveSessionToken(site string, sessiontoken string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "sessionToken": sessiontoken, - } - return h.c.Request("httpSessions/action/removeSessionToken/", m) -} - -// Sets the value of the session token of the given session for the given site. -func (h HttpSessions) SetSessionTokenValue(site string, session string, sessiontoken string, tokenvalue string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "session": session, - "sessionToken": sessiontoken, - "tokenValue": tokenvalue, - } - return h.c.Request("httpSessions/action/setSessionTokenValue/", m) -} - -// Renames the session of the given site. -func (h HttpSessions) RenameSession(site string, oldsessionname string, newsessionname string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "oldSessionName": oldsessionname, - "newSessionName": newsessionname, - } - return h.c.Request("httpSessions/action/renameSession/", m) -} - -// Adds a default session token with the given name and enabled state. -func (h HttpSessions) AddDefaultSessionToken(sessiontoken string, tokenenabled string) (map[string]interface{}, error) { - m := map[string]string{ - "sessionToken": sessiontoken, - "tokenEnabled": tokenenabled, - } - return h.c.Request("httpSessions/action/addDefaultSessionToken/", m) -} - -// Sets whether or not the default session token with the given name is enabled. -func (h HttpSessions) SetDefaultSessionTokenEnabled(sessiontoken string, tokenenabled string) (map[string]interface{}, error) { - m := map[string]string{ - "sessionToken": sessiontoken, - "tokenEnabled": tokenenabled, - } - return h.c.Request("httpSessions/action/setDefaultSessionTokenEnabled/", m) -} - -// Removes the default session token with the given name. -func (h HttpSessions) RemoveDefaultSessionToken(sessiontoken string) (map[string]interface{}, error) { - m := map[string]string{ - "sessionToken": sessiontoken, - } - return h.c.Request("httpSessions/action/removeDefaultSessionToken/", m) -} diff --git a/zap-api-go/zap/params_generated.go b/zap-api-go/zap/params_generated.go deleted file mode 100644 index 3504084..0000000 --- a/zap-api-go/zap/params_generated.go +++ /dev/null @@ -1,34 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Params struct { - c *Client -} - -// Shows the parameters for the specified site, or for all sites if the site is not specified -func (p Params) Params(site string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - } - return p.c.Request("params/view/params/", m) -} diff --git a/zap-api-go/zap/pscan_generated.go b/zap-api-go/zap/pscan_generated.go deleted file mode 100644 index 8046f05..0000000 --- a/zap-api-go/zap/pscan_generated.go +++ /dev/null @@ -1,130 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Pscan struct { - c *Client -} - -// Tells whether or not the passive scan should be performed only on messages that are in scope. -func (p Pscan) ScanOnlyInScope() (map[string]interface{}, error) { - return p.c.Request("pscan/view/scanOnlyInScope/", nil) -} - -// The number of records the passive scanner still has to scan -func (p Pscan) RecordsToScan() (map[string]interface{}, error) { - return p.c.Request("pscan/view/recordsToScan/", nil) -} - -// Lists all passive scan rules with their ID, name, enabled state, and alert threshold. -func (p Pscan) Scanners() (map[string]interface{}, error) { - return p.c.Request("pscan/view/scanners/", nil) -} - -// Show information about the passive scan rule currently being run (if any). -func (p Pscan) CurrentRule() (map[string]interface{}, error) { - return p.c.Request("pscan/view/currentRule/", nil) -} - -// Show information about the passive scan tasks currently being run (if any). -func (p Pscan) CurrentTasks() (map[string]interface{}, error) { - return p.c.Request("pscan/view/currentTasks/", nil) -} - -// Gets the maximum number of alerts a passive scan rule should raise. -func (p Pscan) MaxAlertsPerRule() (map[string]interface{}, error) { - return p.c.Request("pscan/view/maxAlertsPerRule/", nil) -} - -// Sets whether or not the passive scanning is enabled (Note: the enabled state is not persisted). -func (p Pscan) SetEnabled(enabled string) (map[string]interface{}, error) { - m := map[string]string{ - "enabled": enabled, - } - return p.c.Request("pscan/action/setEnabled/", m) -} - -// Sets whether or not the passive scan should be performed only on messages that are in scope. -func (p Pscan) SetScanOnlyInScope(onlyinscope string) (map[string]interface{}, error) { - m := map[string]string{ - "onlyInScope": onlyinscope, - } - return p.c.Request("pscan/action/setScanOnlyInScope/", m) -} - -// Enables all passive scan rules -func (p Pscan) EnableAllScanners() (map[string]interface{}, error) { - return p.c.Request("pscan/action/enableAllScanners/", nil) -} - -// Disables all passive scan rules -func (p Pscan) DisableAllScanners() (map[string]interface{}, error) { - return p.c.Request("pscan/action/disableAllScanners/", nil) -} - -// Enables all passive scan rules with the given IDs (comma separated list of IDs) -func (p Pscan) EnableScanners(ids string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - } - return p.c.Request("pscan/action/enableScanners/", m) -} - -// Disables all passive scan rules with the given IDs (comma separated list of IDs) -func (p Pscan) DisableScanners(ids string) (map[string]interface{}, error) { - m := map[string]string{ - "ids": ids, - } - return p.c.Request("pscan/action/disableScanners/", m) -} - -// Sets the alert threshold of the passive scan rule with the given ID, accepted values for alert threshold: OFF, DEFAULT, LOW, MEDIUM and HIGH -func (p Pscan) SetScannerAlertThreshold(id string, alertthreshold string) (map[string]interface{}, error) { - m := map[string]string{ - "id": id, - "alertThreshold": alertthreshold, - } - return p.c.Request("pscan/action/setScannerAlertThreshold/", m) -} - -// Sets the maximum number of alerts a passive scan rule should raise. -func (p Pscan) SetMaxAlertsPerRule(maxalerts string) (map[string]interface{}, error) { - m := map[string]string{ - "maxAlerts": maxalerts, - } - return p.c.Request("pscan/action/setMaxAlertsPerRule/", m) -} - -// Disables all passive scan tags. -func (p Pscan) DisableAllTags() (map[string]interface{}, error) { - return p.c.Request("pscan/action/disableAllTags/", nil) -} - -// Enables all passive scan tags. -func (p Pscan) EnableAllTags() (map[string]interface{}, error) { - return p.c.Request("pscan/action/enableAllTags/", nil) -} - -// Clears the passive scan queue. -func (p Pscan) ClearQueue() (map[string]interface{}, error) { - return p.c.Request("pscan/action/clearQueue/", nil) -} diff --git a/zap-api-go/zap/rule-config_generated.go b/zap-api-go/zap/rule-config_generated.go deleted file mode 100644 index 2c62970..0000000 --- a/zap-api-go/zap/rule-config_generated.go +++ /dev/null @@ -1,61 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type RuleConfig struct { - c *Client -} - -// Show the specified rule configuration -func (r RuleConfig) RuleConfigValue(key string) (map[string]interface{}, error) { - m := map[string]string{ - "key": key, - } - return r.c.Request("ruleConfig/view/ruleConfigValue/", m) -} - -// Show all of the rule configurations -func (r RuleConfig) AllRuleConfigs() (map[string]interface{}, error) { - return r.c.Request("ruleConfig/view/allRuleConfigs/", nil) -} - -// Reset the specified rule configuration, which must already exist -func (r RuleConfig) ResetRuleConfigValue(key string) (map[string]interface{}, error) { - m := map[string]string{ - "key": key, - } - return r.c.Request("ruleConfig/action/resetRuleConfigValue/", m) -} - -// Reset all of the rule configurations -func (r RuleConfig) ResetAllRuleConfigValues() (map[string]interface{}, error) { - return r.c.Request("ruleConfig/action/resetAllRuleConfigValues/", nil) -} - -// Set the specified rule configuration, which must already exist -func (r RuleConfig) SetRuleConfigValue(key string, value string) (map[string]interface{}, error) { - m := map[string]string{ - "key": key, - "value": value, - } - return r.c.Request("ruleConfig/action/setRuleConfigValue/", m) -} diff --git a/zap-api-go/zap/script_generated.go b/zap-api-go/zap/script_generated.go deleted file mode 100644 index 8a78bb5..0000000 --- a/zap-api-go/zap/script_generated.go +++ /dev/null @@ -1,212 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Script struct { - c *Client -} - -// Lists the script engines available -func (s Script) ListEngines() (map[string]interface{}, error) { - return s.c.Request("script/view/listEngines/", nil) -} - -// Lists the script types available. -func (s Script) ListTypes() (map[string]interface{}, error) { - return s.c.Request("script/view/listTypes/", nil) -} - -// Lists the scripts available, with its engine, name, description, type and error state. -func (s Script) ListScripts() (map[string]interface{}, error) { - return s.c.Request("script/view/listScripts/", nil) -} - -// Gets the value of the global variable with the given key. Returns an API error (DOES_NOT_EXIST) if no value was previously set. -func (s Script) GlobalVar(varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "varKey": varkey, - } - return s.c.Request("script/view/globalVar/", m) -} - -// Gets the value (string representation) of a global custom variable. Returns an API error (DOES_NOT_EXIST) if no value was previously set. -func (s Script) GlobalCustomVar(varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "varKey": varkey, - } - return s.c.Request("script/view/globalCustomVar/", m) -} - -// Gets all the global variables (key/value pairs). -func (s Script) GlobalVars() (map[string]interface{}, error) { - return s.c.Request("script/view/globalVars/", nil) -} - -// Gets all the global custom variables (key/value pairs, the value is the string representation). -func (s Script) GlobalCustomVars() (map[string]interface{}, error) { - return s.c.Request("script/view/globalCustomVars/", nil) -} - -// Gets the value of the variable with the given key for the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists or if no value was previously set. -func (s Script) ScriptVar(scriptname string, varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - "varKey": varkey, - } - return s.c.Request("script/view/scriptVar/", m) -} - -// Gets the value (string representation) of a custom variable. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists or if no value was previously set. -func (s Script) ScriptCustomVar(scriptname string, varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - "varKey": varkey, - } - return s.c.Request("script/view/scriptCustomVar/", m) -} - -// Gets all the variables (key/value pairs) of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. -func (s Script) ScriptVars(scriptname string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - } - return s.c.Request("script/view/scriptVars/", m) -} - -// Gets all the custom variables (key/value pairs, the value is the string representation) of a script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. -func (s Script) ScriptCustomVars(scriptname string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - } - return s.c.Request("script/view/scriptCustomVars/", m) -} - -// Enables the script with the given name -func (s Script) Enable(scriptname string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - } - return s.c.Request("script/action/enable/", m) -} - -// Disables the script with the given name -func (s Script) Disable(scriptname string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - } - return s.c.Request("script/action/disable/", m) -} - -// Loads a script into ZAP from the given local file, with the given name, type and engine, optionally with a description, and a charset name to read the script (the charset name is required if the script is not in UTF-8, for example, in ISO-8859-1). -func (s Script) Load(scriptname string, scripttype string, scriptengine string, filename string, scriptdescription string, charset string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - "scriptType": scripttype, - "scriptEngine": scriptengine, - "fileName": filename, - "scriptDescription": scriptdescription, - "charset": charset, - } - return s.c.Request("script/action/load/", m) -} - -// Removes the script with the given name -func (s Script) Remove(scriptname string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - } - return s.c.Request("script/action/remove/", m) -} - -// Runs the stand alone script with the given name -func (s Script) RunStandAloneScript(scriptname string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - } - return s.c.Request("script/action/runStandAloneScript/", m) -} - -// Clears the global variable with the given key. -func (s Script) ClearGlobalVar(varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "varKey": varkey, - } - return s.c.Request("script/action/clearGlobalVar/", m) -} - -// Clears a global custom variable. -func (s Script) ClearGlobalCustomVar(varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "varKey": varkey, - } - return s.c.Request("script/action/clearGlobalCustomVar/", m) -} - -// Clears the global variables. -func (s Script) ClearGlobalVars() (map[string]interface{}, error) { - return s.c.Request("script/action/clearGlobalVars/", nil) -} - -// Clears the variable with the given key of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. -func (s Script) ClearScriptVar(scriptname string, varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - "varKey": varkey, - } - return s.c.Request("script/action/clearScriptVar/", m) -} - -// Clears a script custom variable. -func (s Script) ClearScriptCustomVar(scriptname string, varkey string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - "varKey": varkey, - } - return s.c.Request("script/action/clearScriptCustomVar/", m) -} - -// Clears the variables of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. -func (s Script) ClearScriptVars(scriptname string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - } - return s.c.Request("script/action/clearScriptVars/", m) -} - -// Sets the value of the variable with the given key of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. -func (s Script) SetScriptVar(scriptname string, varkey string, varvalue string) (map[string]interface{}, error) { - m := map[string]string{ - "scriptName": scriptname, - "varKey": varkey, - "varValue": varvalue, - } - return s.c.Request("script/action/setScriptVar/", m) -} - -// Sets the value of the global variable with the given key. -func (s Script) SetGlobalVar(varkey string, varvalue string) (map[string]interface{}, error) { - m := map[string]string{ - "varKey": varkey, - "varValue": varvalue, - } - return s.c.Request("script/action/setGlobalVar/", m) -} diff --git a/zap-api-go/zap/search_generated.go b/zap-api-go/zap/search_generated.go deleted file mode 100644 index 9eae81d..0000000 --- a/zap-api-go/zap/search_generated.go +++ /dev/null @@ -1,191 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Search struct { - c *Client -} - -// Returns the URLs of the HTTP messages that match the given regular expression in the URL optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) UrlsByUrlRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/urlsByUrlRegex/", m) -} - -// 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. -func (s Search) UrlsByTagRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/urlsByTagRegex/", m) -} - -// 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. -func (s Search) UrlsByRequestRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/urlsByRequestRegex/", m) -} - -// Returns the URLs of the HTTP messages that match the given regular expression in the response optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) UrlsByResponseRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/urlsByResponseRegex/", m) -} - -// Returns the URLs of the HTTP messages that match the given regular expression in the header(s) optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) UrlsByHeaderRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/urlsByHeaderRegex/", m) -} - -// Returns the HTTP messages that match the given regular expression in the URL optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) MessagesByUrlRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/messagesByUrlRegex/", m) -} - -// 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. -func (s Search) MessagesByTagRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/messagesByTagRegex/", m) -} - -// 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. -func (s Search) MessagesByRequestRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/messagesByRequestRegex/", m) -} - -// Returns the HTTP messages that match the given regular expression in the response optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) MessagesByResponseRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/messagesByResponseRegex/", m) -} - -// Returns the HTTP messages that match the given regular expression in the header(s) optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) MessagesByHeaderRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.Request("search/view/messagesByHeaderRegex/", m) -} - -// Returns the HTTP messages, in HAR format, that match the given regular expression in the URL optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) HarByUrlRegex(regex string, baseurl string, start string, count string) ([]byte, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.RequestOther("search/other/harByUrlRegex/", m) -} - -// 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. -func (s Search) HarByTagRegex(regex string, baseurl string, start string, count string) ([]byte, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.RequestOther("search/other/harByTagRegex/", m) -} - -// 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. -func (s Search) HarByRequestRegex(regex string, baseurl string, start string, count string) ([]byte, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.RequestOther("search/other/harByRequestRegex/", m) -} - -// Returns the HTTP messages, in HAR format, that match the given regular expression in the response optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) HarByResponseRegex(regex string, baseurl string, start string, count string) ([]byte, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.RequestOther("search/other/harByResponseRegex/", m) -} - -// Returns the HTTP messages, in HAR format, that match the given regular expression in the header(s) optionally filtered by URL and paginated with 'start' position and 'count' of messages. -func (s Search) HarByHeaderRegex(regex string, baseurl string, start string, count string) ([]byte, error) { - m := map[string]string{ - "regex": regex, - "baseurl": baseurl, - "start": start, - "count": count, - } - return s.c.RequestOther("search/other/harByHeaderRegex/", m) -} diff --git a/zap-api-go/zap/session-management_generated.go b/zap-api-go/zap/session-management_generated.go deleted file mode 100644 index 50ae76b..0000000 --- a/zap-api-go/zap/session-management_generated.go +++ /dev/null @@ -1,57 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type SessionManagement struct { - c *Client -} - -// Gets the name of the session management methods. -func (s SessionManagement) GetSupportedSessionManagementMethods() (map[string]interface{}, error) { - return s.c.Request("sessionManagement/view/getSupportedSessionManagementMethods/", nil) -} - -// Gets the configuration parameters for the session management method with the given name. -func (s SessionManagement) GetSessionManagementMethodConfigParams(methodname string) (map[string]interface{}, error) { - m := map[string]string{ - "methodName": methodname, - } - return s.c.Request("sessionManagement/view/getSessionManagementMethodConfigParams/", m) -} - -// Gets the name of the session management method for the context with the given ID. -func (s SessionManagement) GetSessionManagementMethod(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return s.c.Request("sessionManagement/view/getSessionManagementMethod/", m) -} - -// Sets the session management method for the context with the given ID. -func (s SessionManagement) SetSessionManagementMethod(contextid string, methodname string, methodconfigparams string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "methodName": methodname, - "methodConfigParams": methodconfigparams, - } - return s.c.Request("sessionManagement/action/setSessionManagementMethod/", m) -} diff --git a/zap-api-go/zap/stats_generated.go b/zap-api-go/zap/stats_generated.go deleted file mode 100644 index ea96b6e..0000000 --- a/zap-api-go/zap/stats_generated.go +++ /dev/null @@ -1,118 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -import "strconv" - -type Stats struct { - c *Client -} - -// Statistics -func (s Stats) Stats(keyprefix string) (map[string]interface{}, error) { - m := map[string]string{ - "keyPrefix": keyprefix, - } - return s.c.Request("stats/view/stats/", m) -} - -// Gets all of the site based statistics, optionally filtered by a key prefix -func (s Stats) AllSitesStats(keyprefix string) (map[string]interface{}, error) { - m := map[string]string{ - "keyPrefix": keyprefix, - } - return s.c.Request("stats/view/allSitesStats/", m) -} - -// Gets all of the global statistics, optionally filtered by a key prefix -func (s Stats) SiteStats(site string, keyprefix string) (map[string]interface{}, error) { - m := map[string]string{ - "site": site, - "keyPrefix": keyprefix, - } - return s.c.Request("stats/view/siteStats/", m) -} - -// Gets the Statsd service hostname -func (s Stats) OptionStatsdHost() (map[string]interface{}, error) { - return s.c.Request("stats/view/optionStatsdHost/", nil) -} - -// Gets the Statsd service port -func (s Stats) OptionStatsdPort() (map[string]interface{}, error) { - return s.c.Request("stats/view/optionStatsdPort/", nil) -} - -// Gets the prefix to be applied to all stats sent to the configured Statsd service -func (s Stats) OptionStatsdPrefix() (map[string]interface{}, error) { - return s.c.Request("stats/view/optionStatsdPrefix/", nil) -} - -// Returns 'true' if in memory statistics are enabled, otherwise returns 'false' -func (s Stats) OptionInMemoryEnabled() (map[string]interface{}, error) { - return s.c.Request("stats/view/optionInMemoryEnabled/", nil) -} - -// Returns 'true' if a Statsd server has been correctly configured, otherwise returns 'false' -func (s Stats) OptionStatsdEnabled() (map[string]interface{}, error) { - return s.c.Request("stats/view/optionStatsdEnabled/", nil) -} - -// Clears all of the statistics -func (s Stats) ClearStats(keyprefix string) (map[string]interface{}, error) { - m := map[string]string{ - "keyPrefix": keyprefix, - } - return s.c.Request("stats/action/clearStats/", m) -} - -// Sets the Statsd service hostname, supply an empty string to stop using a Statsd service -func (s Stats) SetOptionStatsdHost(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return s.c.Request("stats/action/setOptionStatsdHost/", m) -} - -// Sets the prefix to be applied to all stats sent to the configured Statsd service -func (s Stats) SetOptionStatsdPrefix(str string) (map[string]interface{}, error) { - m := map[string]string{ - "String": str, - } - return s.c.Request("stats/action/setOptionStatsdPrefix/", m) -} - -// Sets whether in memory statistics are enabled -func (s Stats) SetOptionInMemoryEnabled(boolean bool) (map[string]interface{}, error) { - m := map[string]string{ - "Boolean": strconv.FormatBool(boolean), - } - return s.c.Request("stats/action/setOptionInMemoryEnabled/", m) -} - -// Sets the Statsd service port -func (s Stats) SetOptionStatsdPort(i int) (map[string]interface{}, error) { - m := map[string]string{ - "Integer": strconv.Itoa(i), - } - return s.c.Request("stats/action/setOptionStatsdPort/", m) -} diff --git a/zap-api-go/zap/users_generated.go b/zap-api-go/zap/users_generated.go deleted file mode 100644 index 212efca..0000000 --- a/zap-api-go/zap/users_generated.go +++ /dev/null @@ -1,170 +0,0 @@ -// Zed Attack Proxy (ZAP) and its related class files. -// -// ZAP is an HTTP/HTTPS proxy for assessing web application security. -// -// Copyright 2017 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. -// -// *** This file was automatically generated. *** -// - -package zap - -type Users struct { - c *Client -} - -// Gets a list of users that belong to the context with the given ID, or all users if none provided. -func (u Users) UsersList(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return u.c.Request("users/view/usersList/", m) -} - -// Gets the data of the user with the given ID that belongs to the context with the given ID. -func (u Users) GetUserById(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return u.c.Request("users/view/getUserById/", m) -} - -// Gets the configuration parameters for the credentials of the context with the given ID. -func (u Users) GetAuthenticationCredentialsConfigParams(contextid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - } - return u.c.Request("users/view/getAuthenticationCredentialsConfigParams/", m) -} - -// Gets the authentication credentials of the user with given ID that belongs to the context with the given ID. -func (u Users) GetAuthenticationCredentials(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return u.c.Request("users/view/getAuthenticationCredentials/", m) -} - -// Gets the authentication state information for the user identified by the Context and User Ids. -func (u Users) GetAuthenticationState(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return u.c.Request("users/view/getAuthenticationState/", m) -} - -// Gets the authentication session information for the user identified by the Context and User Ids, e.g. cookies and realm credentials. -func (u Users) GetAuthenticationSession(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return u.c.Request("users/view/getAuthenticationSession/", m) -} - -// Creates a new user with the given name for the context with the given ID. -func (u Users) NewUser(contextid string, name string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "name": name, - } - return u.c.Request("users/action/newUser/", m) -} - -// Removes the user with the given ID that belongs to the context with the given ID. -func (u Users) RemoveUser(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return u.c.Request("users/action/removeUser/", m) -} - -// Sets whether or not the user, with the given ID that belongs to the context with the given ID, should be enabled. -func (u Users) SetUserEnabled(contextid string, userid string, enabled string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - "enabled": enabled, - } - return u.c.Request("users/action/setUserEnabled/", m) -} - -// Renames the user with the given ID that belongs to the context with the given ID. -func (u Users) SetUserName(contextid string, userid string, name string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - "name": name, - } - return u.c.Request("users/action/setUserName/", m) -} - -// Sets the authentication credentials for the user with the given ID that belongs to the context with the given ID. -func (u Users) SetAuthenticationCredentials(contextid string, userid string, authcredentialsconfigparams string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - "authCredentialsConfigParams": authcredentialsconfigparams, - } - return u.c.Request("users/action/setAuthenticationCredentials/", m) -} - -// Tries to authenticate as the identified user, returning the authentication request and whether it appears to have succeeded. -func (u Users) AuthenticateAsUser(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return u.c.Request("users/action/authenticateAsUser/", m) -} - -// Tries to poll as the identified user, returning the authentication request and whether it appears to have succeeded. This will only work if the polling verification strategy has been configured. -func (u Users) PollAsUser(contextid string, userid string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - } - return u.c.Request("users/action/pollAsUser/", m) -} - -// Sets fields in the authentication state for the user identified by the Context and User Ids. -func (u Users) SetAuthenticationState(contextid string, userid string, lastpollresult string, lastpolltimeinms string, requestssincelastpoll string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - "lastPollResult": lastpollresult, - "lastPollTimeInMs": lastpolltimeinms, - "requestsSinceLastPoll": requestssincelastpoll, - } - return u.c.Request("users/action/setAuthenticationState/", m) -} - -// Sets the specified cookie for the user identified by the Context and User Ids. -func (u Users) SetCookie(contextid string, userid string, domain string, name string, value string, path string, secure string) (map[string]interface{}, error) { - m := map[string]string{ - "contextId": contextid, - "userId": userid, - "domain": domain, - "name": name, - "value": value, - "path": path, - "secure": secure, - } - return u.c.Request("users/action/setCookie/", m) -} From cc0d765b412aabec62d7791dd92c2507186356ec Mon Sep 17 00:00:00 2001 From: Alessio Dalla Piazza Date: Tue, 2 Jul 2024 12:13:55 +0200 Subject: [PATCH 09/14] improve README.md Signed-off-by: Alessio Dalla Piazza --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index d30880f..a397e07 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,6 @@ The add-on APIs can be generated from the zap-extensions main branch: ``` cd zap-extensions -git pull upstream main ./gradlew generateGoZapApiClientFiles --continue cd .. ``` From bcfe2b619ff29858ab83a7fccde512acd0114595 Mon Sep 17 00:00:00 2001 From: Alessio Dalla Piazza Date: Tue, 2 Jul 2024 12:15:28 +0200 Subject: [PATCH 10/14] remove .idea folder Signed-off-by: Alessio Dalla Piazza --- .idea/.gitignore | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml From 00781ca428f39996398eb45e649cce14d8333328 Mon Sep 17 00:00:00 2001 From: Alessio Dalla Piazza Date: Tue, 2 Jul 2024 12:36:37 +0200 Subject: [PATCH 11/14] update apis and improve README.md Signed-off-by: Alessio Dalla Piazza --- zap-api-go/zap/access-control_generated.go | 71 ++ zap-api-go/zap/acsrf_generated.go | 71 ++ zap-api-go/zap/ajax-spider_generated.go | 358 ++++++++++ zap-api-go/zap/alert-filter_generated.go | 171 +++++ zap-api-go/zap/alert_generated.go | 162 +++++ zap-api-go/zap/ascan_generated.go | 617 ++++++++++++++++ zap-api-go/zap/authentication_generated.go | 91 +++ zap-api-go/zap/authorization_generated.go | 46 ++ zap-api-go/zap/automation_generated.go | 47 ++ zap-api-go/zap/autoupdate_generated.go | 199 ++++++ zap-api-go/zap/brk_generated.go | 104 +++ zap-api-go/zap/context_generated.go | 202 ++++++ zap-api-go/zap/core_generated.go | 672 ++++++++++++++++++ zap-api-go/zap/custompayloads_generated.go | 107 +++ zap-api-go/zap/exim_generated.go | 99 +++ zap-api-go/zap/forced-user_generated.go | 58 ++ zap-api-go/zap/graphql_generated.go | 203 ++++++ zap-api-go/zap/http-sessions_generated.go | 161 +++++ zap-api-go/zap/interface.go | 246 +++++++ zap-api-go/zap/network_generated.go | 479 +++++++++++++ zap-api-go/zap/openapi_generated.go | 50 ++ zap-api-go/zap/params_generated.go | 34 + zap-api-go/zap/pnh_generated.go | 79 ++ zap-api-go/zap/postman_generated.go | 44 ++ zap-api-go/zap/pscan_generated.go | 164 +++++ zap-api-go/zap/replacer_generated.go | 71 ++ zap-api-go/zap/reports_generated.go | 65 ++ zap-api-go/zap/retest_generated.go | 34 + zap-api-go/zap/reveal_generated.go | 43 ++ zap-api-go/zap/revisit_generated.go | 49 ++ zap-api-go/zap/rule-config_generated.go | 61 ++ zap-api-go/zap/script_generated.go | 260 +++++++ zap-api-go/zap/search_generated.go | 191 +++++ zap-api-go/zap/selenium_generated.go | 196 +++++ .../zap/session-management_generated.go | 57 ++ zap-api-go/zap/soap_generated.go | 46 ++ zap-api-go/zap/spider_generated.go | 555 +++++++++++++++ zap-api-go/zap/stats_generated.go | 118 +++ zap-api-go/zap/users_generated.go | 170 +++++ zap-api-go/zap/wappalyzer_generated.go | 50 ++ zap-api-go/zap/websocket_generated.go | 87 +++ 41 files changed, 6588 insertions(+) create mode 100644 zap-api-go/zap/access-control_generated.go create mode 100644 zap-api-go/zap/acsrf_generated.go create mode 100644 zap-api-go/zap/ajax-spider_generated.go create mode 100644 zap-api-go/zap/alert-filter_generated.go create mode 100644 zap-api-go/zap/alert_generated.go create mode 100644 zap-api-go/zap/ascan_generated.go create mode 100644 zap-api-go/zap/authentication_generated.go create mode 100644 zap-api-go/zap/authorization_generated.go create mode 100644 zap-api-go/zap/automation_generated.go create mode 100644 zap-api-go/zap/autoupdate_generated.go create mode 100644 zap-api-go/zap/brk_generated.go create mode 100644 zap-api-go/zap/context_generated.go create mode 100644 zap-api-go/zap/core_generated.go create mode 100644 zap-api-go/zap/custompayloads_generated.go create mode 100644 zap-api-go/zap/exim_generated.go create mode 100644 zap-api-go/zap/forced-user_generated.go create mode 100644 zap-api-go/zap/graphql_generated.go create mode 100644 zap-api-go/zap/http-sessions_generated.go create mode 100644 zap-api-go/zap/interface.go create mode 100644 zap-api-go/zap/network_generated.go create mode 100644 zap-api-go/zap/openapi_generated.go create mode 100644 zap-api-go/zap/params_generated.go create mode 100644 zap-api-go/zap/pnh_generated.go create mode 100644 zap-api-go/zap/postman_generated.go create mode 100644 zap-api-go/zap/pscan_generated.go create mode 100644 zap-api-go/zap/replacer_generated.go create mode 100644 zap-api-go/zap/reports_generated.go create mode 100644 zap-api-go/zap/retest_generated.go create mode 100644 zap-api-go/zap/reveal_generated.go create mode 100644 zap-api-go/zap/revisit_generated.go create mode 100644 zap-api-go/zap/rule-config_generated.go create mode 100644 zap-api-go/zap/script_generated.go create mode 100644 zap-api-go/zap/search_generated.go create mode 100644 zap-api-go/zap/selenium_generated.go create mode 100644 zap-api-go/zap/session-management_generated.go create mode 100644 zap-api-go/zap/soap_generated.go create mode 100644 zap-api-go/zap/spider_generated.go create mode 100644 zap-api-go/zap/stats_generated.go create mode 100644 zap-api-go/zap/users_generated.go create mode 100644 zap-api-go/zap/wappalyzer_generated.go create mode 100644 zap-api-go/zap/websocket_generated.go diff --git a/zap-api-go/zap/access-control_generated.go b/zap-api-go/zap/access-control_generated.go new file mode 100644 index 0000000..6bb7c3e --- /dev/null +++ b/zap-api-go/zap/access-control_generated.go @@ -0,0 +1,71 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type AccessControl struct { + c *Client +} + +// Gets the Access Control scan progress (percentage integer) for the given context ID. +// +// This component is optional and therefore the API will only work if it is installed +func (a AccessControl) GetScanProgress(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return a.c.Request("accessControl/view/getScanProgress/", m) +} + +// Gets the Access Control scan status (description string) for the given context ID. +// +// This component is optional and therefore the API will only work if it is installed +func (a AccessControl) GetScanStatus(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return a.c.Request("accessControl/view/getScanStatus/", m) +} + +// Starts an Access Control scan with the given context ID and user ID. (Optional parameters: user ID for Unauthenticated user, boolean identifying whether or not Alerts are raised, and the Risk level for the Alerts.) [This assumes the Access Control rules were previously established via ZAP gui and the necessary Context exported/imported.] +// +// This component is optional and therefore the API will only work if it is installed +func (a AccessControl) Scan(contextid string, userid string, scanasunauthuser string, raisealert string, alertrisklevel string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + "scanAsUnAuthUser": scanasunauthuser, + "raiseAlert": raisealert, + "alertRiskLevel": alertrisklevel, + } + return a.c.Request("accessControl/action/scan/", m) +} + +// Generates an Access Control report for the given context ID and saves it based on the provided filename (path). +// +// This component is optional and therefore the API will only work if it is installed +func (a AccessControl) WriteHTMLreport(contextid string, filename string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "fileName": filename, + } + return a.c.Request("accessControl/action/writeHTMLreport/", m) +} diff --git a/zap-api-go/zap/acsrf_generated.go b/zap-api-go/zap/acsrf_generated.go new file mode 100644 index 0000000..1174ea1 --- /dev/null +++ b/zap-api-go/zap/acsrf_generated.go @@ -0,0 +1,71 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +import "strconv" + +type Acsrf struct { + c *Client +} + +// Lists the names of all anti-CSRF tokens +func (a Acsrf) OptionTokensNames() (map[string]interface{}, error) { + return a.c.Request("acsrf/view/optionTokensNames/", nil) +} + +// Define if ZAP should detect CSRF tokens by searching for partial matches +func (a Acsrf) OptionPartialMatchingEnabled() (map[string]interface{}, error) { + return a.c.Request("acsrf/view/optionPartialMatchingEnabled/", nil) +} + +// Adds an anti-CSRF token with the given name, enabled by default +func (a Acsrf) AddOptionToken(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return a.c.Request("acsrf/action/addOptionToken/", m) +} + +// Removes the anti-CSRF token with the given name +func (a Acsrf) RemoveOptionToken(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return a.c.Request("acsrf/action/removeOptionToken/", m) +} + +// Define if ZAP should detect CSRF tokens by searching for partial matches. +func (a Acsrf) SetOptionPartialMatchingEnabled(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("acsrf/action/setOptionPartialMatchingEnabled/", m) +} + +// Generate a form for testing lack of anti-CSRF tokens - typically invoked via ZAP +func (a Acsrf) GenForm(hrefid string, actionurl string) ([]byte, error) { + m := map[string]string{ + "hrefId": hrefid, + "actionUrl": actionurl, + } + return a.c.RequestOther("acsrf/other/genForm/", m) +} diff --git a/zap-api-go/zap/ajax-spider_generated.go b/zap-api-go/zap/ajax-spider_generated.go new file mode 100644 index 0000000..b80f48a --- /dev/null +++ b/zap-api-go/zap/ajax-spider_generated.go @@ -0,0 +1,358 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +import "strconv" + +type AjaxSpider struct { + c *Client +} + +// Gets the allowed resources. The allowed resources are always fetched even if out of scope, allowing to include necessary resources (e.g. scripts) from 3rd-parties. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) AllowedResources() (map[string]interface{}, error) { + return a.c.Request("ajaxSpider/view/allowedResources/", nil) +} + +// Gets the excluded elements. The excluded elements are not clicked during crawling, for example, to prevent logging out. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) ExcludedElements(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return a.c.Request("ajaxSpider/view/excludedElements/", m) +} + +// Gets the current status of the crawler. Actual values are Stopped and Running. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) Status() (map[string]interface{}, error) { + return a.c.Request("ajaxSpider/view/status/", nil) +} + +// Gets the current results of the crawler. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) Results(start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "start": start, + "count": count, + } + return a.c.Request("ajaxSpider/view/results/", m) +} + +// Gets the number of resources found. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) NumberOfResults() (map[string]interface{}, error) { + return a.c.Request("ajaxSpider/view/numberOfResults/", nil) +} + +// Gets the full crawled content detected by the AJAX Spider. Returns a set of values based on 'inScope' URLs, 'outOfScope' URLs, and 'errors' encountered during the last/current run of the AJAX Spider. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) FullResults() (map[string]interface{}, error) { + return a.c.Request("ajaxSpider/view/fullResults/", nil) +} + +// Gets the configured browser to use for crawling. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) OptionBrowserId() (map[string]interface{}, error) { + return a.c.Request("ajaxSpider/view/optionBrowserId/", nil) +} + +// Gets 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. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) OptionEventWait() (map[string]interface{}, error) { + return a.c.Request("ajaxSpider/view/optionEventWait/", nil) +} + +// Gets the configured value for the max crawl depth. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) OptionMaxCrawlDepth() (map[string]interface{}, error) { + return a.c.Request("ajaxSpider/view/optionMaxCrawlDepth/", nil) +} + +// Gets the configured value for the maximum crawl states allowed. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) OptionMaxCrawlStates() (map[string]interface{}, error) { + return a.c.Request("ajaxSpider/view/optionMaxCrawlStates/", nil) +} + +// Gets the configured max duration of the crawl, the value is in minutes. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) OptionMaxDuration() (map[string]interface{}, error) { + return a.c.Request("ajaxSpider/view/optionMaxDuration/", nil) +} + +// Gets the configured number of browsers to be used. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) OptionNumberOfBrowsers() (map[string]interface{}, error) { + return a.c.Request("ajaxSpider/view/optionNumberOfBrowsers/", nil) +} + +// Gets the configured time to wait after reloading the page, this value is in milliseconds. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) OptionReloadWait() (map[string]interface{}, error) { + return a.c.Request("ajaxSpider/view/optionReloadWait/", nil) +} + +// Gets the configured value for 'Click Default Elements Only', HTML elements such as 'a', 'button', 'input', all associated with some action or links on the page. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) OptionClickDefaultElems() (map[string]interface{}, error) { + return a.c.Request("ajaxSpider/view/optionClickDefaultElems/", nil) +} + +// Gets the value configured for the AJAX Spider to know if it should click on the elements only once. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) OptionClickElemsOnce() (map[string]interface{}, error) { + return a.c.Request("ajaxSpider/view/optionClickElemsOnce/", nil) +} + +// Gets if the AJAX Spider will use random values in form fields when crawling, if set to true. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) OptionRandomInputs() (map[string]interface{}, error) { + return a.c.Request("ajaxSpider/view/optionRandomInputs/", nil) +} + +// Runs the AJAX Spider against a given target. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) Scan(url string, inscope string, contextname string, subtreeonly string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "inScope": inscope, + "contextName": contextname, + "subtreeOnly": subtreeonly, + } + return a.c.Request("ajaxSpider/action/scan/", m) +} + +// Runs the AJAX Spider from the perspective of a User of the web application. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) ScanAsUser(contextname string, username string, url string, subtreeonly string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "userName": username, + "url": url, + "subtreeOnly": subtreeonly, + } + return a.c.Request("ajaxSpider/action/scanAsUser/", m) +} + +// Stops the AJAX Spider. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) Stop() (map[string]interface{}, error) { + return a.c.Request("ajaxSpider/action/stop/", nil) +} + +// Adds an allowed resource. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) AddAllowedResource(regex string, enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "enabled": enabled, + } + return a.c.Request("ajaxSpider/action/addAllowedResource/", m) +} + +// Adds an excluded element to a context. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) AddExcludedElement(contextname string, description string, element string, xpath string, text string, attributename string, attributevalue string, enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "description": description, + "element": element, + "xpath": xpath, + "text": text, + "attributeName": attributename, + "attributeValue": attributevalue, + "enabled": enabled, + } + return a.c.Request("ajaxSpider/action/addExcludedElement/", m) +} + +// Modifies an excluded element of a context. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) ModifyExcludedElement(contextname string, description string, element string, descriptionnew string, xpath string, text string, attributename string, attributevalue string, enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "description": description, + "element": element, + "descriptionNew": descriptionnew, + "xpath": xpath, + "text": text, + "attributeName": attributename, + "attributeValue": attributevalue, + "enabled": enabled, + } + return a.c.Request("ajaxSpider/action/modifyExcludedElement/", m) +} + +// Removes an excluded element from a context. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) RemoveExcludedElement(contextname string, description string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "description": description, + } + return a.c.Request("ajaxSpider/action/removeExcludedElement/", m) +} + +// Removes an allowed resource. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) RemoveAllowedResource(regex string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + } + return a.c.Request("ajaxSpider/action/removeAllowedResource/", m) +} + +// Sets whether or not an allowed resource is enabled. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) SetEnabledAllowedResource(regex string, enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "enabled": enabled, + } + return a.c.Request("ajaxSpider/action/setEnabledAllowedResource/", m) +} + +// Sets the configuration of the AJAX Spider to use one of the supported browsers. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) SetOptionBrowserId(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return a.c.Request("ajaxSpider/action/setOptionBrowserId/", m) +} + +// 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 +func (a AjaxSpider) SetOptionClickDefaultElems(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ajaxSpider/action/setOptionClickDefaultElems/", m) +} + +// When enabled, the crawler attempts to interact with each element (e.g., by clicking) only once. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) SetOptionClickElemsOnce(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ajaxSpider/action/setOptionClickElemsOnce/", m) +} + +// 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. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) SetOptionEventWait(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ajaxSpider/action/setOptionEventWait/", m) +} + +// Sets the maximum depth that the crawler can reach. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) SetOptionMaxCrawlDepth(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ajaxSpider/action/setOptionMaxCrawlDepth/", m) +} + +// Sets the maximum number of states that the crawler should crawl. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) SetOptionMaxCrawlStates(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ajaxSpider/action/setOptionMaxCrawlStates/", m) +} + +// The maximum time that the crawler is allowed to run. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) SetOptionMaxDuration(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ajaxSpider/action/setOptionMaxDuration/", m) +} + +// Sets the number of windows to be used by AJAX Spider. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) SetOptionNumberOfBrowsers(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ajaxSpider/action/setOptionNumberOfBrowsers/", m) +} + +// When enabled, inserts random values into form fields. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) SetOptionRandomInputs(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ajaxSpider/action/setOptionRandomInputs/", m) +} + +// Sets the time to wait after the page is loaded before interacting with it. +// +// This component is optional and therefore the API will only work if it is installed +func (a AjaxSpider) SetOptionReloadWait(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ajaxSpider/action/setOptionReloadWait/", m) +} diff --git a/zap-api-go/zap/alert-filter_generated.go b/zap-api-go/zap/alert-filter_generated.go new file mode 100644 index 0000000..30ec62d --- /dev/null +++ b/zap-api-go/zap/alert-filter_generated.go @@ -0,0 +1,171 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type AlertFilter struct { + c *Client +} + +// Lists the alert filters of the context with the given ID. +// +// This component is optional and therefore the API will only work if it is installed +func (a AlertFilter) AlertFilterList(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return a.c.Request("alertFilter/view/alertFilterList/", m) +} + +// Lists the global alert filters. +// +// This component is optional and therefore the API will only work if it is installed +func (a AlertFilter) GlobalAlertFilterList() (map[string]interface{}, error) { + return a.c.Request("alertFilter/view/globalAlertFilterList/", nil) +} + +// Adds a new alert filter for the context with the given ID. +// +// This component is optional and therefore the API will only work if it is installed +func (a AlertFilter) AddAlertFilter(contextid string, ruleid string, newlevel string, url string, urlisregex string, parameter string, enabled string, parameterisregex string, attack string, attackisregex string, evidence string, evidenceisregex string, methods string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "ruleId": ruleid, + "newLevel": newlevel, + "url": url, + "urlIsRegex": urlisregex, + "parameter": parameter, + "enabled": enabled, + "parameterIsRegex": parameterisregex, + "attack": attack, + "attackIsRegex": attackisregex, + "evidence": evidence, + "evidenceIsRegex": evidenceisregex, + "methods": methods, + } + return a.c.Request("alertFilter/action/addAlertFilter/", m) +} + +// Removes an alert filter from the context with the given ID. +// +// This component is optional and therefore the API will only work if it is installed +func (a AlertFilter) RemoveAlertFilter(contextid string, ruleid string, newlevel string, url string, urlisregex string, parameter string, enabled string, parameterisregex string, attack string, attackisregex string, evidence string, evidenceisregex string, methods string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "ruleId": ruleid, + "newLevel": newlevel, + "url": url, + "urlIsRegex": urlisregex, + "parameter": parameter, + "enabled": enabled, + "parameterIsRegex": parameterisregex, + "attack": attack, + "attackIsRegex": attackisregex, + "evidence": evidence, + "evidenceIsRegex": evidenceisregex, + "methods": methods, + } + return a.c.Request("alertFilter/action/removeAlertFilter/", m) +} + +// Adds a new global alert filter. +// +// This component is optional and therefore the API will only work if it is installed +func (a AlertFilter) AddGlobalAlertFilter(ruleid string, newlevel string, url string, urlisregex string, parameter string, enabled string, parameterisregex string, attack string, attackisregex string, evidence string, evidenceisregex string, methods string) (map[string]interface{}, error) { + m := map[string]string{ + "ruleId": ruleid, + "newLevel": newlevel, + "url": url, + "urlIsRegex": urlisregex, + "parameter": parameter, + "enabled": enabled, + "parameterIsRegex": parameterisregex, + "attack": attack, + "attackIsRegex": attackisregex, + "evidence": evidence, + "evidenceIsRegex": evidenceisregex, + "methods": methods, + } + return a.c.Request("alertFilter/action/addGlobalAlertFilter/", m) +} + +// Removes a global alert filter. +// +// This component is optional and therefore the API will only work if it is installed +func (a AlertFilter) RemoveGlobalAlertFilter(ruleid string, newlevel string, url string, urlisregex string, parameter string, enabled string, parameterisregex string, attack string, attackisregex string, evidence string, evidenceisregex string, methods string) (map[string]interface{}, error) { + m := map[string]string{ + "ruleId": ruleid, + "newLevel": newlevel, + "url": url, + "urlIsRegex": urlisregex, + "parameter": parameter, + "enabled": enabled, + "parameterIsRegex": parameterisregex, + "attack": attack, + "attackIsRegex": attackisregex, + "evidence": evidence, + "evidenceIsRegex": evidenceisregex, + "methods": methods, + } + return a.c.Request("alertFilter/action/removeGlobalAlertFilter/", m) +} + +// Applies all currently enabled Global and Context alert filters. +// +// This component is optional and therefore the API will only work if it is installed +func (a AlertFilter) ApplyAll() (map[string]interface{}, error) { + return a.c.Request("alertFilter/action/applyAll/", nil) +} + +// Applies all currently enabled Context alert filters. +// +// This component is optional and therefore the API will only work if it is installed +func (a AlertFilter) ApplyContext() (map[string]interface{}, error) { + return a.c.Request("alertFilter/action/applyContext/", nil) +} + +// Applies all currently enabled Global alert filters. +// +// This component is optional and therefore the API will only work if it is installed +func (a AlertFilter) ApplyGlobal() (map[string]interface{}, error) { + return a.c.Request("alertFilter/action/applyGlobal/", nil) +} + +// Tests all currently enabled Global and Context alert filters. +// +// This component is optional and therefore the API will only work if it is installed +func (a AlertFilter) TestAll() (map[string]interface{}, error) { + return a.c.Request("alertFilter/action/testAll/", nil) +} + +// Tests all currently enabled Context alert filters. +// +// This component is optional and therefore the API will only work if it is installed +func (a AlertFilter) TestContext() (map[string]interface{}, error) { + return a.c.Request("alertFilter/action/testContext/", nil) +} + +// Tests all currently enabled Global alert filters. +// +// This component is optional and therefore the API will only work if it is installed +func (a AlertFilter) TestGlobal() (map[string]interface{}, error) { + return a.c.Request("alertFilter/action/testGlobal/", nil) +} diff --git a/zap-api-go/zap/alert_generated.go b/zap-api-go/zap/alert_generated.go new file mode 100644 index 0000000..528e8fe --- /dev/null +++ b/zap-api-go/zap/alert_generated.go @@ -0,0 +1,162 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Alert struct { + c *Client +} + +// Gets the alert with the given ID, the corresponding HTTP message can be obtained with the 'messageId' field and 'message' API method +func (a Alert) Alert(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return a.c.Request("alert/view/alert/", m) +} + +// Gets the alerts raised by ZAP, optionally filtering by URL or riskId, and paginating with 'start' position and 'count' of alerts +func (a Alert) Alerts(baseurl string, start string, count string, riskid string, contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + "start": start, + "count": count, + "riskId": riskid, + "contextName": contextname, + } + return a.c.Request("alert/view/alerts/", m) +} + +// Gets number of alerts grouped by each risk level, optionally filtering by URL +func (a Alert) AlertsSummary(baseurl string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + } + return a.c.Request("alert/view/alertsSummary/", m) +} + +// Gets the number of alerts, optionally filtering by URL or riskId +func (a Alert) NumberOfAlerts(baseurl string, riskid string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + "riskId": riskid, + } + return a.c.Request("alert/view/numberOfAlerts/", m) +} + +// Gets a summary of the alerts, optionally filtered by a 'url'. If 'recurse' is true then all alerts that apply to urls that start with the specified 'url' will be returned, otherwise only those on exactly the same 'url' (ignoring url parameters) +func (a Alert) AlertsByRisk(url string, recurse string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "recurse": recurse, + } + return a.c.Request("alert/view/alertsByRisk/", m) +} + +// Gets a count of the alerts, optionally filtered as per alertsPerRisk +func (a Alert) AlertCountsByRisk(url string, recurse string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "recurse": recurse, + } + return a.c.Request("alert/view/alertCountsByRisk/", m) +} + +// Deletes all alerts of the current session. +func (a Alert) DeleteAllAlerts() (map[string]interface{}, error) { + return a.c.Request("alert/action/deleteAllAlerts/", nil) +} + +// Deletes all the alerts optionally filtered by URL which fall within the Context with the provided name, risk, or base URL. +func (a Alert) DeleteAlerts(contextname string, baseurl string, riskid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "baseurl": baseurl, + "riskId": riskid, + } + return a.c.Request("alert/action/deleteAlerts/", m) +} + +// Deletes the alert with the given ID. +func (a Alert) DeleteAlert(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return a.c.Request("alert/action/deleteAlert/", m) +} + +// Update the confidence of the alerts. +func (a Alert) UpdateAlertsConfidence(ids string, confidenceid string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + "confidenceId": confidenceid, + } + return a.c.Request("alert/action/updateAlertsConfidence/", m) +} + +// Update the risk of the alerts. +func (a Alert) UpdateAlertsRisk(ids string, riskid string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + "riskId": riskid, + } + return a.c.Request("alert/action/updateAlertsRisk/", m) +} + +// Update the alert with the given ID, with the provided details. +func (a Alert) UpdateAlert(id string, name string, riskid string, confidenceid string, description string, param string, attack string, otherinfo string, solution string, references string, evidence string, cweid string, wascid string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + "name": name, + "riskId": riskid, + "confidenceId": confidenceid, + "description": description, + "param": param, + "attack": attack, + "otherInfo": otherinfo, + "solution": solution, + "references": references, + "evidence": evidence, + "cweId": cweid, + "wascId": wascid, + } + return a.c.Request("alert/action/updateAlert/", m) +} + +// Add an alert associated with the given message ID, with the provided details. (The ID of the created alert is returned.) +func (a Alert) AddAlert(messageid string, name string, riskid string, confidenceid string, description string, param string, attack string, otherinfo string, solution string, references string, evidence string, cweid string, wascid string) (map[string]interface{}, error) { + m := map[string]string{ + "messageId": messageid, + "name": name, + "riskId": riskid, + "confidenceId": confidenceid, + "description": description, + "param": param, + "attack": attack, + "otherInfo": otherinfo, + "solution": solution, + "references": references, + "evidence": evidence, + "cweId": cweid, + "wascId": wascid, + } + return a.c.Request("alert/action/addAlert/", m) +} diff --git a/zap-api-go/zap/ascan_generated.go b/zap-api-go/zap/ascan_generated.go new file mode 100644 index 0000000..4ca7b60 --- /dev/null +++ b/zap-api-go/zap/ascan_generated.go @@ -0,0 +1,617 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +import "strconv" + +type Ascan struct { + c *Client +} + +func (a Ascan) Status(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/view/status/", m) +} + +func (a Ascan) ScanProgress(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/view/scanProgress/", m) +} + +// Gets the IDs of the messages sent during the scan with the given ID. A message can be obtained with 'message' core view. +func (a Ascan) MessagesIds(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/view/messagesIds/", m) +} + +// Gets the IDs of the alerts raised during the scan with the given ID. An alert can be obtained with 'alert' core view. +func (a Ascan) AlertsIds(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/view/alertsIds/", m) +} + +func (a Ascan) Scans() (map[string]interface{}, error) { + return a.c.Request("ascan/view/scans/", nil) +} + +func (a Ascan) ScanPolicyNames() (map[string]interface{}, error) { + return a.c.Request("ascan/view/scanPolicyNames/", nil) +} + +// Gets the regexes of URLs excluded from the active scans. +func (a Ascan) ExcludedFromScan() (map[string]interface{}, error) { + return a.c.Request("ascan/view/excludedFromScan/", nil) +} + +// Gets the scan rules, optionally, of the given scan policy or scanner policy/category ID. +func (a Ascan) Scanners(scanpolicyname string, policyid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanPolicyName": scanpolicyname, + "policyId": policyid, + } + return a.c.Request("ascan/view/scanners/", m) +} + +func (a Ascan) Policies(scanpolicyname string, policyid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanPolicyName": scanpolicyname, + "policyId": policyid, + } + return a.c.Request("ascan/view/policies/", m) +} + +func (a Ascan) AttackModeQueue() (map[string]interface{}, error) { + return a.c.Request("ascan/view/attackModeQueue/", nil) +} + +// Gets all the parameters that are excluded. For each parameter the following are shown: the name, the URL, and the parameter type. +func (a Ascan) ExcludedParams() (map[string]interface{}, error) { + return a.c.Request("ascan/view/excludedParams/", nil) +} + +// Use view excludedParams instead. +func (a Ascan) OptionExcludedParamList() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionExcludedParamList/", nil) +} + +// Gets all the types of excluded parameters. For each type the following are shown: the ID and the name. +func (a Ascan) ExcludedParamTypes() (map[string]interface{}, error) { + return a.c.Request("ascan/view/excludedParamTypes/", nil) +} + +func (a Ascan) OptionAttackPolicy() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionAttackPolicy/", nil) +} + +func (a Ascan) OptionDefaultPolicy() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionDefaultPolicy/", nil) +} + +func (a Ascan) OptionDelayInMs() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionDelayInMs/", nil) +} + +func (a Ascan) OptionHandleAntiCSRFTokens() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionHandleAntiCSRFTokens/", nil) +} + +func (a Ascan) OptionHostPerScan() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionHostPerScan/", nil) +} + +// Gets the maximum number of alerts that a rule can raise before being skipped. +func (a Ascan) OptionMaxAlertsPerRule() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionMaxAlertsPerRule/", nil) +} + +func (a Ascan) OptionMaxChartTimeInMins() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionMaxChartTimeInMins/", nil) +} + +func (a Ascan) OptionMaxResultsToList() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionMaxResultsToList/", nil) +} + +func (a Ascan) OptionMaxRuleDurationInMins() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionMaxRuleDurationInMins/", nil) +} + +func (a Ascan) OptionMaxScanDurationInMins() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionMaxScanDurationInMins/", nil) +} + +func (a Ascan) OptionMaxScansInUI() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionMaxScansInUI/", nil) +} + +func (a Ascan) OptionTargetParamsEnabledRPC() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionTargetParamsEnabledRPC/", nil) +} + +func (a Ascan) OptionTargetParamsInjectable() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionTargetParamsInjectable/", nil) +} + +func (a Ascan) OptionThreadPerHost() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionThreadPerHost/", nil) +} + +// Tells whether or not the active scanner should add a query parameter to GET request that don't have parameters to start with. +func (a Ascan) OptionAddQueryParam() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionAddQueryParam/", nil) +} + +func (a Ascan) OptionAllowAttackOnStart() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionAllowAttackOnStart/", nil) +} + +// Tells whether or not the active scanner should encode cookie values. +func (a Ascan) OptionEncodeCookieValues() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionEncodeCookieValues/", nil) +} + +// 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. +func (a Ascan) OptionInjectPluginIdInHeader() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionInjectPluginIdInHeader/", nil) +} + +func (a Ascan) OptionPromptInAttackMode() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionPromptInAttackMode/", nil) +} + +func (a Ascan) OptionPromptToClearFinishedScans() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionPromptToClearFinishedScans/", nil) +} + +func (a Ascan) OptionRescanInAttackMode() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionRescanInAttackMode/", nil) +} + +// Tells whether or not the HTTP Headers of all requests should be scanned. Not just requests that send parameters, through the query or request body. +func (a Ascan) OptionScanHeadersAllRequests() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionScanHeadersAllRequests/", nil) +} + +// Tells whether or not the active scanner should scan null JSON values. +func (a Ascan) OptionScanNullJsonValues() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionScanNullJsonValues/", nil) +} + +func (a Ascan) OptionShowAdvancedDialog() (map[string]interface{}, error) { + return a.c.Request("ascan/view/optionShowAdvancedDialog/", nil) +} + +// Runs the active scanner against the given URL or Context. Optionally, the 'recurse' parameter can be used to scan URLs under the given URL, the parameter 'inScopeOnly' can be used to constrain the scan to URLs that are in scope (ignored if a Context is specified), the parameter 'scanPolicyName' allows to specify the scan policy (if none is given it uses the default scan policy), the parameters 'method' and 'postData' allow to select a given request in conjunction with the given URL. +func (a Ascan) Scan(url string, recurse string, inscopeonly string, scanpolicyname string, method string, postdata string, contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "recurse": recurse, + "inScopeOnly": inscopeonly, + "scanPolicyName": scanpolicyname, + "method": method, + "postData": postdata, + "contextId": contextid, + } + return a.c.Request("ascan/action/scan/", m) +} + +// Active Scans from the perspective of a User, obtained using the given Context ID and User ID. See 'scan' action for more details. +func (a Ascan) ScanAsUser(url string, contextid string, userid string, recurse string, scanpolicyname string, method string, postdata string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "contextId": contextid, + "userId": userid, + "recurse": recurse, + "scanPolicyName": scanpolicyname, + "method": method, + "postData": postdata, + } + return a.c.Request("ascan/action/scanAsUser/", m) +} + +func (a Ascan) Pause(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/action/pause/", m) +} + +func (a Ascan) Resume(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/action/resume/", m) +} + +func (a Ascan) Stop(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/action/stop/", m) +} + +func (a Ascan) RemoveScan(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return a.c.Request("ascan/action/removeScan/", m) +} + +func (a Ascan) PauseAllScans() (map[string]interface{}, error) { + return a.c.Request("ascan/action/pauseAllScans/", nil) +} + +func (a Ascan) ResumeAllScans() (map[string]interface{}, error) { + return a.c.Request("ascan/action/resumeAllScans/", nil) +} + +func (a Ascan) StopAllScans() (map[string]interface{}, error) { + return a.c.Request("ascan/action/stopAllScans/", nil) +} + +func (a Ascan) RemoveAllScans() (map[string]interface{}, error) { + return a.c.Request("ascan/action/removeAllScans/", nil) +} + +// Clears the regexes of URLs excluded from the active scans. +func (a Ascan) ClearExcludedFromScan() (map[string]interface{}, error) { + return a.c.Request("ascan/action/clearExcludedFromScan/", nil) +} + +// Adds a regex of URLs that should be excluded from the active scans. +func (a Ascan) ExcludeFromScan(regex string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + } + return a.c.Request("ascan/action/excludeFromScan/", m) +} + +// Enables all scan rules of the scan policy with the given name, or the default if none given. +func (a Ascan) EnableAllScanners(scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/enableAllScanners/", m) +} + +// Disables all scan rules of the scan policy with the given name, or the default if none given. +func (a Ascan) DisableAllScanners(scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/disableAllScanners/", m) +} + +// Enables the scan rules with the given IDs (comma separated list of IDs) of the scan policy with the given name, or the default if none given. +func (a Ascan) EnableScanners(ids string, scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/enableScanners/", m) +} + +// Disables the scan rules with the given IDs (comma separated list of IDs) of the scan policy with the given name, or the default if none given. +func (a Ascan) DisableScanners(ids string, scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/disableScanners/", m) +} + +func (a Ascan) SetEnabledPolicies(ids string, scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/setEnabledPolicies/", m) +} + +func (a Ascan) SetPolicyAttackStrength(id string, attackstrength string, scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + "attackStrength": attackstrength, + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/setPolicyAttackStrength/", m) +} + +func (a Ascan) SetPolicyAlertThreshold(id string, alertthreshold string, scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + "alertThreshold": alertthreshold, + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/setPolicyAlertThreshold/", m) +} + +func (a Ascan) SetScannerAttackStrength(id string, attackstrength string, scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + "attackStrength": attackstrength, + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/setScannerAttackStrength/", m) +} + +func (a Ascan) SetScannerAlertThreshold(id string, alertthreshold string, scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + "alertThreshold": alertthreshold, + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/setScannerAlertThreshold/", m) +} + +func (a Ascan) AddScanPolicy(scanpolicyname string, alertthreshold string, attackstrength string) (map[string]interface{}, error) { + m := map[string]string{ + "scanPolicyName": scanpolicyname, + "alertThreshold": alertthreshold, + "attackStrength": attackstrength, + } + return a.c.Request("ascan/action/addScanPolicy/", m) +} + +func (a Ascan) RemoveScanPolicy(scanpolicyname string) (map[string]interface{}, error) { + m := map[string]string{ + "scanPolicyName": scanpolicyname, + } + return a.c.Request("ascan/action/removeScanPolicy/", m) +} + +func (a Ascan) UpdateScanPolicy(scanpolicyname string, alertthreshold string, attackstrength string) (map[string]interface{}, error) { + m := map[string]string{ + "scanPolicyName": scanpolicyname, + "alertThreshold": alertthreshold, + "attackStrength": attackstrength, + } + return a.c.Request("ascan/action/updateScanPolicy/", m) +} + +// Imports a Scan Policy using the given file system path. +func (a Ascan) ImportScanPolicy(path string) (map[string]interface{}, error) { + m := map[string]string{ + "path": path, + } + return a.c.Request("ascan/action/importScanPolicy/", m) +} + +// Adds a new parameter excluded from the scan, using the specified name. Optionally sets if the new entry applies to a specific URL (default, all URLs) and sets the ID of the type of the parameter (default, ID of any type). The type IDs can be obtained with the view excludedParamTypes. +func (a Ascan) AddExcludedParam(name string, t string, url string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + "type": t, + "url": url, + } + return a.c.Request("ascan/action/addExcludedParam/", m) +} + +// Modifies a parameter excluded from the scan. Allows to modify the name, the URL and the type of parameter. The parameter is selected with its index, which can be obtained with the view excludedParams. +func (a Ascan) ModifyExcludedParam(idx string, name string, t string, url string) (map[string]interface{}, error) { + m := map[string]string{ + "idx": idx, + "name": name, + "type": t, + "url": url, + } + return a.c.Request("ascan/action/modifyExcludedParam/", m) +} + +// Removes a parameter excluded from the scan, with the given index. The index can be obtained with the view excludedParams. +func (a Ascan) RemoveExcludedParam(idx string) (map[string]interface{}, error) { + m := map[string]string{ + "idx": idx, + } + return a.c.Request("ascan/action/removeExcludedParam/", m) +} + +// Skips the scan rule using the given IDs of the scan and the scan rule. +func (a Ascan) SkipScanner(scanid string, scannerid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + "scannerId": scannerid, + } + return a.c.Request("ascan/action/skipScanner/", m) +} + +func (a Ascan) SetOptionAttackPolicy(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return a.c.Request("ascan/action/setOptionAttackPolicy/", m) +} + +func (a Ascan) SetOptionDefaultPolicy(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return a.c.Request("ascan/action/setOptionDefaultPolicy/", m) +} + +// Sets whether or not the active scanner should add a query param to GET requests which do not have parameters to start with. +func (a Ascan) SetOptionAddQueryParam(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionAddQueryParam/", m) +} + +func (a Ascan) SetOptionAllowAttackOnStart(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionAllowAttackOnStart/", m) +} + +func (a Ascan) SetOptionDelayInMs(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionDelayInMs/", m) +} + +// Sets whether or not the active scanner should encode cookie values. +func (a Ascan) SetOptionEncodeCookieValues(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionEncodeCookieValues/", m) +} + +func (a Ascan) SetOptionHandleAntiCSRFTokens(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionHandleAntiCSRFTokens/", m) +} + +func (a Ascan) SetOptionHostPerScan(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionHostPerScan/", m) +} + +// Sets 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. +func (a Ascan) SetOptionInjectPluginIdInHeader(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionInjectPluginIdInHeader/", m) +} + +// Sets the maximum number of alerts that a rule can raise before being skipped. +func (a Ascan) SetOptionMaxAlertsPerRule(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionMaxAlertsPerRule/", m) +} + +func (a Ascan) SetOptionMaxChartTimeInMins(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionMaxChartTimeInMins/", m) +} + +func (a Ascan) SetOptionMaxResultsToList(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionMaxResultsToList/", m) +} + +func (a Ascan) SetOptionMaxRuleDurationInMins(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionMaxRuleDurationInMins/", m) +} + +func (a Ascan) SetOptionMaxScanDurationInMins(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionMaxScanDurationInMins/", m) +} + +func (a Ascan) SetOptionMaxScansInUI(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionMaxScansInUI/", m) +} + +func (a Ascan) SetOptionPromptInAttackMode(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionPromptInAttackMode/", m) +} + +func (a Ascan) SetOptionPromptToClearFinishedScans(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionPromptToClearFinishedScans/", m) +} + +func (a Ascan) SetOptionRescanInAttackMode(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionRescanInAttackMode/", m) +} + +// Sets whether or not the HTTP Headers of all requests should be scanned. Not just requests that send parameters, through the query or request body. +func (a Ascan) SetOptionScanHeadersAllRequests(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionScanHeadersAllRequests/", m) +} + +// Sets whether or not the active scanner should scan null JSON values. +func (a Ascan) SetOptionScanNullJsonValues(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionScanNullJsonValues/", m) +} + +func (a Ascan) SetOptionShowAdvancedDialog(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("ascan/action/setOptionShowAdvancedDialog/", m) +} + +func (a Ascan) SetOptionTargetParamsEnabledRPC(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionTargetParamsEnabledRPC/", m) +} + +func (a Ascan) SetOptionTargetParamsInjectable(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionTargetParamsInjectable/", m) +} + +func (a Ascan) SetOptionThreadPerHost(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return a.c.Request("ascan/action/setOptionThreadPerHost/", m) +} diff --git a/zap-api-go/zap/authentication_generated.go b/zap-api-go/zap/authentication_generated.go new file mode 100644 index 0000000..771edfd --- /dev/null +++ b/zap-api-go/zap/authentication_generated.go @@ -0,0 +1,91 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Authentication struct { + c *Client +} + +// Gets the name of the authentication methods. +func (a Authentication) GetSupportedAuthenticationMethods() (map[string]interface{}, error) { + return a.c.Request("authentication/view/getSupportedAuthenticationMethods/", nil) +} + +// Gets the configuration parameters for the authentication method with the given name. +func (a Authentication) GetAuthenticationMethodConfigParams(authmethodname string) (map[string]interface{}, error) { + m := map[string]string{ + "authMethodName": authmethodname, + } + return a.c.Request("authentication/view/getAuthenticationMethodConfigParams/", m) +} + +// Gets the name of the authentication method for the context with the given ID. +func (a Authentication) GetAuthenticationMethod(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return a.c.Request("authentication/view/getAuthenticationMethod/", m) +} + +// Gets the logged in indicator for the context with the given ID. +func (a Authentication) GetLoggedInIndicator(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return a.c.Request("authentication/view/getLoggedInIndicator/", m) +} + +// Gets the logged out indicator for the context with the given ID. +func (a Authentication) GetLoggedOutIndicator(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return a.c.Request("authentication/view/getLoggedOutIndicator/", m) +} + +// Sets the authentication method for the context with the given ID. +func (a Authentication) SetAuthenticationMethod(contextid string, authmethodname string, authmethodconfigparams string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "authMethodName": authmethodname, + "authMethodConfigParams": authmethodconfigparams, + } + return a.c.Request("authentication/action/setAuthenticationMethod/", m) +} + +// Sets the logged in indicator for the context with the given ID. +func (a Authentication) SetLoggedInIndicator(contextid string, loggedinindicatorregex string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "loggedInIndicatorRegex": loggedinindicatorregex, + } + return a.c.Request("authentication/action/setLoggedInIndicator/", m) +} + +// Sets the logged out indicator for the context with the given ID. +func (a Authentication) SetLoggedOutIndicator(contextid string, loggedoutindicatorregex string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "loggedOutIndicatorRegex": loggedoutindicatorregex, + } + return a.c.Request("authentication/action/setLoggedOutIndicator/", m) +} diff --git a/zap-api-go/zap/authorization_generated.go b/zap-api-go/zap/authorization_generated.go new file mode 100644 index 0000000..dbb8fd6 --- /dev/null +++ b/zap-api-go/zap/authorization_generated.go @@ -0,0 +1,46 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Authorization struct { + c *Client +} + +// Obtains all the configuration of the authorization detection method that is currently set for a context. +func (a Authorization) GetAuthorizationDetectionMethod(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return a.c.Request("authorization/view/getAuthorizationDetectionMethod/", m) +} + +// Sets the authorization detection method for a context as one that identifies un-authorized messages based on: the message's status code or a regex pattern in the response's header or body. Also, whether all conditions must match or just some can be specified via the logicalOperator parameter, which accepts two values: "AND" (default), "OR". +func (a Authorization) SetBasicAuthorizationDetectionMethod(contextid string, headerregex string, bodyregex string, statuscode string, logicaloperator string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "headerRegex": headerregex, + "bodyRegex": bodyregex, + "statusCode": statuscode, + "logicalOperator": logicaloperator, + } + return a.c.Request("authorization/action/setBasicAuthorizationDetectionMethod/", m) +} diff --git a/zap-api-go/zap/automation_generated.go b/zap-api-go/zap/automation_generated.go new file mode 100644 index 0000000..aaefcf8 --- /dev/null +++ b/zap-api-go/zap/automation_generated.go @@ -0,0 +1,47 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Automation struct { + c *Client +} + +// This component is optional and therefore the API will only work if it is installed +func (a Automation) PlanProgress(planid string) (map[string]interface{}, error) { + m := map[string]string{ + "planId": planid, + } + return a.c.Request("automation/view/planProgress/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (a Automation) RunPlan(filepath string) (map[string]interface{}, error) { + m := map[string]string{ + "filePath": filepath, + } + return a.c.Request("automation/action/runPlan/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (a Automation) EndDelayJob() (map[string]interface{}, error) { + return a.c.Request("automation/action/endDelayJob/", nil) +} diff --git a/zap-api-go/zap/autoupdate_generated.go b/zap-api-go/zap/autoupdate_generated.go new file mode 100644 index 0000000..48e40da --- /dev/null +++ b/zap-api-go/zap/autoupdate_generated.go @@ -0,0 +1,199 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +import "strconv" + +type Autoupdate struct { + c *Client +} + +// Returns the latest version number +func (a Autoupdate) LatestVersionNumber() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/latestVersionNumber/", nil) +} + +// Returns 'true' if ZAP is on the latest version +func (a Autoupdate) IsLatestVersion() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/isLatestVersion/", nil) +} + +// Return a list of all of the installed add-ons +func (a Autoupdate) InstalledAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/installedAddons/", nil) +} + +// Returns a list with all local add-ons, installed or not. +func (a Autoupdate) LocalAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/localAddons/", nil) +} + +// Return a list of any add-ons that have been added to the Marketplace since the last check for updates +func (a Autoupdate) NewAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/newAddons/", nil) +} + +// Return a list of any add-ons that have been changed in the Marketplace since the last check for updates +func (a Autoupdate) UpdatedAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/updatedAddons/", nil) +} + +// Return a list of all of the add-ons on the ZAP Marketplace (this information is read once and then cached) +func (a Autoupdate) MarketplaceAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/marketplaceAddons/", nil) +} + +func (a Autoupdate) OptionAddonDirectories() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionAddonDirectories/", nil) +} + +func (a Autoupdate) OptionDayLastChecked() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionDayLastChecked/", nil) +} + +func (a Autoupdate) OptionDayLastInstallWarned() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionDayLastInstallWarned/", nil) +} + +func (a Autoupdate) OptionDayLastUpdateWarned() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionDayLastUpdateWarned/", nil) +} + +func (a Autoupdate) OptionDownloadDirectory() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionDownloadDirectory/", nil) +} + +func (a Autoupdate) OptionCheckAddonUpdates() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionCheckAddonUpdates/", nil) +} + +func (a Autoupdate) OptionCheckOnStart() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionCheckOnStart/", nil) +} + +func (a Autoupdate) OptionDownloadNewRelease() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionDownloadNewRelease/", nil) +} + +func (a Autoupdate) OptionInstallAddonUpdates() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionInstallAddonUpdates/", nil) +} + +func (a Autoupdate) OptionInstallScannerRules() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionInstallScannerRules/", nil) +} + +func (a Autoupdate) OptionReportAlphaAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionReportAlphaAddons/", nil) +} + +func (a Autoupdate) OptionReportBetaAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionReportBetaAddons/", nil) +} + +func (a Autoupdate) OptionReportReleaseAddons() (map[string]interface{}, error) { + return a.c.Request("autoupdate/view/optionReportReleaseAddons/", nil) +} + +// Downloads the latest release, if any +func (a Autoupdate) DownloadLatestRelease() (map[string]interface{}, error) { + return a.c.Request("autoupdate/action/downloadLatestRelease/", nil) +} + +// Installs or updates the specified add-on, returning when complete (i.e. not asynchronously) +func (a Autoupdate) InstallAddon(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return a.c.Request("autoupdate/action/installAddon/", m) +} + +func (a Autoupdate) InstallLocalAddon(file string) (map[string]interface{}, error) { + m := map[string]string{ + "file": file, + } + return a.c.Request("autoupdate/action/installLocalAddon/", m) +} + +// Uninstalls the specified add-on +func (a Autoupdate) UninstallAddon(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return a.c.Request("autoupdate/action/uninstallAddon/", m) +} + +func (a Autoupdate) SetOptionCheckAddonUpdates(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionCheckAddonUpdates/", m) +} + +func (a Autoupdate) SetOptionCheckOnStart(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionCheckOnStart/", m) +} + +func (a Autoupdate) SetOptionDownloadNewRelease(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionDownloadNewRelease/", m) +} + +func (a Autoupdate) SetOptionInstallAddonUpdates(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionInstallAddonUpdates/", m) +} + +func (a Autoupdate) SetOptionInstallScannerRules(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionInstallScannerRules/", m) +} + +func (a Autoupdate) SetOptionReportAlphaAddons(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionReportAlphaAddons/", m) +} + +func (a Autoupdate) SetOptionReportBetaAddons(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionReportBetaAddons/", m) +} + +func (a Autoupdate) SetOptionReportReleaseAddons(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return a.c.Request("autoupdate/action/setOptionReportReleaseAddons/", m) +} diff --git a/zap-api-go/zap/brk_generated.go b/zap-api-go/zap/brk_generated.go new file mode 100644 index 0000000..5dc1521 --- /dev/null +++ b/zap-api-go/zap/brk_generated.go @@ -0,0 +1,104 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Break struct { + c *Client +} + +// Returns True if ZAP will break on both requests and responses +func (b Break) IsBreakAll() (map[string]interface{}, error) { + return b.c.Request("break/view/isBreakAll/", nil) +} + +// Returns True if ZAP will break on requests +func (b Break) IsBreakRequest() (map[string]interface{}, error) { + return b.c.Request("break/view/isBreakRequest/", nil) +} + +// Returns True if ZAP will break on responses +func (b Break) IsBreakResponse() (map[string]interface{}, error) { + return b.c.Request("break/view/isBreakResponse/", nil) +} + +// Returns the HTTP message currently intercepted (if any) +func (b Break) HttpMessage() (map[string]interface{}, error) { + return b.c.Request("break/view/httpMessage/", nil) +} + +// Controls the global break functionality. The type may be one of: http-all, http-request or http-response. The state may be true (for turning break on for the specified type) or false (for turning break off). Scope is not currently used. +func (b Break) Brk(t string, state string, scope string) (map[string]interface{}, error) { + m := map[string]string{ + "type": t, + "state": state, + "scope": scope, + } + return b.c.Request("break/action/break/", m) +} + +// Overwrites the currently intercepted message with the data provided +func (b Break) SetHttpMessage(httpheader string, httpbody string) (map[string]interface{}, error) { + m := map[string]string{ + "httpHeader": httpheader, + "httpBody": httpbody, + } + return b.c.Request("break/action/setHttpMessage/", m) +} + +// Submits the currently intercepted message and unsets the global request/response breakpoints +func (b Break) Cont() (map[string]interface{}, error) { + return b.c.Request("break/action/continue/", nil) +} + +// Submits the currently intercepted message, the next request or response will automatically be intercepted +func (b Break) Step() (map[string]interface{}, error) { + return b.c.Request("break/action/step/", nil) +} + +// Drops the currently intercepted message +func (b Break) Drop() (map[string]interface{}, error) { + return b.c.Request("break/action/drop/", nil) +} + +// Adds a custom HTTP breakpoint. The string is the string to match. Location may be one of: url, request_header, request_body, response_header or response_body. Match may be: contains or regex. Inverse (match) may be true or false. Lastly, ignorecase (when matching the string) may be true or false. +func (b Break) AddHttpBreakpoint(str string, location string, match string, inverse string, ignorecase string) (map[string]interface{}, error) { + m := map[string]string{ + "string": str, + "location": location, + "match": match, + "inverse": inverse, + "ignorecase": ignorecase, + } + return b.c.Request("break/action/addHttpBreakpoint/", m) +} + +// Removes the specified breakpoint +func (b Break) RemoveHttpBreakpoint(str string, location string, match string, inverse string, ignorecase string) (map[string]interface{}, error) { + m := map[string]string{ + "string": str, + "location": location, + "match": match, + "inverse": inverse, + "ignorecase": ignorecase, + } + return b.c.Request("break/action/removeHttpBreakpoint/", m) +} diff --git a/zap-api-go/zap/context_generated.go b/zap-api-go/zap/context_generated.go new file mode 100644 index 0000000..acc5e7d --- /dev/null +++ b/zap-api-go/zap/context_generated.go @@ -0,0 +1,202 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Context struct { + c *Client +} + +// List context names of current session +func (c Context) ContextList() (map[string]interface{}, error) { + return c.c.Request("context/view/contextList/", nil) +} + +// List excluded regexs for context +func (c Context) ExcludeRegexs(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/view/excludeRegexs/", m) +} + +// List included regexs for context +func (c Context) IncludeRegexs(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/view/includeRegexs/", m) +} + +// List the information about the named context +func (c Context) Context(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/view/context/", m) +} + +// Lists the names of all built in technologies +func (c Context) TechnologyList() (map[string]interface{}, error) { + return c.c.Request("context/view/technologyList/", nil) +} + +// Lists the names of all technologies included in a context +func (c Context) IncludedTechnologyList(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/view/includedTechnologyList/", m) +} + +// Lists the names of all technologies excluded from a context +func (c Context) ExcludedTechnologyList(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/view/excludedTechnologyList/", m) +} + +// Lists the URLs accessed through/by ZAP, that belong to the context with the given name. +func (c Context) Urls(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/view/urls/", m) +} + +// Add exclude regex to context +func (c Context) ExcludeFromContext(contextname string, regex string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "regex": regex, + } + return c.c.Request("context/action/excludeFromContext/", m) +} + +// Add include regex to context +func (c Context) IncludeInContext(contextname string, regex string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "regex": regex, + } + return c.c.Request("context/action/includeInContext/", m) +} + +// Set the regexs to include and exclude for a context, both supplied as JSON string arrays +func (c Context) SetContextRegexs(contextname string, incregexs string, excregexs string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "incRegexs": incregexs, + "excRegexs": excregexs, + } + return c.c.Request("context/action/setContextRegexs/", m) +} + +// Set the checking strategy for a context - this defines how ZAP checks that a request is authenticated +func (c Context) SetContextCheckingStrategy(contextname string, checkingstrategy string, pollurl string, polldata string, pollheaders string, pollfrequency string, pollfrequencyunits string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "checkingStrategy": checkingstrategy, + "pollUrl": pollurl, + "pollData": polldata, + "pollHeaders": pollheaders, + "pollFrequency": pollfrequency, + "pollFrequencyUnits": pollfrequencyunits, + } + return c.c.Request("context/action/setContextCheckingStrategy/", m) +} + +// Creates a new context with the given name in the current session +func (c Context) NewContext(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/action/newContext/", m) +} + +// Removes a context in the current session +func (c Context) RemoveContext(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/action/removeContext/", m) +} + +// Exports the context with the given name to a file. If a relative file path is specified it will be resolved against the "contexts" directory in ZAP "home" dir. +func (c Context) ExportContext(contextname string, contextfile string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "contextFile": contextfile, + } + return c.c.Request("context/action/exportContext/", m) +} + +// Imports a context from a file. If a relative file path is specified it will be resolved against the "contexts" directory in ZAP "home" dir. +func (c Context) ImportContext(contextfile string) (map[string]interface{}, error) { + m := map[string]string{ + "contextFile": contextfile, + } + return c.c.Request("context/action/importContext/", m) +} + +// Includes technologies with the given names, separated by a comma, to a context +func (c Context) IncludeContextTechnologies(contextname string, technologynames string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "technologyNames": technologynames, + } + return c.c.Request("context/action/includeContextTechnologies/", m) +} + +// Includes all built in technologies in to a context +func (c Context) IncludeAllContextTechnologies(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/action/includeAllContextTechnologies/", m) +} + +// Excludes technologies with the given names, separated by a comma, from a context +func (c Context) ExcludeContextTechnologies(contextname string, technologynames string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "technologyNames": technologynames, + } + return c.c.Request("context/action/excludeContextTechnologies/", m) +} + +// Excludes all built in technologies from a context +func (c Context) ExcludeAllContextTechnologies(contextname string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + } + return c.c.Request("context/action/excludeAllContextTechnologies/", m) +} + +// Sets a context to in scope (contexts are in scope by default) +func (c Context) SetContextInScope(contextname string, booleaninscope string) (map[string]interface{}, error) { + m := map[string]string{ + "contextName": contextname, + "booleanInScope": booleaninscope, + } + return c.c.Request("context/action/setContextInScope/", m) +} diff --git a/zap-api-go/zap/core_generated.go b/zap-api-go/zap/core_generated.go new file mode 100644 index 0000000..ca7741d --- /dev/null +++ b/zap-api-go/zap/core_generated.go @@ -0,0 +1,672 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +import "strconv" + +type Core struct { + c *Client +} + +// Gets the name of the hosts accessed through/by ZAP +func (c Core) Hosts() (map[string]interface{}, error) { + return c.c.Request("core/view/hosts/", nil) +} + +// Gets the sites accessed through/by ZAP (scheme and domain) +func (c Core) Sites() (map[string]interface{}, error) { + return c.c.Request("core/view/sites/", nil) +} + +// Gets the URLs accessed through/by ZAP, optionally filtering by (base) URL. +func (c Core) Urls(baseurl string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + } + return c.c.Request("core/view/urls/", m) +} + +// Gets the child nodes underneath the specified URL in the Sites tree +func (c Core) ChildNodes(url string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + } + return c.c.Request("core/view/childNodes/", m) +} + +// Gets the HTTP message with the given ID. Returns the ID, request/response headers and bodies, cookies, note, type, RTT, and timestamp. +func (c Core) Message(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return c.c.Request("core/view/message/", m) +} + +// Gets the HTTP messages sent by ZAP, request and response, optionally filtered by URL and paginated with 'start' position and 'count' of messages +func (c Core) Messages(baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + "start": start, + "count": count, + } + return c.c.Request("core/view/messages/", m) +} + +// Gets the HTTP messages with the given IDs. +func (c Core) MessagesById(ids string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + } + return c.c.Request("core/view/messagesById/", m) +} + +// Gets the number of messages, optionally filtering by URL +func (c Core) NumberOfMessages(baseurl string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + } + return c.c.Request("core/view/numberOfMessages/", m) +} + +// Gets the mode +func (c Core) Mode() (map[string]interface{}, error) { + return c.c.Request("core/view/mode/", nil) +} + +// Gets ZAP version +func (c Core) Version() (map[string]interface{}, error) { + return c.c.Request("core/view/version/", nil) +} + +// Gets the regular expressions, applied to URLs, to exclude from the local proxies. +func (c Core) ExcludedFromProxy() (map[string]interface{}, error) { + return c.c.Request("core/view/excludedFromProxy/", nil) +} + +// Gets the location of the current session file +func (c Core) SessionLocation() (map[string]interface{}, error) { + return c.c.Request("core/view/sessionLocation/", nil) +} + +// Gets all the domains that are excluded from the outgoing proxy. For each domain the following are shown: the index, the value (domain), if enabled, and if specified as a regex. +func (c Core) ProxyChainExcludedDomains() (map[string]interface{}, error) { + return c.c.Request("core/view/proxyChainExcludedDomains/", nil) +} + +// Gets the path to ZAP's home directory. +func (c Core) ZapHomePath() (map[string]interface{}, error) { + return c.c.Request("core/view/zapHomePath/", nil) +} + +// Gets the maximum number of alert instances to include in a report. +func (c Core) OptionMaximumAlertInstances() (map[string]interface{}, error) { + return c.c.Request("core/view/optionMaximumAlertInstances/", nil) +} + +// Gets whether or not related alerts will be merged in any reports generated. +func (c Core) OptionMergeRelatedAlerts() (map[string]interface{}, error) { + return c.c.Request("core/view/optionMergeRelatedAlerts/", nil) +} + +// Gets the path to the file with alert overrides. +func (c Core) OptionAlertOverridesFilePath() (map[string]interface{}, error) { + return c.c.Request("core/view/optionAlertOverridesFilePath/", nil) +} + +func (c Core) HomeDirectory() (map[string]interface{}, error) { + return c.c.Request("core/view/homeDirectory/", nil) +} + +// Use view proxyChainExcludedDomains instead. +func (c Core) OptionProxyChainSkipName() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyChainSkipName/", nil) +} + +// Use view proxyChainExcludedDomains instead. +func (c Core) OptionProxyExcludedDomains() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyExcludedDomains/", nil) +} + +// Use view proxyChainExcludedDomains instead. +func (c Core) OptionProxyExcludedDomainsEnabled() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyExcludedDomainsEnabled/", nil) +} + +// Gets the alert with the given ID, the corresponding HTTP message can be obtained with the 'messageId' field and 'message' API method +func (c Core) Alert(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return c.c.Request("core/view/alert/", m) +} + +// Gets the alerts raised by ZAP, optionally filtering by URL or riskId, and paginating with 'start' position and 'count' of alerts +func (c Core) Alerts(baseurl string, start string, count string, riskid string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + "start": start, + "count": count, + "riskId": riskid, + } + return c.c.Request("core/view/alerts/", m) +} + +// Gets number of alerts grouped by each risk level, optionally filtering by URL +func (c Core) AlertsSummary(baseurl string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + } + return c.c.Request("core/view/alertsSummary/", m) +} + +// Gets the number of alerts, optionally filtering by URL or riskId +func (c Core) NumberOfAlerts(baseurl string, riskid string) (map[string]interface{}, error) { + m := map[string]string{ + "baseurl": baseurl, + "riskId": riskid, + } + return c.c.Request("core/view/numberOfAlerts/", m) +} + +// The detailed logging config, optionally filtered based on a name (ex: starts with). +func (c Core) GetLogLevel(name string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + } + return c.c.Request("core/view/getLogLevel/", m) +} + +// Gets the user agent that ZAP should use when creating HTTP messages (for example, spider messages or CONNECT requests to outgoing proxy). +func (c Core) OptionDefaultUserAgent() (map[string]interface{}, error) { + return c.c.Request("core/view/optionDefaultUserAgent/", nil) +} + +// Gets the TTL (in seconds) of successful DNS queries. +func (c Core) OptionDnsTtlSuccessfulQueries() (map[string]interface{}, error) { + return c.c.Request("core/view/optionDnsTtlSuccessfulQueries/", nil) +} + +func (c Core) OptionHttpState() (map[string]interface{}, error) { + return c.c.Request("core/view/optionHttpState/", nil) +} + +func (c Core) OptionHttpStateEnabled() (map[string]interface{}, error) { + return c.c.Request("core/view/optionHttpStateEnabled/", nil) +} + +func (c Core) OptionProxyChainName() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyChainName/", nil) +} + +func (c Core) OptionProxyChainPassword() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyChainPassword/", nil) +} + +func (c Core) OptionProxyChainPort() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyChainPort/", nil) +} + +func (c Core) OptionProxyChainPrompt() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyChainPrompt/", nil) +} + +func (c Core) OptionProxyChainRealm() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyChainRealm/", nil) +} + +func (c Core) OptionProxyChainUserName() (map[string]interface{}, error) { + return c.c.Request("core/view/optionProxyChainUserName/", nil) +} + +func (c Core) OptionSingleCookieRequestHeader() (map[string]interface{}, error) { + return c.c.Request("core/view/optionSingleCookieRequestHeader/", nil) +} + +// Gets the connection time out (in seconds). +func (c Core) OptionTimeoutInSecs() (map[string]interface{}, error) { + return c.c.Request("core/view/optionTimeoutInSecs/", nil) +} + +func (c Core) OptionUseProxyChain() (map[string]interface{}, error) { + return c.c.Request("core/view/optionUseProxyChain/", nil) +} + +func (c Core) OptionUseProxyChainAuth() (map[string]interface{}, error) { + return c.c.Request("core/view/optionUseProxyChainAuth/", nil) +} + +// Gets whether or not the SOCKS proxy should be used. +func (c Core) OptionUseSocksProxy() (map[string]interface{}, error) { + return c.c.Request("core/view/optionUseSocksProxy/", nil) +} + +// Convenient and simple action to access a URL, optionally following redirections. Returns the request sent and response received and followed redirections, if any. Other actions are available which offer more control on what is sent, like, 'sendRequest' or 'sendHarRequest'. +func (c Core) AccessUrl(url string, followredirects string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "followRedirects": followredirects, + } + return c.c.Request("core/action/accessUrl/", m) +} + +// Shuts down ZAP +func (c Core) Shutdown() (map[string]interface{}, error) { + return c.c.Request("core/action/shutdown/", nil) +} + +// Creates a new session, optionally overwriting existing files. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir. +func (c Core) NewSession(name string, overwrite string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + "overwrite": overwrite, + } + return c.c.Request("core/action/newSession/", m) +} + +// Loads the session with the given name. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir. +func (c Core) LoadSession(name string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + } + return c.c.Request("core/action/loadSession/", m) +} + +// Saves the session. +func (c Core) SaveSession(name string, overwrite string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + "overwrite": overwrite, + } + return c.c.Request("core/action/saveSession/", m) +} + +// Snapshots the session, optionally with the given name, and overwriting existing files. If no name is specified the name of the current session with a timestamp appended is used. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir. +func (c Core) SnapshotSession(name string, overwrite string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + "overwrite": overwrite, + } + return c.c.Request("core/action/snapshotSession/", m) +} + +// Clears the regexes of URLs excluded from the local proxies. +func (c Core) ClearExcludedFromProxy() (map[string]interface{}, error) { + return c.c.Request("core/action/clearExcludedFromProxy/", nil) +} + +// Adds a regex of URLs that should be excluded from the local proxies. +func (c Core) ExcludeFromProxy(regex string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + } + return c.c.Request("core/action/excludeFromProxy/", m) +} + +func (c Core) SetHomeDirectory(dir string) (map[string]interface{}, error) { + m := map[string]string{ + "dir": dir, + } + return c.c.Request("core/action/setHomeDirectory/", m) +} + +// Sets the mode, which may be one of [safe, protect, standard, attack] +func (c Core) SetMode(mode string) (map[string]interface{}, error) { + m := map[string]string{ + "mode": mode, + } + return c.c.Request("core/action/setMode/", m) +} + +// Generates a new Root CA certificate for the local proxies. +func (c Core) GenerateRootCA() (map[string]interface{}, error) { + return c.c.Request("core/action/generateRootCA/", nil) +} + +// Sends the HTTP request, optionally following redirections. Returns the request sent and response received and followed redirections, if any. The Mode is enforced when sending the request (and following redirections), custom manual requests are not allowed in 'Safe' mode nor in 'Protected' mode if out of scope. +func (c Core) SendRequest(request string, followredirects string) (map[string]interface{}, error) { + m := map[string]string{ + "request": request, + "followRedirects": followredirects, + } + return c.c.Request("core/action/sendRequest/", m) +} + +func (c Core) RunGarbageCollection() (map[string]interface{}, error) { + return c.c.Request("core/action/runGarbageCollection/", nil) +} + +// Deletes the site node found in the Sites Tree on the basis of the URL, HTTP method, and post data (if applicable and specified). +func (c Core) DeleteSiteNode(url string, method string, postdata string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "method": method, + "postData": postdata, + } + return c.c.Request("core/action/deleteSiteNode/", m) +} + +// Adds a domain to be excluded from the outgoing proxy, using the specified value. Optionally sets if the new entry is enabled (default, true) and whether or not the new value is specified as a regex (default, false). +func (c Core) AddProxyChainExcludedDomain(value string, isregex string, isenabled string) (map[string]interface{}, error) { + m := map[string]string{ + "value": value, + "isRegex": isregex, + "isEnabled": isenabled, + } + return c.c.Request("core/action/addProxyChainExcludedDomain/", m) +} + +// Modifies a domain excluded from the outgoing proxy. Allows to modify the value, if enabled or if a regex. The domain is selected with its index, which can be obtained with the view proxyChainExcludedDomains. +func (c Core) ModifyProxyChainExcludedDomain(idx string, value string, isregex string, isenabled string) (map[string]interface{}, error) { + m := map[string]string{ + "idx": idx, + "value": value, + "isRegex": isregex, + "isEnabled": isenabled, + } + return c.c.Request("core/action/modifyProxyChainExcludedDomain/", m) +} + +// Removes a domain excluded from the outgoing proxy, with the given index. The index can be obtained with the view proxyChainExcludedDomains. +func (c Core) RemoveProxyChainExcludedDomain(idx string) (map[string]interface{}, error) { + m := map[string]string{ + "idx": idx, + } + return c.c.Request("core/action/removeProxyChainExcludedDomain/", m) +} + +// Enables all domains excluded from the outgoing proxy. +func (c Core) EnableAllProxyChainExcludedDomains() (map[string]interface{}, error) { + return c.c.Request("core/action/enableAllProxyChainExcludedDomains/", nil) +} + +// Disables all domains excluded from the outgoing proxy. +func (c Core) DisableAllProxyChainExcludedDomains() (map[string]interface{}, error) { + return c.c.Request("core/action/disableAllProxyChainExcludedDomains/", nil) +} + +// Sets the maximum number of alert instances to include in a report. A value of zero is treated as unlimited. +func (c Core) SetOptionMaximumAlertInstances(numberofinstances string) (map[string]interface{}, error) { + m := map[string]string{ + "numberOfInstances": numberofinstances, + } + return c.c.Request("core/action/setOptionMaximumAlertInstances/", m) +} + +// Sets whether or not related alerts will be merged in any reports generated. +func (c Core) SetOptionMergeRelatedAlerts(enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "enabled": enabled, + } + return c.c.Request("core/action/setOptionMergeRelatedAlerts/", m) +} + +// Sets (or clears, if empty) the path to the file with alert overrides. +func (c Core) SetOptionAlertOverridesFilePath(filepath string) (map[string]interface{}, error) { + m := map[string]string{ + "filePath": filepath, + } + return c.c.Request("core/action/setOptionAlertOverridesFilePath/", m) +} + +// Enables use of a PKCS12 client certificate for the certificate with the given file system path, password, and optional index. +func (c Core) EnablePKCS12ClientCertificate(filepath string, password string, index string) (map[string]interface{}, error) { + m := map[string]string{ + "filePath": filepath, + "password": password, + "index": index, + } + return c.c.Request("core/action/enablePKCS12ClientCertificate/", m) +} + +// Disables the option for use of client certificates. +func (c Core) DisableClientCertificate() (map[string]interface{}, error) { + return c.c.Request("core/action/disableClientCertificate/", nil) +} + +// Create a zip file of the ZAP core and add-on SBOMs +func (c Core) CreateSbomZip(filepath string) (map[string]interface{}, error) { + m := map[string]string{ + "filePath": filepath, + } + return c.c.Request("core/action/createSbomZip/", m) +} + +// Deletes all alerts of the current session. +func (c Core) DeleteAllAlerts() (map[string]interface{}, error) { + return c.c.Request("core/action/deleteAllAlerts/", nil) +} + +// Deletes the alert with the given ID. +func (c Core) DeleteAlert(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return c.c.Request("core/action/deleteAlert/", m) +} + +// Sets the logging level for a given logger name. +func (c Core) SetLogLevel(name string, loglevel string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + "logLevel": loglevel, + } + return c.c.Request("core/action/setLogLevel/", m) +} + +// Sets the user agent that ZAP should use when creating HTTP messages (for example, spider messages or CONNECT requests to outgoing proxy). +func (c Core) SetOptionDefaultUserAgent(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return c.c.Request("core/action/setOptionDefaultUserAgent/", m) +} + +// Sets the TTL (in seconds) of successful DNS queries (applies after ZAP restart). +func (c Core) SetOptionDnsTtlSuccessfulQueries(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return c.c.Request("core/action/setOptionDnsTtlSuccessfulQueries/", m) +} + +func (c Core) SetOptionHttpStateEnabled(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return c.c.Request("core/action/setOptionHttpStateEnabled/", m) +} + +func (c Core) SetOptionProxyChainName(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return c.c.Request("core/action/setOptionProxyChainName/", m) +} + +func (c Core) SetOptionProxyChainPassword(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return c.c.Request("core/action/setOptionProxyChainPassword/", m) +} + +func (c Core) SetOptionProxyChainPort(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return c.c.Request("core/action/setOptionProxyChainPort/", m) +} + +func (c Core) SetOptionProxyChainPrompt(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return c.c.Request("core/action/setOptionProxyChainPrompt/", m) +} + +func (c Core) SetOptionProxyChainRealm(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return c.c.Request("core/action/setOptionProxyChainRealm/", m) +} + +// Use actions [add|modify|remove]ProxyChainExcludedDomain instead. +func (c Core) SetOptionProxyChainSkipName(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return c.c.Request("core/action/setOptionProxyChainSkipName/", m) +} + +func (c Core) SetOptionProxyChainUserName(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return c.c.Request("core/action/setOptionProxyChainUserName/", m) +} + +func (c Core) SetOptionSingleCookieRequestHeader(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return c.c.Request("core/action/setOptionSingleCookieRequestHeader/", m) +} + +// Sets the connection time out (in seconds). +func (c Core) SetOptionTimeoutInSecs(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return c.c.Request("core/action/setOptionTimeoutInSecs/", m) +} + +// Sets whether or not the outgoing proxy should be used. The address/hostname of the outgoing proxy must be set to enable this option. +func (c Core) SetOptionUseProxyChain(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return c.c.Request("core/action/setOptionUseProxyChain/", m) +} + +func (c Core) SetOptionUseProxyChainAuth(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return c.c.Request("core/action/setOptionUseProxyChainAuth/", m) +} + +// Sets whether or not the SOCKS proxy should be used. +func (c Core) SetOptionUseSocksProxy(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return c.c.Request("core/action/setOptionUseSocksProxy/", m) +} + +func (c Core) Proxypac() ([]byte, error) { + return c.c.RequestOther("core/other/proxy.pac/", nil) +} + +// Gets the Root CA certificate used by the local proxies. +func (c Core) Rootcert() ([]byte, error) { + return c.c.RequestOther("core/other/rootcert/", nil) +} + +func (c Core) Setproxy(proxy string) ([]byte, error) { + m := map[string]string{ + "proxy": proxy, + } + return c.c.RequestOther("core/other/setproxy/", m) +} + +// Generates a report in XML format +func (c Core) Xmlreport() ([]byte, error) { + return c.c.RequestOther("core/other/xmlreport/", nil) +} + +// Generates a report in HTML format +func (c Core) Htmlreport() ([]byte, error) { + return c.c.RequestOther("core/other/htmlreport/", nil) +} + +// Generates a report in JSON format +func (c Core) Jsonreport() ([]byte, error) { + return c.c.RequestOther("core/other/jsonreport/", nil) +} + +// Generates a report in Markdown format +func (c Core) Mdreport() ([]byte, error) { + return c.c.RequestOther("core/other/mdreport/", nil) +} + +// Gets the message with the given ID in HAR format +func (c Core) MessageHar(id string) ([]byte, error) { + m := map[string]string{ + "id": id, + } + return c.c.RequestOther("core/other/messageHar/", m) +} + +// Gets the HTTP messages sent through/by ZAP, in HAR format, optionally filtered by URL and paginated with 'start' position and 'count' of messages +func (c Core) MessagesHar(baseurl string, start string, count string) ([]byte, error) { + m := map[string]string{ + "baseurl": baseurl, + "start": start, + "count": count, + } + return c.c.RequestOther("core/other/messagesHar/", m) +} + +// Gets the HTTP messages with the given IDs, in HAR format. +func (c Core) MessagesHarById(ids string) ([]byte, error) { + m := map[string]string{ + "ids": ids, + } + return c.c.RequestOther("core/other/messagesHarById/", m) +} + +// Sends the first HAR request entry, optionally following redirections. Returns, in HAR format, the request sent and response received and followed redirections, if any. The Mode is enforced when sending the request (and following redirections), custom manual requests are not allowed in 'Safe' mode nor in 'Protected' mode if out of scope. +func (c Core) SendHarRequest(request string, followredirects string) ([]byte, error) { + m := map[string]string{ + "request": request, + "followRedirects": followredirects, + } + return c.c.RequestOther("core/other/sendHarRequest/", m) +} + +// Download a file from the transfer directory +func (c Core) FileDownload(filename string) ([]byte, error) { + m := map[string]string{ + "fileName": filename, + } + return c.c.RequestOther("core/other/fileDownload/", m) +} + +// Upload a file to the transfer directory. Only POST requests accepted with encodings of "multipart/form-data" or "application/x-www-form-urlencoded". +func (c Core) FileUpload(filename string, filecontents string) ([]byte, error) { + m := map[string]string{ + "fileName": filename, + "fileContents": filecontents, + } + return c.c.RequestOther("core/other/fileUpload/", m) +} diff --git a/zap-api-go/zap/custompayloads_generated.go b/zap-api-go/zap/custompayloads_generated.go new file mode 100644 index 0000000..b90368c --- /dev/null +++ b/zap-api-go/zap/custompayloads_generated.go @@ -0,0 +1,107 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Custompayloads struct { + c *Client +} + +// Lists all available categories. +// +// This component is optional and therefore the API will only work if it is installed +func (c Custompayloads) CustomPayloadsCategories() (map[string]interface{}, error) { + return c.c.Request("custompayloads/view/customPayloadsCategories/", nil) +} + +// Lists all the payloads currently loaded (category, payload, enabled state). Optionally filtered by category. +// +// This component is optional and therefore the API will only work if it is installed +func (c Custompayloads) CustomPayloads(category string) (map[string]interface{}, error) { + m := map[string]string{ + "category": category, + } + return c.c.Request("custompayloads/view/customPayloads/", m) +} + +// Disables payloads for a given category. +// +// This component is optional and therefore the API will only work if it is installed +func (c Custompayloads) DisableCustomPayloads(category string) (map[string]interface{}, error) { + m := map[string]string{ + "category": category, + } + return c.c.Request("custompayloads/action/disableCustomPayloads/", m) +} + +// Enables payloads for a given category. +// +// This component is optional and therefore the API will only work if it is installed +func (c Custompayloads) EnableCustomPayloads(category string) (map[string]interface{}, error) { + m := map[string]string{ + "category": category, + } + return c.c.Request("custompayloads/action/enableCustomPayloads/", m) +} + +// Removes a payload. +// +// This component is optional and therefore the API will only work if it is installed +func (c Custompayloads) RemoveCustomPayload(category string, payload string) (map[string]interface{}, error) { + m := map[string]string{ + "category": category, + "payload": payload, + } + return c.c.Request("custompayloads/action/removeCustomPayload/", m) +} + +// Adds a new payload. +// +// This component is optional and therefore the API will only work if it is installed +func (c Custompayloads) AddCustomPayload(category string, payload string) (map[string]interface{}, error) { + m := map[string]string{ + "category": category, + "payload": payload, + } + return c.c.Request("custompayloads/action/addCustomPayload/", m) +} + +// Enables a given payload. +// +// This component is optional and therefore the API will only work if it is installed +func (c Custompayloads) EnableCustomPayload(category string, payload string) (map[string]interface{}, error) { + m := map[string]string{ + "category": category, + "payload": payload, + } + return c.c.Request("custompayloads/action/enableCustomPayload/", m) +} + +// Disables a given payload. +// +// This component is optional and therefore the API will only work if it is installed +func (c Custompayloads) DisableCustomPayload(category string, payload string) (map[string]interface{}, error) { + m := map[string]string{ + "category": category, + "payload": payload, + } + return c.c.Request("custompayloads/action/disableCustomPayload/", m) +} diff --git a/zap-api-go/zap/exim_generated.go b/zap-api-go/zap/exim_generated.go new file mode 100644 index 0000000..b90f33a --- /dev/null +++ b/zap-api-go/zap/exim_generated.go @@ -0,0 +1,99 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Exim struct { + c *Client +} + +// Imports a HAR file. +// +// This component is optional and therefore the API will only work if it is installed +func (e Exim) ImportHar(filepath string) (map[string]interface{}, error) { + m := map[string]string{ + "filePath": filepath, + } + return e.c.Request("exim/action/importHar/", m) +} + +// Imports URLs (one per line) from the file with the given file system path. +// +// This component is optional and therefore the API will only work if it is installed +func (e Exim) ImportUrls(filepath string) (map[string]interface{}, error) { + m := map[string]string{ + "filePath": filepath, + } + return e.c.Request("exim/action/importUrls/", m) +} + +// Imports previously exported ZAP messages from the file with the given file system path. +// +// This component is optional and therefore the API will only work if it is installed +func (e Exim) ImportZapLogs(filepath string) (map[string]interface{}, error) { + m := map[string]string{ + "filePath": filepath, + } + return e.c.Request("exim/action/importZapLogs/", m) +} + +// Imports ModSecurity2 logs from the file with the given file system path. +// +// This component is optional and therefore the API will only work if it is installed +func (e Exim) ImportModsec2Logs(filepath string) (map[string]interface{}, error) { + m := map[string]string{ + "filePath": filepath, + } + return e.c.Request("exim/action/importModsec2Logs/", m) +} + +// Gets the HTTP messages sent through/by ZAP, in HAR format, optionally filtered by URL and paginated with 'start' position and 'count' of messages +// +// This component is optional and therefore the API will only work if it is installed +func (e Exim) ExportHar(baseurl string, start string, count string) ([]byte, error) { + m := map[string]string{ + "baseurl": baseurl, + "start": start, + "count": count, + } + return e.c.RequestOther("exim/other/exportHar/", m) +} + +// Gets the HTTP messages with the given IDs, in HAR format. +// +// This component is optional and therefore the API will only work if it is installed +func (e Exim) ExportHarById(ids string) ([]byte, error) { + m := map[string]string{ + "ids": ids, + } + return e.c.RequestOther("exim/other/exportHarById/", m) +} + +// Sends the first HAR request entry, optionally following redirections. Returns, in HAR format, the request sent and response received and followed redirections, if any. The Mode is enforced when sending the request (and following redirections), custom manual requests are not allowed in 'Safe' mode nor in 'Protected' mode if out of scope. +// +// This component is optional and therefore the API will only work if it is installed +func (e Exim) SendHarRequest(request string, followredirects string) ([]byte, error) { + m := map[string]string{ + "request": request, + "followRedirects": followredirects, + } + return e.c.RequestOther("exim/other/sendHarRequest/", m) +} diff --git a/zap-api-go/zap/forced-user_generated.go b/zap-api-go/zap/forced-user_generated.go new file mode 100644 index 0000000..118386b --- /dev/null +++ b/zap-api-go/zap/forced-user_generated.go @@ -0,0 +1,58 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +import "strconv" + +type ForcedUser struct { + c *Client +} + +// Returns 'true' if 'forced user' mode is enabled, 'false' otherwise +func (f ForcedUser) IsForcedUserModeEnabled() (map[string]interface{}, error) { + return f.c.Request("forcedUser/view/isForcedUserModeEnabled/", nil) +} + +// Gets the user (ID) set as 'forced user' for the given context (ID) +func (f ForcedUser) GetForcedUser(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return f.c.Request("forcedUser/view/getForcedUser/", m) +} + +// Sets the user (ID) that should be used in 'forced user' mode for the given context (ID) +func (f ForcedUser) SetForcedUser(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return f.c.Request("forcedUser/action/setForcedUser/", m) +} + +// Sets if 'forced user' mode should be enabled or not +func (f ForcedUser) SetForcedUserModeEnabled(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "boolean": strconv.FormatBool(boolean), + } + return f.c.Request("forcedUser/action/setForcedUserModeEnabled/", m) +} diff --git a/zap-api-go/zap/graphql_generated.go b/zap-api-go/zap/graphql_generated.go new file mode 100644 index 0000000..c4399ac --- /dev/null +++ b/zap-api-go/zap/graphql_generated.go @@ -0,0 +1,203 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +import "strconv" + +type Graphql struct { + c *Client +} + +// Returns how arguments are currently specified. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) OptionArgsType() (map[string]interface{}, error) { + return g.c.Request("graphql/view/optionArgsType/", nil) +} + +// Returns whether or not lenient maximum query generation depth is enabled. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) OptionLenientMaxQueryDepthEnabled() (map[string]interface{}, error) { + return g.c.Request("graphql/view/optionLenientMaxQueryDepthEnabled/", nil) +} + +// Returns the current maximum additional query generation depth. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) OptionMaxAdditionalQueryDepth() (map[string]interface{}, error) { + return g.c.Request("graphql/view/optionMaxAdditionalQueryDepth/", nil) +} + +// Returns the current maximum arguments generation depth. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) OptionMaxArgsDepth() (map[string]interface{}, error) { + return g.c.Request("graphql/view/optionMaxArgsDepth/", nil) +} + +// Returns the current maximum query generation depth. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) OptionMaxQueryDepth() (map[string]interface{}, error) { + return g.c.Request("graphql/view/optionMaxQueryDepth/", nil) +} + +// Returns whether or not optional arguments are currently specified. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) OptionOptionalArgsEnabled() (map[string]interface{}, error) { + return g.c.Request("graphql/view/optionOptionalArgsEnabled/", nil) +} + +// Returns whether the query generator is enabled. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) OptionQueryGenEnabled() (map[string]interface{}, error) { + return g.c.Request("graphql/view/optionQueryGenEnabled/", nil) +} + +// Returns the current level for which a single query is generated. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) OptionQuerySplitType() (map[string]interface{}, error) { + return g.c.Request("graphql/view/optionQuerySplitType/", nil) +} + +// Returns the current request method. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) OptionRequestMethod() (map[string]interface{}, error) { + return g.c.Request("graphql/view/optionRequestMethod/", nil) +} + +// Imports a GraphQL Schema from a File. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) ImportFile(endurl string, file string) (map[string]interface{}, error) { + m := map[string]string{ + "endurl": endurl, + "file": file, + } + return g.c.Request("graphql/action/importFile/", m) +} + +// Imports a GraphQL Schema from a URL. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) ImportUrl(endurl string, url string) (map[string]interface{}, error) { + m := map[string]string{ + "endurl": endurl, + "url": url, + } + return g.c.Request("graphql/action/importUrl/", m) +} + +// Sets how arguments are specified. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) SetOptionArgsType(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return g.c.Request("graphql/action/setOptionArgsType/", m) +} + +// Sets the level for which a single query is generated. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) SetOptionQuerySplitType(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return g.c.Request("graphql/action/setOptionQuerySplitType/", m) +} + +// Sets the request method. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) SetOptionRequestMethod(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return g.c.Request("graphql/action/setOptionRequestMethod/", m) +} + +// Sets whether or not Maximum Query Depth is enforced leniently. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) SetOptionLenientMaxQueryDepthEnabled(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return g.c.Request("graphql/action/setOptionLenientMaxQueryDepthEnabled/", m) +} + +// Sets the maximum additional query generation depth (used if enforced leniently). +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) SetOptionMaxAdditionalQueryDepth(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return g.c.Request("graphql/action/setOptionMaxAdditionalQueryDepth/", m) +} + +// Sets the maximum arguments generation depth. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) SetOptionMaxArgsDepth(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return g.c.Request("graphql/action/setOptionMaxArgsDepth/", m) +} + +// Sets the maximum query generation depth. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) SetOptionMaxQueryDepth(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return g.c.Request("graphql/action/setOptionMaxQueryDepth/", m) +} + +// Sets whether or not Optional Arguments should be specified. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) SetOptionOptionalArgsEnabled(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return g.c.Request("graphql/action/setOptionOptionalArgsEnabled/", m) +} + +// Sets whether the query generator is enabled. +// +// This component is optional and therefore the API will only work if it is installed +func (g Graphql) SetOptionQueryGenEnabled(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return g.c.Request("graphql/action/setOptionQueryGenEnabled/", m) +} diff --git a/zap-api-go/zap/http-sessions_generated.go b/zap-api-go/zap/http-sessions_generated.go new file mode 100644 index 0000000..c5ab160 --- /dev/null +++ b/zap-api-go/zap/http-sessions_generated.go @@ -0,0 +1,161 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type HttpSessions struct { + c *Client +} + +// Gets all of the sites that have sessions. +func (h HttpSessions) Sites() (map[string]interface{}, error) { + return h.c.Request("httpSessions/view/sites/", nil) +} + +// Gets the sessions for the given site. Optionally returning just the session with the given name. +func (h HttpSessions) Sessions(site string, session string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "session": session, + } + return h.c.Request("httpSessions/view/sessions/", m) +} + +// Gets the name of the active session for the given site. +func (h HttpSessions) ActiveSession(site string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + } + return h.c.Request("httpSessions/view/activeSession/", m) +} + +// Gets the names of the session tokens for the given site. +func (h HttpSessions) SessionTokens(site string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + } + return h.c.Request("httpSessions/view/sessionTokens/", m) +} + +// Gets the default session tokens. +func (h HttpSessions) DefaultSessionTokens() (map[string]interface{}, error) { + return h.c.Request("httpSessions/view/defaultSessionTokens/", nil) +} + +// Creates an empty session for the given site. Optionally with the given name. +func (h HttpSessions) CreateEmptySession(site string, session string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "session": session, + } + return h.c.Request("httpSessions/action/createEmptySession/", m) +} + +// Removes the session from the given site. +func (h HttpSessions) RemoveSession(site string, session string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "session": session, + } + return h.c.Request("httpSessions/action/removeSession/", m) +} + +// Sets the given session as active for the given site. +func (h HttpSessions) SetActiveSession(site string, session string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "session": session, + } + return h.c.Request("httpSessions/action/setActiveSession/", m) +} + +// Unsets the active session of the given site. +func (h HttpSessions) UnsetActiveSession(site string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + } + return h.c.Request("httpSessions/action/unsetActiveSession/", m) +} + +// Adds the session token to the given site. +func (h HttpSessions) AddSessionToken(site string, sessiontoken string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "sessionToken": sessiontoken, + } + return h.c.Request("httpSessions/action/addSessionToken/", m) +} + +// Removes the session token from the given site. +func (h HttpSessions) RemoveSessionToken(site string, sessiontoken string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "sessionToken": sessiontoken, + } + return h.c.Request("httpSessions/action/removeSessionToken/", m) +} + +// Sets the value of the session token of the given session for the given site. +func (h HttpSessions) SetSessionTokenValue(site string, session string, sessiontoken string, tokenvalue string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "session": session, + "sessionToken": sessiontoken, + "tokenValue": tokenvalue, + } + return h.c.Request("httpSessions/action/setSessionTokenValue/", m) +} + +// Renames the session of the given site. +func (h HttpSessions) RenameSession(site string, oldsessionname string, newsessionname string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "oldSessionName": oldsessionname, + "newSessionName": newsessionname, + } + return h.c.Request("httpSessions/action/renameSession/", m) +} + +// Adds a default session token with the given name and enabled state. +func (h HttpSessions) AddDefaultSessionToken(sessiontoken string, tokenenabled string) (map[string]interface{}, error) { + m := map[string]string{ + "sessionToken": sessiontoken, + "tokenEnabled": tokenenabled, + } + return h.c.Request("httpSessions/action/addDefaultSessionToken/", m) +} + +// Sets whether or not the default session token with the given name is enabled. +func (h HttpSessions) SetDefaultSessionTokenEnabled(sessiontoken string, tokenenabled string) (map[string]interface{}, error) { + m := map[string]string{ + "sessionToken": sessiontoken, + "tokenEnabled": tokenenabled, + } + return h.c.Request("httpSessions/action/setDefaultSessionTokenEnabled/", m) +} + +// Removes the default session token with the given name. +func (h HttpSessions) RemoveDefaultSessionToken(sessiontoken string) (map[string]interface{}, error) { + m := map[string]string{ + "sessionToken": sessiontoken, + } + return h.c.Request("httpSessions/action/removeDefaultSessionToken/", m) +} diff --git a/zap-api-go/zap/interface.go b/zap-api-go/zap/interface.go new file mode 100644 index 0000000..b731a6f --- /dev/null +++ b/zap-api-go/zap/interface.go @@ -0,0 +1,246 @@ +// Package zap defines the interface a ZAP client should implement +package zap + +// Interface defines the interface a ZAP client should implement +type Interface interface { + Alert() *Alert + Postman() *Postman + Authentication() *Authentication + Retest() *Retest + Network() *Network + Pnh() *Pnh + Graphql() *Graphql + Soap() *Soap + Spider() *Spider + Autoupdate() *Autoupdate + Core() *Core + Break() *Break + Exim() *Exim + Context() *Context + Pscan() *Pscan + ForcedUser() *ForcedUser + Script() *Script + Authorization() *Authorization + Automation() *Automation + Search() *Search + Reports() *Reports + Selenium() *Selenium + HttpSessions() *HttpSessions + Websocket() *Websocket + Openapi() *Openapi + AjaxSpider() *AjaxSpider + AccessControl() *AccessControl + Reveal() *Reveal + Params() *Params + Revisit() *Revisit + AlertFilter() *AlertFilter + Replacer() *Replacer + Users() *Users + Acsrf() *Acsrf + Ascan() *Ascan + Wappalyzer() *Wappalyzer + Stats() *Stats + RuleConfig() *RuleConfig + SessionManagement() *SessionManagement + Custompayloads() *Custompayloads +} + +// Alert() returns a Alert client +func (c *Client) Alert() *Alert { + return &Alert{c} +} + +// Postman() returns a Postman client +func (c *Client) Postman() *Postman { + return &Postman{c} +} + +// Authentication() returns a Authentication client +func (c *Client) Authentication() *Authentication { + return &Authentication{c} +} + +// Retest() returns a Retest client +func (c *Client) Retest() *Retest { + return &Retest{c} +} + +// Network() returns a Network client +func (c *Client) Network() *Network { + return &Network{c} +} + +// Pnh() returns a Pnh client +func (c *Client) Pnh() *Pnh { + return &Pnh{c} +} + +// Graphql() returns a Graphql client +func (c *Client) Graphql() *Graphql { + return &Graphql{c} +} + +// Soap() returns a Soap client +func (c *Client) Soap() *Soap { + return &Soap{c} +} + +// Spider() returns a Spider client +func (c *Client) Spider() *Spider { + return &Spider{c} +} + +// Autoupdate() returns a Autoupdate client +func (c *Client) Autoupdate() *Autoupdate { + return &Autoupdate{c} +} + +// Core() returns a Core client +func (c *Client) Core() *Core { + return &Core{c} +} + +// Break() returns a Break client +func (c *Client) Break() *Break { + return &Break{c} +} + +// Exim() returns a Exim client +func (c *Client) Exim() *Exim { + return &Exim{c} +} + +// Context() returns a Context client +func (c *Client) Context() *Context { + return &Context{c} +} + +// Pscan() returns a Pscan client +func (c *Client) Pscan() *Pscan { + return &Pscan{c} +} + +// ForcedUser() returns a ForcedUser client +func (c *Client) ForcedUser() *ForcedUser { + return &ForcedUser{c} +} + +// Script() returns a Script client +func (c *Client) Script() *Script { + return &Script{c} +} + +// Authorization() returns a Authorization client +func (c *Client) Authorization() *Authorization { + return &Authorization{c} +} + +// Automation() returns a Automation client +func (c *Client) Automation() *Automation { + return &Automation{c} +} + +// Search() returns a Search client +func (c *Client) Search() *Search { + return &Search{c} +} + +// Reports() returns a Reports client +func (c *Client) Reports() *Reports { + return &Reports{c} +} + +// Selenium() returns a Selenium client +func (c *Client) Selenium() *Selenium { + return &Selenium{c} +} + +// HttpSessions() returns a HttpSessions client +func (c *Client) HttpSessions() *HttpSessions { + return &HttpSessions{c} +} + +// Websocket() returns a Websocket client +func (c *Client) Websocket() *Websocket { + return &Websocket{c} +} + +// Openapi() returns a Openapi client +func (c *Client) Openapi() *Openapi { + return &Openapi{c} +} + +// AjaxSpider() returns a AjaxSpider client +func (c *Client) AjaxSpider() *AjaxSpider { + return &AjaxSpider{c} +} + +// AccessControl() returns a AccessControl client +func (c *Client) AccessControl() *AccessControl { + return &AccessControl{c} +} + +// Reveal() returns a Reveal client +func (c *Client) Reveal() *Reveal { + return &Reveal{c} +} + +// Params() returns a Params client +func (c *Client) Params() *Params { + return &Params{c} +} + +// Revisit() returns a Revisit client +func (c *Client) Revisit() *Revisit { + return &Revisit{c} +} + +// AlertFilter() returns a AlertFilter client +func (c *Client) AlertFilter() *AlertFilter { + return &AlertFilter{c} +} + +// Replacer() returns a Replacer client +func (c *Client) Replacer() *Replacer { + return &Replacer{c} +} + +// Users() returns a Users client +func (c *Client) Users() *Users { + return &Users{c} +} + +// Acsrf() returns a Acsrf client +func (c *Client) Acsrf() *Acsrf { + return &Acsrf{c} +} + +// Ascan() returns a Ascan client +func (c *Client) Ascan() *Ascan { + return &Ascan{c} +} + +// Wappalyzer() returns a Wappalyzer client +func (c *Client) Wappalyzer() *Wappalyzer { + return &Wappalyzer{c} +} + +// Stats() returns a Stats client +func (c *Client) Stats() *Stats { + return &Stats{c} +} + +// RuleConfig() returns a RuleConfig client +func (c *Client) RuleConfig() *RuleConfig { + return &RuleConfig{c} +} + +// SessionManagement() returns a SessionManagement client +func (c *Client) SessionManagement() *SessionManagement { + return &SessionManagement{c} +} + +// Custompayloads() returns a Custompayloads client +func (c *Client) Custompayloads() *Custompayloads { + return &Custompayloads{c} +} diff --git a/zap-api-go/zap/network_generated.go b/zap-api-go/zap/network_generated.go new file mode 100644 index 0000000..dcf0540 --- /dev/null +++ b/zap-api-go/zap/network_generated.go @@ -0,0 +1,479 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Network struct { + c *Client +} + +// Gets the Root CA certificate validity, in days. Used when generating a new Root CA certificate. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) GetRootCaCertValidity() (map[string]interface{}, error) { + return n.c.Request("network/view/getRootCaCertValidity/", nil) +} + +// Gets the server certificate validity, in days. Used when generating server certificates. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) GetServerCertValidity() (map[string]interface{}, error) { + return n.c.Request("network/view/getServerCertValidity/", nil) +} + +// Gets the aliases used to identify the local servers/proxies. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) GetAliases() (map[string]interface{}, error) { + return n.c.Request("network/view/getAliases/", nil) +} + +// Gets the local servers/proxies. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) GetLocalServers() (map[string]interface{}, error) { + return n.c.Request("network/view/getLocalServers/", nil) +} + +// Gets the authorities that will pass-through the local proxies. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) GetPassThroughs() (map[string]interface{}, error) { + return n.c.Request("network/view/getPassThroughs/", nil) +} + +// Gets the connection timeout, in seconds. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) GetConnectionTimeout() (map[string]interface{}, error) { + return n.c.Request("network/view/getConnectionTimeout/", nil) +} + +// Gets the default user-agent. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) GetDefaultUserAgent() (map[string]interface{}, error) { + return n.c.Request("network/view/getDefaultUserAgent/", nil) +} + +// Gets the TTL (in seconds) of successful DNS queries. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) GetDnsTtlSuccessfulQueries() (map[string]interface{}, error) { + return n.c.Request("network/view/getDnsTtlSuccessfulQueries/", nil) +} + +// Gets the HTTP proxy. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) GetHttpProxy() (map[string]interface{}, error) { + return n.c.Request("network/view/getHttpProxy/", nil) +} + +// Gets the HTTP proxy exclusions. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) GetHttpProxyExclusions() (map[string]interface{}, error) { + return n.c.Request("network/view/getHttpProxyExclusions/", nil) +} + +// Gets the SOCKS proxy. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) GetSocksProxy() (map[string]interface{}, error) { + return n.c.Request("network/view/getSocksProxy/", nil) +} + +// Tells whether or not the HTTP proxy authentication is enabled. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) IsHttpProxyAuthEnabled() (map[string]interface{}, error) { + return n.c.Request("network/view/isHttpProxyAuthEnabled/", nil) +} + +// Tells whether or not the HTTP proxy is enabled. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) IsHttpProxyEnabled() (map[string]interface{}, error) { + return n.c.Request("network/view/isHttpProxyEnabled/", nil) +} + +// Tells whether or not the SOCKS proxy is enabled. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) IsSocksProxyEnabled() (map[string]interface{}, error) { + return n.c.Request("network/view/isSocksProxyEnabled/", nil) +} + +// Tells whether or not to use global HTTP state. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) IsUseGlobalHttpState() (map[string]interface{}, error) { + return n.c.Request("network/view/isUseGlobalHttpState/", nil) +} + +// List of rate limit rules. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) GetRateLimitRules() (map[string]interface{}, error) { + return n.c.Request("network/view/getRateLimitRules/", nil) +} + +// Generates a new Root CA certificate, used to issue server certificates. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) GenerateRootCaCert() (map[string]interface{}, error) { + return n.c.Request("network/action/generateRootCaCert/", nil) +} + +// Imports a Root CA certificate to be used to issue server certificates. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) ImportRootCaCert(filepath string) (map[string]interface{}, error) { + m := map[string]string{ + "filePath": filepath, + } + return n.c.Request("network/action/importRootCaCert/", m) +} + +// Sets the Root CA certificate validity. Used when generating a new Root CA certificate. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetRootCaCertValidity(validity string) (map[string]interface{}, error) { + m := map[string]string{ + "validity": validity, + } + return n.c.Request("network/action/setRootCaCertValidity/", m) +} + +// Sets the server certificate validity. Used when generating server certificates. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetServerCertValidity(validity string) (map[string]interface{}, error) { + m := map[string]string{ + "validity": validity, + } + return n.c.Request("network/action/setServerCertValidity/", m) +} + +// Adds an alias for the local servers/proxies. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) AddAlias(name string, enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + "enabled": enabled, + } + return n.c.Request("network/action/addAlias/", m) +} + +// Adds a local server/proxy. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) AddLocalServer(address string, port string, api string, proxy string, behindnat string, decoderesponse string, removeacceptencoding string) (map[string]interface{}, error) { + m := map[string]string{ + "address": address, + "port": port, + "api": api, + "proxy": proxy, + "behindNat": behindnat, + "decodeResponse": decoderesponse, + "removeAcceptEncoding": removeacceptencoding, + } + return n.c.Request("network/action/addLocalServer/", m) +} + +// Adds an authority to pass-through the local proxies. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) AddPassThrough(authority string, enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "authority": authority, + "enabled": enabled, + } + return n.c.Request("network/action/addPassThrough/", m) +} + +// Removes an alias. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) RemoveAlias(name string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + } + return n.c.Request("network/action/removeAlias/", m) +} + +// Removes a local server/proxy. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) RemoveLocalServer(address string, port string) (map[string]interface{}, error) { + m := map[string]string{ + "address": address, + "port": port, + } + return n.c.Request("network/action/removeLocalServer/", m) +} + +// Removes a pass-through. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) RemovePassThrough(authority string) (map[string]interface{}, error) { + m := map[string]string{ + "authority": authority, + } + return n.c.Request("network/action/removePassThrough/", m) +} + +// Sets whether or not an alias is enabled. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetAliasEnabled(name string, enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "name": name, + "enabled": enabled, + } + return n.c.Request("network/action/setAliasEnabled/", m) +} + +// Sets whether or not a pass-through is enabled. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetPassThroughEnabled(authority string, enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "authority": authority, + "enabled": enabled, + } + return n.c.Request("network/action/setPassThroughEnabled/", m) +} + +// Sets the timeout, for reads and connects. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetConnectionTimeout(timeout string) (map[string]interface{}, error) { + m := map[string]string{ + "timeout": timeout, + } + return n.c.Request("network/action/setConnectionTimeout/", m) +} + +// Sets the default user-agent. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetDefaultUserAgent(useragent string) (map[string]interface{}, error) { + m := map[string]string{ + "userAgent": useragent, + } + return n.c.Request("network/action/setDefaultUserAgent/", m) +} + +// Sets the TTL of successful DNS queries. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetDnsTtlSuccessfulQueries(ttl string) (map[string]interface{}, error) { + m := map[string]string{ + "ttl": ttl, + } + return n.c.Request("network/action/setDnsTtlSuccessfulQueries/", m) +} + +// Adds a host to be excluded from the HTTP proxy. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) AddHttpProxyExclusion(host string, enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "host": host, + "enabled": enabled, + } + return n.c.Request("network/action/addHttpProxyExclusion/", m) +} + +// Removes an HTTP proxy exclusion. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) RemoveHttpProxyExclusion(host string) (map[string]interface{}, error) { + m := map[string]string{ + "host": host, + } + return n.c.Request("network/action/removeHttpProxyExclusion/", m) +} + +// Sets the HTTP proxy configuration. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetHttpProxy(host string, port string, realm string, username string, password string) (map[string]interface{}, error) { + m := map[string]string{ + "host": host, + "port": port, + "realm": realm, + "username": username, + "password": password, + } + return n.c.Request("network/action/setHttpProxy/", m) +} + +// Sets whether or not the HTTP proxy authentication is enabled. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetHttpProxyAuthEnabled(enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "enabled": enabled, + } + return n.c.Request("network/action/setHttpProxyAuthEnabled/", m) +} + +// Sets whether or not the HTTP proxy is enabled. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetHttpProxyEnabled(enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "enabled": enabled, + } + return n.c.Request("network/action/setHttpProxyEnabled/", m) +} + +// Sets whether or not an HTTP proxy exclusion is enabled. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetHttpProxyExclusionEnabled(host string, enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "host": host, + "enabled": enabled, + } + return n.c.Request("network/action/setHttpProxyExclusionEnabled/", m) +} + +// Sets the SOCKS proxy configuration. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetSocksProxy(host string, port string, version string, usedns string, username string, password string) (map[string]interface{}, error) { + m := map[string]string{ + "host": host, + "port": port, + "version": version, + "useDns": usedns, + "username": username, + "password": password, + } + return n.c.Request("network/action/setSocksProxy/", m) +} + +// Sets whether or not the SOCKS proxy is enabled. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetSocksProxyEnabled(enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "enabled": enabled, + } + return n.c.Request("network/action/setSocksProxyEnabled/", m) +} + +// Sets whether or not to use the global HTTP state. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetUseGlobalHttpState(use string) (map[string]interface{}, error) { + m := map[string]string{ + "use": use, + } + return n.c.Request("network/action/setUseGlobalHttpState/", m) +} + +// Adds a client certificate contained in a PKCS#12 file, the certificate is automatically set as active and used. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) AddPkcs12ClientCertificate(filepath string, password string, index string) (map[string]interface{}, error) { + m := map[string]string{ + "filePath": filepath, + "password": password, + "index": index, + } + return n.c.Request("network/action/addPkcs12ClientCertificate/", m) +} + +// Sets whether or not to use the active client certificate. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetUseClientCertificate(use string) (map[string]interface{}, error) { + m := map[string]string{ + "use": use, + } + return n.c.Request("network/action/setUseClientCertificate/", m) +} + +// Adds a rate limit rule +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) AddRateLimitRule(description string, enabled string, matchregex string, matchstring string, requestspersecond string, groupby string) (map[string]interface{}, error) { + m := map[string]string{ + "description": description, + "enabled": enabled, + "matchRegex": matchregex, + "matchString": matchstring, + "requestsPerSecond": requestspersecond, + "groupBy": groupby, + } + return n.c.Request("network/action/addRateLimitRule/", m) +} + +// Remove a rate limit rule +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) RemoveRateLimitRule(description string) (map[string]interface{}, error) { + m := map[string]string{ + "description": description, + } + return n.c.Request("network/action/removeRateLimitRule/", m) +} + +// Set enabled state for a rate limit rule. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetRateLimitRuleEnabled(description string, enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "description": description, + "enabled": enabled, + } + return n.c.Request("network/action/setRateLimitRuleEnabled/", m) +} + +// Provides a PAC file, proxying through the main proxy. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) Proxypac() ([]byte, error) { + return n.c.RequestOther("network/other/proxy.pac/", nil) +} + +// Sets the HTTP proxy configuration. +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) SetProxy(proxy string) ([]byte, error) { + m := map[string]string{ + "proxy": proxy, + } + return n.c.RequestOther("network/other/setProxy/", m) +} + +// Gets the Root CA certificate used to issue server certificates. Suitable to import into client applications (e.g. browsers). +// +// This component is optional and therefore the API will only work if it is installed +func (n Network) RootCaCert() ([]byte, error) { + return n.c.RequestOther("network/other/rootCaCert/", nil) +} diff --git a/zap-api-go/zap/openapi_generated.go b/zap-api-go/zap/openapi_generated.go new file mode 100644 index 0000000..9daf4dd --- /dev/null +++ b/zap-api-go/zap/openapi_generated.go @@ -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 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Openapi struct { + c *Client +} + +// Imports an OpenAPI definition from a local file. +// +// This component is optional and therefore the API will only work if it is installed +func (o Openapi) ImportFile(file string, target string, contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "file": file, + "target": target, + "contextId": contextid, + } + return o.c.Request("openapi/action/importFile/", m) +} + +// Imports an OpenAPI definition from a URL. +// +// This component is optional and therefore the API will only work if it is installed +func (o Openapi) ImportUrl(url string, hostoverride string, contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "hostOverride": hostoverride, + "contextId": contextid, + } + return o.c.Request("openapi/action/importUrl/", m) +} diff --git a/zap-api-go/zap/params_generated.go b/zap-api-go/zap/params_generated.go new file mode 100644 index 0000000..3504084 --- /dev/null +++ b/zap-api-go/zap/params_generated.go @@ -0,0 +1,34 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Params struct { + c *Client +} + +// Shows the parameters for the specified site, or for all sites if the site is not specified +func (p Params) Params(site string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + } + return p.c.Request("params/view/params/", m) +} diff --git a/zap-api-go/zap/pnh_generated.go b/zap-api-go/zap/pnh_generated.go new file mode 100644 index 0000000..3e5f36d --- /dev/null +++ b/zap-api-go/zap/pnh_generated.go @@ -0,0 +1,79 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Pnh struct { + c *Client +} + +// This component is optional and therefore the API will only work if it is installed +func (p Pnh) Monitor(id string, message string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + "message": message, + } + return p.c.Request("pnh/action/monitor/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (p Pnh) Oracle(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return p.c.Request("pnh/action/oracle/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (p Pnh) StartMonitoring(url string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + } + return p.c.Request("pnh/action/startMonitoring/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (p Pnh) StopMonitoring(id string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + } + return p.c.Request("pnh/action/stopMonitoring/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (p Pnh) Pnh() ([]byte, error) { + return p.c.RequestOther("pnh/other/pnh/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (p Pnh) Manifest() ([]byte, error) { + return p.c.RequestOther("pnh/other/manifest/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (p Pnh) Service() ([]byte, error) { + return p.c.RequestOther("pnh/other/service/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (p Pnh) Fx_pnhxpi() ([]byte, error) { + return p.c.RequestOther("pnh/other/fx_pnh.xpi/", nil) +} diff --git a/zap-api-go/zap/postman_generated.go b/zap-api-go/zap/postman_generated.go new file mode 100644 index 0000000..0b3cfcd --- /dev/null +++ b/zap-api-go/zap/postman_generated.go @@ -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 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Postman struct { + c *Client +} + +// This component is optional and therefore the API will only work if it is installed +func (p Postman) ImportFile(file string, endpointurl string) (map[string]interface{}, error) { + m := map[string]string{ + "file": file, + "endpointUrl": endpointurl, + } + return p.c.Request("postman/action/importFile/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (p Postman) ImportUrl(url string, endpointurl string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "endpointUrl": endpointurl, + } + return p.c.Request("postman/action/importUrl/", m) +} diff --git a/zap-api-go/zap/pscan_generated.go b/zap-api-go/zap/pscan_generated.go new file mode 100644 index 0000000..a6b566a --- /dev/null +++ b/zap-api-go/zap/pscan_generated.go @@ -0,0 +1,164 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Pscan struct { + c *Client +} + +// Tells whether or not the passive scan should be performed only on messages that are in scope. +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) ScanOnlyInScope() (map[string]interface{}, error) { + return p.c.Request("pscan/view/scanOnlyInScope/", nil) +} + +// The number of records the passive scanner still has to scan. +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) RecordsToScan() (map[string]interface{}, error) { + return p.c.Request("pscan/view/recordsToScan/", nil) +} + +// Lists all passive scan rules with their ID, name, enabled state, and alert threshold. +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) Scanners() (map[string]interface{}, error) { + return p.c.Request("pscan/view/scanners/", nil) +} + +// Shows information about the passive scan rule currently being run (if any). +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) CurrentRule() (map[string]interface{}, error) { + return p.c.Request("pscan/view/currentRule/", nil) +} + +// Shows information about the passive scan tasks currently being run (if any). +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) CurrentTasks() (map[string]interface{}, error) { + return p.c.Request("pscan/view/currentTasks/", nil) +} + +// Gets the maximum number of alerts a passive scan rule should raise. +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) MaxAlertsPerRule() (map[string]interface{}, error) { + return p.c.Request("pscan/view/maxAlertsPerRule/", nil) +} + +// Sets whether or not the passive scanning is enabled (Note: the enabled state is not persisted). +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) SetEnabled(enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "enabled": enabled, + } + return p.c.Request("pscan/action/setEnabled/", m) +} + +// Sets whether or not the passive scan should be performed only on messages that are in scope. +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) SetScanOnlyInScope(onlyinscope string) (map[string]interface{}, error) { + m := map[string]string{ + "onlyInScope": onlyinscope, + } + return p.c.Request("pscan/action/setScanOnlyInScope/", m) +} + +// Enables all passive scan rules. +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) EnableAllScanners() (map[string]interface{}, error) { + return p.c.Request("pscan/action/enableAllScanners/", nil) +} + +// Disables all passive scan rules. +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) DisableAllScanners() (map[string]interface{}, error) { + return p.c.Request("pscan/action/disableAllScanners/", nil) +} + +// Enables passive scan rules. +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) EnableScanners(ids string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + } + return p.c.Request("pscan/action/enableScanners/", m) +} + +// Disables passive scan rules. +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) DisableScanners(ids string) (map[string]interface{}, error) { + m := map[string]string{ + "ids": ids, + } + return p.c.Request("pscan/action/disableScanners/", m) +} + +// Sets the alert threshold of a passive scan rule. +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) SetScannerAlertThreshold(id string, alertthreshold string) (map[string]interface{}, error) { + m := map[string]string{ + "id": id, + "alertThreshold": alertthreshold, + } + return p.c.Request("pscan/action/setScannerAlertThreshold/", m) +} + +// Sets the maximum number of alerts a passive scan rule can raise. +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) SetMaxAlertsPerRule(maxalerts string) (map[string]interface{}, error) { + m := map[string]string{ + "maxAlerts": maxalerts, + } + return p.c.Request("pscan/action/setMaxAlertsPerRule/", m) +} + +// Disables all passive scan tags. +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) DisableAllTags() (map[string]interface{}, error) { + return p.c.Request("pscan/action/disableAllTags/", nil) +} + +// Enables all passive scan tags. +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) EnableAllTags() (map[string]interface{}, error) { + return p.c.Request("pscan/action/enableAllTags/", nil) +} + +// Clears the passive scan queue. +// +// This component is optional and therefore the API will only work if it is installed +func (p Pscan) ClearQueue() (map[string]interface{}, error) { + return p.c.Request("pscan/action/clearQueue/", nil) +} diff --git a/zap-api-go/zap/replacer_generated.go b/zap-api-go/zap/replacer_generated.go new file mode 100644 index 0000000..bec9431 --- /dev/null +++ b/zap-api-go/zap/replacer_generated.go @@ -0,0 +1,71 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Replacer struct { + c *Client +} + +// Returns full details of all of the rules +// +// This component is optional and therefore the API will only work if it is installed +func (r Replacer) Rules() (map[string]interface{}, error) { + return r.c.Request("replacer/view/rules/", nil) +} + +// Adds a replacer rule. For the parameters: desc is a user friendly description, enabled is true or false, matchType is one of [REQ_HEADER, REQ_HEADER_STR, REQ_BODY_STR, RESP_HEADER, RESP_HEADER_STR, RESP_BODY_STR], matchRegex should be true if the matchString should be treated as a regex otherwise false, matchString is the string that will be matched against, replacement is the replacement string, initiators may be blank (for all initiators) or a comma separated list of integers as defined in HttpSender +// +// This component is optional and therefore the API will only work if it is installed +func (r Replacer) AddRule(description string, enabled string, matchtype string, matchregex string, matchstring string, replacement string, initiators string, url string) (map[string]interface{}, error) { + m := map[string]string{ + "description": description, + "enabled": enabled, + "matchType": matchtype, + "matchRegex": matchregex, + "matchString": matchstring, + "replacement": replacement, + "initiators": initiators, + "url": url, + } + return r.c.Request("replacer/action/addRule/", m) +} + +// Removes the rule with the given description +// +// This component is optional and therefore the API will only work if it is installed +func (r Replacer) RemoveRule(description string) (map[string]interface{}, error) { + m := map[string]string{ + "description": description, + } + return r.c.Request("replacer/action/removeRule/", m) +} + +// Enables or disables the rule with the given description based on the bool parameter +// +// This component is optional and therefore the API will only work if it is installed +func (r Replacer) SetEnabled(description string, bool string) (map[string]interface{}, error) { + m := map[string]string{ + "description": description, + "bool": bool, + } + return r.c.Request("replacer/action/setEnabled/", m) +} diff --git a/zap-api-go/zap/reports_generated.go b/zap-api-go/zap/reports_generated.go new file mode 100644 index 0000000..0725bfd --- /dev/null +++ b/zap-api-go/zap/reports_generated.go @@ -0,0 +1,65 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Reports struct { + c *Client +} + +// View available templates. +// +// This component is optional and therefore the API will only work if it is installed +func (r Reports) Templates() (map[string]interface{}, error) { + return r.c.Request("reports/view/templates/", nil) +} + +// View details of the specified template. +// +// This component is optional and therefore the API will only work if it is installed +func (r Reports) TemplateDetails(template string) (map[string]interface{}, error) { + m := map[string]string{ + "template": template, + } + return r.c.Request("reports/view/templateDetails/", m) +} + +// Generate a report with the supplied parameters. +// +// This component is optional and therefore the API will only work if it is installed +func (r Reports) Generate(title string, template string, theme string, description string, contexts string, sites string, sections string, includedconfidences string, includedrisks string, reportfilename string, reportfilenamepattern string, reportdir string, display string) (map[string]interface{}, error) { + m := map[string]string{ + "title": title, + "template": template, + "theme": theme, + "description": description, + "contexts": contexts, + "sites": sites, + "sections": sections, + "includedConfidences": includedconfidences, + "includedRisks": includedrisks, + "reportFileName": reportfilename, + "reportFileNamePattern": reportfilenamepattern, + "reportDir": reportdir, + "display": display, + } + return r.c.Request("reports/action/generate/", m) +} diff --git a/zap-api-go/zap/retest_generated.go b/zap-api-go/zap/retest_generated.go new file mode 100644 index 0000000..3352f6b --- /dev/null +++ b/zap-api-go/zap/retest_generated.go @@ -0,0 +1,34 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Retest struct { + c *Client +} + +// This component is optional and therefore the API will only work if it is installed +func (r Retest) Retest(alertids string) (map[string]interface{}, error) { + m := map[string]string{ + "alertIds": alertids, + } + return r.c.Request("retest/action/retest/", m) +} diff --git a/zap-api-go/zap/reveal_generated.go b/zap-api-go/zap/reveal_generated.go new file mode 100644 index 0000000..48b0929 --- /dev/null +++ b/zap-api-go/zap/reveal_generated.go @@ -0,0 +1,43 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Reveal struct { + c *Client +} + +// Tells if shows hidden fields and enables disabled fields +// +// This component is optional and therefore the API will only work if it is installed +func (r Reveal) Reveal() (map[string]interface{}, error) { + return r.c.Request("reveal/view/reveal/", nil) +} + +// Sets if shows hidden fields and enables disabled fields +// +// This component is optional and therefore the API will only work if it is installed +func (r Reveal) SetReveal(reveal string) (map[string]interface{}, error) { + m := map[string]string{ + "reveal": reveal, + } + return r.c.Request("reveal/action/setReveal/", m) +} diff --git a/zap-api-go/zap/revisit_generated.go b/zap-api-go/zap/revisit_generated.go new file mode 100644 index 0000000..2b5a2e3 --- /dev/null +++ b/zap-api-go/zap/revisit_generated.go @@ -0,0 +1,49 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Revisit struct { + c *Client +} + +// This component is optional and therefore the API will only work if it is installed +func (r Revisit) RevisitList() (map[string]interface{}, error) { + return r.c.Request("revisit/view/revisitList/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (r Revisit) RevisitSiteOn(site string, starttime string, endtime string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "startTime": starttime, + "endTime": endtime, + } + return r.c.Request("revisit/action/revisitSiteOn/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (r Revisit) RevisitSiteOff(site string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + } + return r.c.Request("revisit/action/revisitSiteOff/", m) +} diff --git a/zap-api-go/zap/rule-config_generated.go b/zap-api-go/zap/rule-config_generated.go new file mode 100644 index 0000000..2c62970 --- /dev/null +++ b/zap-api-go/zap/rule-config_generated.go @@ -0,0 +1,61 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type RuleConfig struct { + c *Client +} + +// Show the specified rule configuration +func (r RuleConfig) RuleConfigValue(key string) (map[string]interface{}, error) { + m := map[string]string{ + "key": key, + } + return r.c.Request("ruleConfig/view/ruleConfigValue/", m) +} + +// Show all of the rule configurations +func (r RuleConfig) AllRuleConfigs() (map[string]interface{}, error) { + return r.c.Request("ruleConfig/view/allRuleConfigs/", nil) +} + +// Reset the specified rule configuration, which must already exist +func (r RuleConfig) ResetRuleConfigValue(key string) (map[string]interface{}, error) { + m := map[string]string{ + "key": key, + } + return r.c.Request("ruleConfig/action/resetRuleConfigValue/", m) +} + +// Reset all of the rule configurations +func (r RuleConfig) ResetAllRuleConfigValues() (map[string]interface{}, error) { + return r.c.Request("ruleConfig/action/resetAllRuleConfigValues/", nil) +} + +// Set the specified rule configuration, which must already exist +func (r RuleConfig) SetRuleConfigValue(key string, value string) (map[string]interface{}, error) { + m := map[string]string{ + "key": key, + "value": value, + } + return r.c.Request("ruleConfig/action/setRuleConfigValue/", m) +} diff --git a/zap-api-go/zap/script_generated.go b/zap-api-go/zap/script_generated.go new file mode 100644 index 0000000..fcfa5db --- /dev/null +++ b/zap-api-go/zap/script_generated.go @@ -0,0 +1,260 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Script struct { + c *Client +} + +// Lists the script engines available +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) ListEngines() (map[string]interface{}, error) { + return s.c.Request("script/view/listEngines/", nil) +} + +// Lists the script types available. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) ListTypes() (map[string]interface{}, error) { + return s.c.Request("script/view/listTypes/", nil) +} + +// Lists the scripts available, with its engine, name, description, type and error state. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) ListScripts() (map[string]interface{}, error) { + return s.c.Request("script/view/listScripts/", nil) +} + +// Gets the value of the global variable with the given key. Returns an API error (DOES_NOT_EXIST) if no value was previously set. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) GlobalVar(varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "varKey": varkey, + } + return s.c.Request("script/view/globalVar/", m) +} + +// Gets the value (string representation) of a global custom variable. Returns an API error (DOES_NOT_EXIST) if no value was previously set. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) GlobalCustomVar(varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "varKey": varkey, + } + return s.c.Request("script/view/globalCustomVar/", m) +} + +// Gets all the global variables (key/value pairs). +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) GlobalVars() (map[string]interface{}, error) { + return s.c.Request("script/view/globalVars/", nil) +} + +// Gets all the global custom variables (key/value pairs, the value is the string representation). +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) GlobalCustomVars() (map[string]interface{}, error) { + return s.c.Request("script/view/globalCustomVars/", nil) +} + +// Gets the value of the variable with the given key for the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists or if no value was previously set. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) ScriptVar(scriptname string, varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + "varKey": varkey, + } + return s.c.Request("script/view/scriptVar/", m) +} + +// Gets the value (string representation) of a custom variable. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists or if no value was previously set. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) ScriptCustomVar(scriptname string, varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + "varKey": varkey, + } + return s.c.Request("script/view/scriptCustomVar/", m) +} + +// Gets all the variables (key/value pairs) of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) ScriptVars(scriptname string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + } + return s.c.Request("script/view/scriptVars/", m) +} + +// Gets all the custom variables (key/value pairs, the value is the string representation) of a script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) ScriptCustomVars(scriptname string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + } + return s.c.Request("script/view/scriptCustomVars/", m) +} + +// Enables the script with the given name +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) Enable(scriptname string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + } + return s.c.Request("script/action/enable/", m) +} + +// Disables the script with the given name +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) Disable(scriptname string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + } + return s.c.Request("script/action/disable/", m) +} + +// Loads a script into ZAP from the given local file, with the given name, type and engine, optionally with a description, and a charset name to read the script (the charset name is required if the script is not in UTF-8, for example, in ISO-8859-1). +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) Load(scriptname string, scripttype string, scriptengine string, filename string, scriptdescription string, charset string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + "scriptType": scripttype, + "scriptEngine": scriptengine, + "fileName": filename, + "scriptDescription": scriptdescription, + "charset": charset, + } + return s.c.Request("script/action/load/", m) +} + +// Removes the script with the given name +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) Remove(scriptname string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + } + return s.c.Request("script/action/remove/", m) +} + +// Runs the stand alone script with the given name +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) RunStandAloneScript(scriptname string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + } + return s.c.Request("script/action/runStandAloneScript/", m) +} + +// Clears the global variable with the given key. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) ClearGlobalVar(varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "varKey": varkey, + } + return s.c.Request("script/action/clearGlobalVar/", m) +} + +// Clears a global custom variable. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) ClearGlobalCustomVar(varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "varKey": varkey, + } + return s.c.Request("script/action/clearGlobalCustomVar/", m) +} + +// Clears the global variables. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) ClearGlobalVars() (map[string]interface{}, error) { + return s.c.Request("script/action/clearGlobalVars/", nil) +} + +// Clears the variable with the given key of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) ClearScriptVar(scriptname string, varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + "varKey": varkey, + } + return s.c.Request("script/action/clearScriptVar/", m) +} + +// Clears a script custom variable. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) ClearScriptCustomVar(scriptname string, varkey string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + "varKey": varkey, + } + return s.c.Request("script/action/clearScriptCustomVar/", m) +} + +// Clears the variables of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) ClearScriptVars(scriptname string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + } + return s.c.Request("script/action/clearScriptVars/", m) +} + +// Sets the value of the variable with the given key of the given script. Returns an API error (DOES_NOT_EXIST) if no script with the given name exists. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) SetScriptVar(scriptname string, varkey string, varvalue string) (map[string]interface{}, error) { + m := map[string]string{ + "scriptName": scriptname, + "varKey": varkey, + "varValue": varvalue, + } + return s.c.Request("script/action/setScriptVar/", m) +} + +// Sets the value of the global variable with the given key. +// +// This component is optional and therefore the API will only work if it is installed +func (s Script) SetGlobalVar(varkey string, varvalue string) (map[string]interface{}, error) { + m := map[string]string{ + "varKey": varkey, + "varValue": varvalue, + } + return s.c.Request("script/action/setGlobalVar/", m) +} diff --git a/zap-api-go/zap/search_generated.go b/zap-api-go/zap/search_generated.go new file mode 100644 index 0000000..9eae81d --- /dev/null +++ b/zap-api-go/zap/search_generated.go @@ -0,0 +1,191 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Search struct { + c *Client +} + +// Returns the URLs of the HTTP messages that match the given regular expression in the URL optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) UrlsByUrlRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/urlsByUrlRegex/", m) +} + +// 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. +func (s Search) UrlsByTagRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/urlsByTagRegex/", m) +} + +// 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. +func (s Search) UrlsByRequestRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/urlsByRequestRegex/", m) +} + +// Returns the URLs of the HTTP messages that match the given regular expression in the response optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) UrlsByResponseRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/urlsByResponseRegex/", m) +} + +// Returns the URLs of the HTTP messages that match the given regular expression in the header(s) optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) UrlsByHeaderRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/urlsByHeaderRegex/", m) +} + +// Returns the HTTP messages that match the given regular expression in the URL optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) MessagesByUrlRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/messagesByUrlRegex/", m) +} + +// 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. +func (s Search) MessagesByTagRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/messagesByTagRegex/", m) +} + +// 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. +func (s Search) MessagesByRequestRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/messagesByRequestRegex/", m) +} + +// Returns the HTTP messages that match the given regular expression in the response optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) MessagesByResponseRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/messagesByResponseRegex/", m) +} + +// Returns the HTTP messages that match the given regular expression in the header(s) optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) MessagesByHeaderRegex(regex string, baseurl string, start string, count string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.Request("search/view/messagesByHeaderRegex/", m) +} + +// Returns the HTTP messages, in HAR format, that match the given regular expression in the URL optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) HarByUrlRegex(regex string, baseurl string, start string, count string) ([]byte, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.RequestOther("search/other/harByUrlRegex/", m) +} + +// 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. +func (s Search) HarByTagRegex(regex string, baseurl string, start string, count string) ([]byte, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.RequestOther("search/other/harByTagRegex/", m) +} + +// 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. +func (s Search) HarByRequestRegex(regex string, baseurl string, start string, count string) ([]byte, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.RequestOther("search/other/harByRequestRegex/", m) +} + +// Returns the HTTP messages, in HAR format, that match the given regular expression in the response optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) HarByResponseRegex(regex string, baseurl string, start string, count string) ([]byte, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.RequestOther("search/other/harByResponseRegex/", m) +} + +// Returns the HTTP messages, in HAR format, that match the given regular expression in the header(s) optionally filtered by URL and paginated with 'start' position and 'count' of messages. +func (s Search) HarByHeaderRegex(regex string, baseurl string, start string, count string) ([]byte, error) { + m := map[string]string{ + "regex": regex, + "baseurl": baseurl, + "start": start, + "count": count, + } + return s.c.RequestOther("search/other/harByHeaderRegex/", m) +} diff --git a/zap-api-go/zap/selenium_generated.go b/zap-api-go/zap/selenium_generated.go new file mode 100644 index 0000000..af7f896 --- /dev/null +++ b/zap-api-go/zap/selenium_generated.go @@ -0,0 +1,196 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Selenium struct { + c *Client +} + +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) OptionBrowserExtensions() (map[string]interface{}, error) { + return s.c.Request("selenium/view/optionBrowserExtensions/", nil) +} + +// Returns the current path to Chrome binary +// +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) OptionChromeBinaryPath() (map[string]interface{}, error) { + return s.c.Request("selenium/view/optionChromeBinaryPath/", nil) +} + +// Returns the current path to ChromeDriver +// +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) OptionChromeDriverPath() (map[string]interface{}, error) { + return s.c.Request("selenium/view/optionChromeDriverPath/", nil) +} + +// Returns the current path to Firefox binary +// +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) OptionFirefoxBinaryPath() (map[string]interface{}, error) { + return s.c.Request("selenium/view/optionFirefoxBinaryPath/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) OptionFirefoxDefaultProfile() (map[string]interface{}, error) { + return s.c.Request("selenium/view/optionFirefoxDefaultProfile/", nil) +} + +// Returns the current path to Firefox driver (geckodriver) +// +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) OptionFirefoxDriverPath() (map[string]interface{}, error) { + return s.c.Request("selenium/view/optionFirefoxDriverPath/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) OptionIeDriverPath() (map[string]interface{}, error) { + return s.c.Request("selenium/view/optionIeDriverPath/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) OptionLastDirectory() (map[string]interface{}, error) { + return s.c.Request("selenium/view/optionLastDirectory/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) OptionPhantomJsBinaryPath() (map[string]interface{}, error) { + return s.c.Request("selenium/view/optionPhantomJsBinaryPath/", nil) +} + +// Gets the browser arguments. +// +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) GetBrowserArguments(browser string) (map[string]interface{}, error) { + m := map[string]string{ + "browser": browser, + } + return s.c.Request("selenium/view/getBrowserArguments/", m) +} + +// Sets the current path to Chrome binary +// +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) SetOptionChromeBinaryPath(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return s.c.Request("selenium/action/setOptionChromeBinaryPath/", m) +} + +// Sets the current path to ChromeDriver +// +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) SetOptionChromeDriverPath(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return s.c.Request("selenium/action/setOptionChromeDriverPath/", m) +} + +// Sets the current path to Firefox binary +// +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) SetOptionFirefoxBinaryPath(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return s.c.Request("selenium/action/setOptionFirefoxBinaryPath/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) SetOptionFirefoxDefaultProfile(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return s.c.Request("selenium/action/setOptionFirefoxDefaultProfile/", m) +} + +// Sets the current path to Firefox driver (geckodriver) +// +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) SetOptionFirefoxDriverPath(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return s.c.Request("selenium/action/setOptionFirefoxDriverPath/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) SetOptionIeDriverPath(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return s.c.Request("selenium/action/setOptionIeDriverPath/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) SetOptionLastDirectory(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return s.c.Request("selenium/action/setOptionLastDirectory/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) SetOptionPhantomJsBinaryPath(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return s.c.Request("selenium/action/setOptionPhantomJsBinaryPath/", m) +} + +// Adds a browser argument. +// +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) AddBrowserArgument(browser string, argument string, enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "browser": browser, + "argument": argument, + "enabled": enabled, + } + return s.c.Request("selenium/action/addBrowserArgument/", m) +} + +// Removes a browser argument. +// +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) RemoveBrowserArgument(browser string, argument string) (map[string]interface{}, error) { + m := map[string]string{ + "browser": browser, + "argument": argument, + } + return s.c.Request("selenium/action/removeBrowserArgument/", m) +} + +// Sets whether or not a browser argument is enabled. +// +// This component is optional and therefore the API will only work if it is installed +func (s Selenium) SetBrowserArgumentEnabled(browser string, argument string, enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "browser": browser, + "argument": argument, + "enabled": enabled, + } + return s.c.Request("selenium/action/setBrowserArgumentEnabled/", m) +} diff --git a/zap-api-go/zap/session-management_generated.go b/zap-api-go/zap/session-management_generated.go new file mode 100644 index 0000000..50ae76b --- /dev/null +++ b/zap-api-go/zap/session-management_generated.go @@ -0,0 +1,57 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type SessionManagement struct { + c *Client +} + +// Gets the name of the session management methods. +func (s SessionManagement) GetSupportedSessionManagementMethods() (map[string]interface{}, error) { + return s.c.Request("sessionManagement/view/getSupportedSessionManagementMethods/", nil) +} + +// Gets the configuration parameters for the session management method with the given name. +func (s SessionManagement) GetSessionManagementMethodConfigParams(methodname string) (map[string]interface{}, error) { + m := map[string]string{ + "methodName": methodname, + } + return s.c.Request("sessionManagement/view/getSessionManagementMethodConfigParams/", m) +} + +// Gets the name of the session management method for the context with the given ID. +func (s SessionManagement) GetSessionManagementMethod(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return s.c.Request("sessionManagement/view/getSessionManagementMethod/", m) +} + +// Sets the session management method for the context with the given ID. +func (s SessionManagement) SetSessionManagementMethod(contextid string, methodname string, methodconfigparams string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "methodName": methodname, + "methodConfigParams": methodconfigparams, + } + return s.c.Request("sessionManagement/action/setSessionManagementMethod/", m) +} diff --git a/zap-api-go/zap/soap_generated.go b/zap-api-go/zap/soap_generated.go new file mode 100644 index 0000000..0798bea --- /dev/null +++ b/zap-api-go/zap/soap_generated.go @@ -0,0 +1,46 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Soap struct { + c *Client +} + +// Import a WSDL definition from local file. +// +// This component is optional and therefore the API will only work if it is installed +func (s Soap) ImportFile(file string) (map[string]interface{}, error) { + m := map[string]string{ + "file": file, + } + return s.c.Request("soap/action/importFile/", m) +} + +// Import a WSDL definition from a URL. +// +// This component is optional and therefore the API will only work if it is installed +func (s Soap) ImportUrl(url string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + } + return s.c.Request("soap/action/importUrl/", m) +} diff --git a/zap-api-go/zap/spider_generated.go b/zap-api-go/zap/spider_generated.go new file mode 100644 index 0000000..93273e8 --- /dev/null +++ b/zap-api-go/zap/spider_generated.go @@ -0,0 +1,555 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +import "strconv" + +type Spider struct { + c *Client +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) Status(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return s.c.Request("spider/view/status/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) Results(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return s.c.Request("spider/view/results/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) FullResults(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return s.c.Request("spider/view/fullResults/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) Scans() (map[string]interface{}, error) { + return s.c.Request("spider/view/scans/", nil) +} + +// Gets the regexes of URLs excluded from the spider scans. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) ExcludedFromScan() (map[string]interface{}, error) { + return s.c.Request("spider/view/excludedFromScan/", nil) +} + +// Returns a list of unique URLs from the history table based on HTTP messages added by the Spider. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) AllUrls() (map[string]interface{}, error) { + return s.c.Request("spider/view/allUrls/", nil) +} + +// Returns a list of the names of the nodes added to the Sites tree by the specified scan. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) AddedNodes(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return s.c.Request("spider/view/addedNodes/", m) +} + +// Gets all the domains that are always in scope. For each domain the following are shown: the index, the value (domain), if enabled, and if specified as a regex. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) DomainsAlwaysInScope() (map[string]interface{}, error) { + return s.c.Request("spider/view/domainsAlwaysInScope/", nil) +} + +// Use view domainsAlwaysInScope instead. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionDomainsAlwaysInScope() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionDomainsAlwaysInScope/", nil) +} + +// Use view domainsAlwaysInScope instead. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionDomainsAlwaysInScopeEnabled() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionDomainsAlwaysInScopeEnabled/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionHandleParameters() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionHandleParameters/", nil) +} + +// Gets the maximum number of child nodes (per node) that can be crawled, 0 means no limit. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionMaxChildren() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionMaxChildren/", nil) +} + +// Gets the maximum depth the spider can crawl, 0 if unlimited. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionMaxDepth() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionMaxDepth/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionMaxDuration() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionMaxDuration/", nil) +} + +// Gets the maximum size, in bytes, that a response might have to be parsed. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionMaxParseSizeBytes() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionMaxParseSizeBytes/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionMaxScansInUI() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionMaxScansInUI/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionRequestWaitTime() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionRequestWaitTime/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionSkipURLString() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionSkipURLString/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionThreadCount() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionThreadCount/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionUserAgent() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionUserAgent/", nil) +} + +// Gets whether or not a spider process should accept cookies while spidering. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionAcceptCookies() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionAcceptCookies/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionHandleODataParametersVisited() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionHandleODataParametersVisited/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionParseComments() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionParseComments/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionParseDsStore() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionParseDsStore/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionParseGit() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionParseGit/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionParseRobotsTxt() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionParseRobotsTxt/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionParseSVNEntries() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionParseSVNEntries/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionParseSitemapXml() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionParseSitemapXml/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionPostForm() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionPostForm/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionProcessForm() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionProcessForm/", nil) +} + +// Gets whether or not the 'Referer' header should be sent while spidering. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionSendRefererHeader() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionSendRefererHeader/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) OptionShowAdvancedDialog() (map[string]interface{}, error) { + return s.c.Request("spider/view/optionShowAdvancedDialog/", nil) +} + +// Runs the spider against the given URL (or context). Optionally, the 'maxChildren' parameter can be set to limit the number of children scanned, the 'recurse' parameter can be used to prevent the spider from seeding recursively, the parameter 'contextName' can be used to constrain the scan to a Context and the parameter 'subtreeOnly' allows to restrict the spider under a site's subtree (using the specified 'url'). +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) Scan(url string, maxchildren string, recurse string, contextname string, subtreeonly string) (map[string]interface{}, error) { + m := map[string]string{ + "url": url, + "maxChildren": maxchildren, + "recurse": recurse, + "contextName": contextname, + "subtreeOnly": subtreeonly, + } + return s.c.Request("spider/action/scan/", m) +} + +// Runs the spider from the perspective of a User, obtained using the given Context ID and User ID. See 'scan' action for more details. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) ScanAsUser(contextid string, userid string, url string, maxchildren string, recurse string, subtreeonly string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + "url": url, + "maxChildren": maxchildren, + "recurse": recurse, + "subtreeOnly": subtreeonly, + } + return s.c.Request("spider/action/scanAsUser/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) Pause(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return s.c.Request("spider/action/pause/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) Resume(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return s.c.Request("spider/action/resume/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) Stop(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return s.c.Request("spider/action/stop/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) RemoveScan(scanid string) (map[string]interface{}, error) { + m := map[string]string{ + "scanId": scanid, + } + return s.c.Request("spider/action/removeScan/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) PauseAllScans() (map[string]interface{}, error) { + return s.c.Request("spider/action/pauseAllScans/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) ResumeAllScans() (map[string]interface{}, error) { + return s.c.Request("spider/action/resumeAllScans/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) StopAllScans() (map[string]interface{}, error) { + return s.c.Request("spider/action/stopAllScans/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) RemoveAllScans() (map[string]interface{}, error) { + return s.c.Request("spider/action/removeAllScans/", nil) +} + +// Clears the regexes of URLs excluded from the spider scans. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) ClearExcludedFromScan() (map[string]interface{}, error) { + return s.c.Request("spider/action/clearExcludedFromScan/", nil) +} + +// Adds a regex of URLs that should be excluded from the spider scans. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) ExcludeFromScan(regex string) (map[string]interface{}, error) { + m := map[string]string{ + "regex": regex, + } + return s.c.Request("spider/action/excludeFromScan/", m) +} + +// Adds a new domain that's always in scope, using the specified value. Optionally sets if the new entry is enabled (default, true) and whether or not the new value is specified as a regex (default, false). +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) AddDomainAlwaysInScope(value string, isregex string, isenabled string) (map[string]interface{}, error) { + m := map[string]string{ + "value": value, + "isRegex": isregex, + "isEnabled": isenabled, + } + return s.c.Request("spider/action/addDomainAlwaysInScope/", m) +} + +// Modifies a domain that's always in scope. Allows to modify the value, if enabled or if a regex. The domain is selected with its index, which can be obtained with the view domainsAlwaysInScope. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) ModifyDomainAlwaysInScope(idx string, value string, isregex string, isenabled string) (map[string]interface{}, error) { + m := map[string]string{ + "idx": idx, + "value": value, + "isRegex": isregex, + "isEnabled": isenabled, + } + return s.c.Request("spider/action/modifyDomainAlwaysInScope/", m) +} + +// Removes a domain that's always in scope, with the given index. The index can be obtained with the view domainsAlwaysInScope. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) RemoveDomainAlwaysInScope(idx string) (map[string]interface{}, error) { + m := map[string]string{ + "idx": idx, + } + return s.c.Request("spider/action/removeDomainAlwaysInScope/", m) +} + +// Enables all domains that are always in scope. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) EnableAllDomainsAlwaysInScope() (map[string]interface{}, error) { + return s.c.Request("spider/action/enableAllDomainsAlwaysInScope/", nil) +} + +// Disables all domains that are always in scope. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) DisableAllDomainsAlwaysInScope() (map[string]interface{}, error) { + return s.c.Request("spider/action/disableAllDomainsAlwaysInScope/", nil) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionHandleParameters(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return s.c.Request("spider/action/setOptionHandleParameters/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionSkipURLString(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return s.c.Request("spider/action/setOptionSkipURLString/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionUserAgent(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return s.c.Request("spider/action/setOptionUserAgent/", m) +} + +// Sets whether or not a spider process should accept cookies while spidering. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionAcceptCookies(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return s.c.Request("spider/action/setOptionAcceptCookies/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionHandleODataParametersVisited(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return s.c.Request("spider/action/setOptionHandleODataParametersVisited/", m) +} + +// Sets the maximum number of child nodes (per node) that can be crawled, 0 means no limit. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionMaxChildren(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return s.c.Request("spider/action/setOptionMaxChildren/", m) +} + +// Sets the maximum depth the spider can crawl, 0 for unlimited depth. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionMaxDepth(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return s.c.Request("spider/action/setOptionMaxDepth/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionMaxDuration(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return s.c.Request("spider/action/setOptionMaxDuration/", m) +} + +// Sets the maximum size, in bytes, that a response might have to be parsed. This allows the spider to skip big responses/files. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionMaxParseSizeBytes(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return s.c.Request("spider/action/setOptionMaxParseSizeBytes/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionMaxScansInUI(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return s.c.Request("spider/action/setOptionMaxScansInUI/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionParseComments(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return s.c.Request("spider/action/setOptionParseComments/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionParseDsStore(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return s.c.Request("spider/action/setOptionParseDsStore/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionParseGit(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return s.c.Request("spider/action/setOptionParseGit/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionParseRobotsTxt(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return s.c.Request("spider/action/setOptionParseRobotsTxt/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionParseSVNEntries(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return s.c.Request("spider/action/setOptionParseSVNEntries/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionParseSitemapXml(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return s.c.Request("spider/action/setOptionParseSitemapXml/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionPostForm(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return s.c.Request("spider/action/setOptionPostForm/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionProcessForm(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return s.c.Request("spider/action/setOptionProcessForm/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionRequestWaitTime(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return s.c.Request("spider/action/setOptionRequestWaitTime/", m) +} + +// Sets whether or not the 'Referer' header should be sent while spidering. +// +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionSendRefererHeader(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return s.c.Request("spider/action/setOptionSendRefererHeader/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionShowAdvancedDialog(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return s.c.Request("spider/action/setOptionShowAdvancedDialog/", m) +} + +// This component is optional and therefore the API will only work if it is installed +func (s Spider) SetOptionThreadCount(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return s.c.Request("spider/action/setOptionThreadCount/", m) +} diff --git a/zap-api-go/zap/stats_generated.go b/zap-api-go/zap/stats_generated.go new file mode 100644 index 0000000..ea96b6e --- /dev/null +++ b/zap-api-go/zap/stats_generated.go @@ -0,0 +1,118 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +import "strconv" + +type Stats struct { + c *Client +} + +// Statistics +func (s Stats) Stats(keyprefix string) (map[string]interface{}, error) { + m := map[string]string{ + "keyPrefix": keyprefix, + } + return s.c.Request("stats/view/stats/", m) +} + +// Gets all of the site based statistics, optionally filtered by a key prefix +func (s Stats) AllSitesStats(keyprefix string) (map[string]interface{}, error) { + m := map[string]string{ + "keyPrefix": keyprefix, + } + return s.c.Request("stats/view/allSitesStats/", m) +} + +// Gets all of the global statistics, optionally filtered by a key prefix +func (s Stats) SiteStats(site string, keyprefix string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + "keyPrefix": keyprefix, + } + return s.c.Request("stats/view/siteStats/", m) +} + +// Gets the Statsd service hostname +func (s Stats) OptionStatsdHost() (map[string]interface{}, error) { + return s.c.Request("stats/view/optionStatsdHost/", nil) +} + +// Gets the Statsd service port +func (s Stats) OptionStatsdPort() (map[string]interface{}, error) { + return s.c.Request("stats/view/optionStatsdPort/", nil) +} + +// Gets the prefix to be applied to all stats sent to the configured Statsd service +func (s Stats) OptionStatsdPrefix() (map[string]interface{}, error) { + return s.c.Request("stats/view/optionStatsdPrefix/", nil) +} + +// Returns 'true' if in memory statistics are enabled, otherwise returns 'false' +func (s Stats) OptionInMemoryEnabled() (map[string]interface{}, error) { + return s.c.Request("stats/view/optionInMemoryEnabled/", nil) +} + +// Returns 'true' if a Statsd server has been correctly configured, otherwise returns 'false' +func (s Stats) OptionStatsdEnabled() (map[string]interface{}, error) { + return s.c.Request("stats/view/optionStatsdEnabled/", nil) +} + +// Clears all of the statistics +func (s Stats) ClearStats(keyprefix string) (map[string]interface{}, error) { + m := map[string]string{ + "keyPrefix": keyprefix, + } + return s.c.Request("stats/action/clearStats/", m) +} + +// Sets the Statsd service hostname, supply an empty string to stop using a Statsd service +func (s Stats) SetOptionStatsdHost(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return s.c.Request("stats/action/setOptionStatsdHost/", m) +} + +// Sets the prefix to be applied to all stats sent to the configured Statsd service +func (s Stats) SetOptionStatsdPrefix(str string) (map[string]interface{}, error) { + m := map[string]string{ + "String": str, + } + return s.c.Request("stats/action/setOptionStatsdPrefix/", m) +} + +// Sets whether in memory statistics are enabled +func (s Stats) SetOptionInMemoryEnabled(boolean bool) (map[string]interface{}, error) { + m := map[string]string{ + "Boolean": strconv.FormatBool(boolean), + } + return s.c.Request("stats/action/setOptionInMemoryEnabled/", m) +} + +// Sets the Statsd service port +func (s Stats) SetOptionStatsdPort(i int) (map[string]interface{}, error) { + m := map[string]string{ + "Integer": strconv.Itoa(i), + } + return s.c.Request("stats/action/setOptionStatsdPort/", m) +} diff --git a/zap-api-go/zap/users_generated.go b/zap-api-go/zap/users_generated.go new file mode 100644 index 0000000..212efca --- /dev/null +++ b/zap-api-go/zap/users_generated.go @@ -0,0 +1,170 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Users struct { + c *Client +} + +// Gets a list of users that belong to the context with the given ID, or all users if none provided. +func (u Users) UsersList(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return u.c.Request("users/view/usersList/", m) +} + +// Gets the data of the user with the given ID that belongs to the context with the given ID. +func (u Users) GetUserById(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return u.c.Request("users/view/getUserById/", m) +} + +// Gets the configuration parameters for the credentials of the context with the given ID. +func (u Users) GetAuthenticationCredentialsConfigParams(contextid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + } + return u.c.Request("users/view/getAuthenticationCredentialsConfigParams/", m) +} + +// Gets the authentication credentials of the user with given ID that belongs to the context with the given ID. +func (u Users) GetAuthenticationCredentials(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return u.c.Request("users/view/getAuthenticationCredentials/", m) +} + +// Gets the authentication state information for the user identified by the Context and User Ids. +func (u Users) GetAuthenticationState(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return u.c.Request("users/view/getAuthenticationState/", m) +} + +// Gets the authentication session information for the user identified by the Context and User Ids, e.g. cookies and realm credentials. +func (u Users) GetAuthenticationSession(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return u.c.Request("users/view/getAuthenticationSession/", m) +} + +// Creates a new user with the given name for the context with the given ID. +func (u Users) NewUser(contextid string, name string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "name": name, + } + return u.c.Request("users/action/newUser/", m) +} + +// Removes the user with the given ID that belongs to the context with the given ID. +func (u Users) RemoveUser(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return u.c.Request("users/action/removeUser/", m) +} + +// Sets whether or not the user, with the given ID that belongs to the context with the given ID, should be enabled. +func (u Users) SetUserEnabled(contextid string, userid string, enabled string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + "enabled": enabled, + } + return u.c.Request("users/action/setUserEnabled/", m) +} + +// Renames the user with the given ID that belongs to the context with the given ID. +func (u Users) SetUserName(contextid string, userid string, name string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + "name": name, + } + return u.c.Request("users/action/setUserName/", m) +} + +// Sets the authentication credentials for the user with the given ID that belongs to the context with the given ID. +func (u Users) SetAuthenticationCredentials(contextid string, userid string, authcredentialsconfigparams string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + "authCredentialsConfigParams": authcredentialsconfigparams, + } + return u.c.Request("users/action/setAuthenticationCredentials/", m) +} + +// Tries to authenticate as the identified user, returning the authentication request and whether it appears to have succeeded. +func (u Users) AuthenticateAsUser(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return u.c.Request("users/action/authenticateAsUser/", m) +} + +// Tries to poll as the identified user, returning the authentication request and whether it appears to have succeeded. This will only work if the polling verification strategy has been configured. +func (u Users) PollAsUser(contextid string, userid string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + } + return u.c.Request("users/action/pollAsUser/", m) +} + +// Sets fields in the authentication state for the user identified by the Context and User Ids. +func (u Users) SetAuthenticationState(contextid string, userid string, lastpollresult string, lastpolltimeinms string, requestssincelastpoll string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + "lastPollResult": lastpollresult, + "lastPollTimeInMs": lastpolltimeinms, + "requestsSinceLastPoll": requestssincelastpoll, + } + return u.c.Request("users/action/setAuthenticationState/", m) +} + +// Sets the specified cookie for the user identified by the Context and User Ids. +func (u Users) SetCookie(contextid string, userid string, domain string, name string, value string, path string, secure string) (map[string]interface{}, error) { + m := map[string]string{ + "contextId": contextid, + "userId": userid, + "domain": domain, + "name": name, + "value": value, + "path": path, + "secure": secure, + } + return u.c.Request("users/action/setCookie/", m) +} diff --git a/zap-api-go/zap/wappalyzer_generated.go b/zap-api-go/zap/wappalyzer_generated.go new file mode 100644 index 0000000..c347681 --- /dev/null +++ b/zap-api-go/zap/wappalyzer_generated.go @@ -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 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Wappalyzer struct { + c *Client +} + +// 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 +func (w Wappalyzer) ListSites() (map[string]interface{}, error) { + return w.c.Request("wappalyzer/view/listSites/", nil) +} + +// Lists all sites and their associated applications (technologies). +// +// This component is optional and therefore the API will only work if it is installed +func (w Wappalyzer) ListAll() (map[string]interface{}, error) { + return w.c.Request("wappalyzer/view/listAll/", nil) +} + +// Lists all the applications (technologies) associated with a specific site. +// +// This component is optional and therefore the API will only work if it is installed +func (w Wappalyzer) ListSite(site string) (map[string]interface{}, error) { + m := map[string]string{ + "site": site, + } + return w.c.Request("wappalyzer/view/listSite/", m) +} diff --git a/zap-api-go/zap/websocket_generated.go b/zap-api-go/zap/websocket_generated.go new file mode 100644 index 0000000..fbffb34 --- /dev/null +++ b/zap-api-go/zap/websocket_generated.go @@ -0,0 +1,87 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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. +// +// *** This file was automatically generated. *** +// + +package zap + +type Websocket struct { + c *Client +} + +// Returns all of the registered web socket channels +// +// This component is optional and therefore the API will only work if it is installed +func (w Websocket) Channels() (map[string]interface{}, error) { + return w.c.Request("websocket/view/channels/", nil) +} + +// Returns full details of the message specified by the channelId and messageId +// +// This component is optional and therefore the API will only work if it is installed +func (w Websocket) Message(channelid string, messageid string) (map[string]interface{}, error) { + m := map[string]string{ + "channelId": channelid, + "messageId": messageid, + } + return w.c.Request("websocket/view/message/", m) +} + +// Returns a list of all of the messages that meet the given criteria (all optional), where channelId is a channel identifier, start is the offset to start returning messages from (starting from 0), count is the number of messages to return (default no limit) and payloadPreviewLength is the maximum number bytes to return for the payload contents +// +// This component is optional and therefore the API will only work if it is installed +func (w Websocket) Messages(channelid string, start string, count string, payloadpreviewlength string) (map[string]interface{}, error) { + m := map[string]string{ + "channelId": channelid, + "start": start, + "count": count, + "payloadPreviewLength": payloadpreviewlength, + } + return w.c.Request("websocket/view/messages/", m) +} + +// Returns a text representation of an intercepted websockets message +// +// This component is optional and therefore the API will only work if it is installed +func (w Websocket) BreakTextMessage() (map[string]interface{}, error) { + return w.c.Request("websocket/view/breakTextMessage/", nil) +} + +// Sends the specified message on the channel specified by channelId, if outgoing is 'True' then the message will be sent to the server and if it is 'False' then it will be sent to the client +// +// This component is optional and therefore the API will only work if it is installed +func (w Websocket) SendTextMessage(channelid string, outgoing string, message string) (map[string]interface{}, error) { + m := map[string]string{ + "channelId": channelid, + "outgoing": outgoing, + "message": message, + } + return w.c.Request("websocket/action/sendTextMessage/", m) +} + +// Sets the text message for an intercepted websockets message +// +// This component is optional and therefore the API will only work if it is installed +func (w Websocket) SetBreakTextMessage(message string, outgoing string) (map[string]interface{}, error) { + m := map[string]string{ + "message": message, + "outgoing": outgoing, + } + return w.c.Request("websocket/action/setBreakTextMessage/", m) +} From 8b3b5a0fbeccc0d5ee8bfef9e36babe53a1966c3 Mon Sep 17 00:00:00 2001 From: Alessio Dalla Piazza Date: Tue, 2 Jul 2024 12:37:14 +0200 Subject: [PATCH 12/14] update client.go Signed-off-by: Alessio Dalla Piazza --- zap-api-go/zap/client.go | 145 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 zap-api-go/zap/client.go diff --git a/zap-api-go/zap/client.go b/zap-api-go/zap/client.go new file mode 100644 index 0000000..e255897 --- /dev/null +++ b/zap-api-go/zap/client.go @@ -0,0 +1,145 @@ +// Zed Attack Proxy (ZAP) and its related class files. +// +// ZAP is an HTTP/HTTPS proxy for assessing web application security. +// +// Copyright 2017 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 zap + +import ( + "crypto/tls" + "encoding/json" + "fmt" + "io" + "log" + "net/http" + "net/url" +) + +const ( + DefaultBase = "http://zap/JSON/" + DefaultBaseOther = "http://zap/OTHER/" + DefaultProxy = "tcp://127.0.0.1:8080" + ZAP_API_KEY_PARAM = "apikey" + ZAP_API_KEY_HEADER = "X-ZAP-API-Key" +) + +// Config defines the config of ZAP client +type Config struct { + Base string + BaseOther string + Proxy string + APIKey string + TLSConfig tls.Config +} + +// Client is a ZAP client that allows you to access ZAP API +type Client struct { + *Config + httpClient *http.Client +} + +// NewClient returns a new ZAP client based on the passed in config +func NewClient(cfg *Config) (Interface, error) { + if cfg.Base == "" { + cfg.Base = DefaultBase + } + if cfg.BaseOther == "" { + cfg.BaseOther = DefaultBaseOther + } + if cfg.Proxy == "" { + cfg.Proxy = DefaultProxy + } + + proxyURL, err := url.Parse(cfg.Proxy) + if err != nil { + return nil, err + } + + httpClient := &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyURL(proxyURL), + TLSClientConfig: &cfg.TLSConfig, + }, + } + return &Client{ + Config: cfg, + httpClient: httpClient, + }, nil +} + +// Request sends HTTP request to zap base("http://zap/JSON/") API group +func (c *Client) Request(path string, queryParams map[string]string) (map[string]interface{}, error) { + body, err := c.request(c.Base+path, queryParams) + if err != nil { + return nil, err + } + // NOTE: since Golang can not unmarshal a json without knowing the exact struct + // so we can only unmarshal json into a map[string]interface{} here. + var obj map[string]interface{} + if err := json.Unmarshal(body, &obj); err != nil { + return nil, err + } + return obj, nil +} + +// RequestOther sends HTTP request to zap other("http://zap/OTHER/") API group +func (c *Client) RequestOther(path string, queryParams map[string]string) ([]byte, error) { + return c.request(c.BaseOther+path, queryParams) +} + +func (c *Client) request(path string, queryParams map[string]string) ([]byte, error) { + req, err := http.NewRequest("GET", path, nil) + if err != nil { + return nil, err + } + + if len(queryParams) == 0 { + queryParams = map[string]string{} + } + // Send the API key even if there are no parameters, + // older ZAP versions might need API key as (query) parameter. + queryParams[ZAP_API_KEY_PARAM] = c.APIKey + + // add url query parameter + query := req.URL.Query() + for k, v := range queryParams { + if v == "" { + continue + } + query.Add(k, v) + } + req.URL.RawQuery = query.Encode() + + // add HTTP Accept header + req.Header.Add("Accept", "application/json") + // add API Key header + req.Header.Add(ZAP_API_KEY_HEADER, c.APIKey) + + // Close the connection + req.Close = true + + resp, err := c.httpClient.Do(req) + if err != nil { + return nil, fmt.Errorf("errored when sending request to the server: %v", err) + } + defer func(Body io.ReadCloser) { + errClose := Body.Close() + if errClose != nil { + log.Printf("Error closing response body: %v", errClose) + } + }(resp.Body) + return io.ReadAll(resp.Body) +} From 20074b0e8b93f32b09d3dab317ade7b4c008dfa8 Mon Sep 17 00:00:00 2001 From: Alessio Dalla Piazza Date: Tue, 2 Jul 2024 12:37:25 +0200 Subject: [PATCH 13/14] improve readme Signed-off-by: Alessio Dalla Piazza --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index a397e07..f37d4e8 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,12 @@ cd zap-extensions cd .. ``` +Finally, run the command to update the `interface.go`: + +``` +/bin/bash zap-api-go/zap/generate_interface.sh +``` + The above commands will update the files in `zap-api-go/zap`. If any new files are created then they should be manually added to `zap-api-go/zap/interface.go` as per the existing files. \ No newline at end of file From 32a89271a5e3c261088c012aabce80d7e7657de1 Mon Sep 17 00:00:00 2001 From: Alessio Dalla Piazza Date: Tue, 2 Jul 2024 12:37:37 +0200 Subject: [PATCH 14/14] add bash script to autogenerate interface.go Signed-off-by: Alessio Dalla Piazza --- zap-api-go/zap/generate_interface.sh | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 zap-api-go/zap/generate_interface.sh diff --git a/zap-api-go/zap/generate_interface.sh b/zap-api-go/zap/generate_interface.sh new file mode 100644 index 0000000..e8d5dfb --- /dev/null +++ b/zap-api-go/zap/generate_interface.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Create or clear the interface.go file +output_file="interface.go" +echo "// Package zap defines the interface a ZAP client should implement" > $output_file +echo "package zap" >> $output_file +echo "" >> $output_file +echo "// Interface defines the interface a ZAP client should implement" >> $output_file +echo "type Interface interface {" >> $output_file + +# Find all _generated.go files +generated_files=$(find . -name "*_generated.go") + +# Loop through each _generated.go file and extract the struct and function +for file in $generated_files; do + struct_name=$(grep -o 'type [^ ]* struct' "$file" | awk '{print $2}') + if [ -n "$struct_name" ]; then + echo " $struct_name() *$struct_name" >> $output_file + fi +done + +echo "}" >> $output_file +echo "" >> $output_file + +# Loop through each _generated.go file again to extract and write function implementations +for file in $generated_files; do + struct_name=$(grep -o 'type [^ ]* struct' "$file" | awk '{print $2}') + if [ -n "$struct_name" ]; then + echo "// $struct_name() returns a $struct_name client" >> $output_file + echo "func (c *Client) $struct_name() *$struct_name {" >> $output_file + echo " return &$struct_name{c}" >> $output_file + echo "}" >> $output_file + echo "" >> $output_file + fi +done + +echo "interface.go file has been generated."