Skip to content

Commit aa97a02

Browse files
committed
Regenerate APIs
Regenerate core and add-ons APIs. Signed-off-by: thc202 <thc202@gmail.com>
1 parent 8a3ee2b commit aa97a02

15 files changed

+417
-12
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
66
## [Unreleased]
77
### Added
88
- Core APIs from ZAP version 2.8.0.
9+
- APIs from add-ons:
10+
- Access Control Testing;
11+
- Export Report;
12+
- Revisit;
13+
- Wappalyzer - Technology Detection.
14+
15+
### Changed
16+
- Core APIs updated for ZAP version 2.9.0.
17+
- Update APIs from add-ons:
18+
- Alert Filters;
19+
- OpenAPI Support;
20+
- Replacer.
921

1022
## [0.0.15] - 2019-06-14
1123
### Added

src/zapv2/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import requests
2626
from requests.packages.urllib3.exceptions import InsecureRequestWarning
2727

28+
from .accessControl import accessControl
2829
from .acsrf import acsrf
2930
from .alert import alert
3031
from .alertFilter import alertFilter
@@ -36,6 +37,7 @@
3637
from .brk import brk
3738
from .context import context
3839
from .core import core
40+
from .exportreport import exportreport
3941
from .forcedUser import forcedUser
4042
from .httpSessions import httpSessions
4143
from .importLogFiles import importLogFiles
@@ -47,6 +49,7 @@
4749
from .pscan import pscan
4850
from .replacer import replacer
4951
from .reveal import reveal
52+
from .revisit import revisit
5053
from .ruleConfig import ruleConfig
5154
from .script import script
5255
from .search import search
@@ -56,6 +59,7 @@
5659
from .spider import spider
5760
from .stats import stats
5861
from .users import users
62+
from .wappalyzer import wappalyzer
5963
from .websocket import websocket
6064

6165

@@ -83,6 +87,7 @@ def __init__(self, proxies=None, apikey=None, validate_status_code=False):
8387
self.__apikey = apikey
8488
self.__validate_status_code=validate_status_code
8589

90+
self.accessControl = accessControl(self)
8691
self.acsrf = acsrf(self)
8792
self.alert = alert(self)
8893
self.alertFilter = alertFilter(self)
@@ -94,6 +99,7 @@ def __init__(self, proxies=None, apikey=None, validate_status_code=False):
9499
self.brk = brk(self)
95100
self.context = context(self)
96101
self.core = core(self)
102+
self.exportreport = exportreport(self)
97103
self.forcedUser = forcedUser(self)
98104
self.httpsessions = httpSessions(self)
99105
self.importLogFiles = importLogFiles(self)
@@ -105,6 +111,7 @@ def __init__(self, proxies=None, apikey=None, validate_status_code=False):
105111
self.pscan = pscan(self)
106112
self.replacer = replacer(self)
107113
self.reveal = reveal(self)
114+
self.revisit = revisit(self)
108115
self.ruleConfig = ruleConfig(self)
109116
self.script = script(self)
110117
self.search = search(self)
@@ -114,6 +121,7 @@ def __init__(self, proxies=None, apikey=None, validate_status_code=False):
114121
self.spider = spider(self)
115122
self.stats = stats(self)
116123
self.users = users(self)
124+
self.wappalyzer = wappalyzer(self)
117125
self.websocket = websocket(self)
118126

119127
# not very nice, but prevents warnings when accessing the ZAP API via https

src/zapv2/accessControl.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Zed Attack Proxy (ZAP) and its related class files.
2+
#
3+
# ZAP is an HTTP/HTTPS proxy for assessing web application security.
4+
#
5+
# Copyright 2020 the ZAP development team
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
"""
19+
This file was automatically generated.
20+
"""
21+
22+
import six
23+
24+
25+
class accessControl(object):
26+
27+
def __init__(self, zap):
28+
self.zap = zap
29+
30+
def get_scan_progress(self, contextid):
31+
"""
32+
Gets the Access Control scan progress (percentage integer) for the given context ID.
33+
This component is optional and therefore the API will only work if it is installed
34+
"""
35+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'accessControl/view/getScanProgress/', {'contextId': contextid})))
36+
37+
def get_scan_status(self, contextid):
38+
"""
39+
Gets the Access Control scan status (description string) for the given context ID.
40+
This component is optional and therefore the API will only work if it is installed
41+
"""
42+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'accessControl/view/getScanStatus/', {'contextId': contextid})))
43+
44+
def scan(self, contextid, userid, scanasunauthuser=None, raisealert=None, alertrisklevel=None, apikey=''):
45+
"""
46+
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.]
47+
This component is optional and therefore the API will only work if it is installed
48+
"""
49+
params = {'contextId': contextid, 'userId': userid, 'apikey': apikey}
50+
if scanasunauthuser is not None:
51+
params['scanAsUnAuthUser'] = scanasunauthuser
52+
if raisealert is not None:
53+
params['raiseAlert'] = raisealert
54+
if alertrisklevel is not None:
55+
params['alertRiskLevel'] = alertrisklevel
56+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'accessControl/action/scan/', params)))
57+
58+
def write_htm_lreport(self, contextid, filename, apikey=''):
59+
"""
60+
Generates an Access Control report for the given context ID and saves it based on the provided filename (path).
61+
This component is optional and therefore the API will only work if it is installed
62+
"""
63+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'accessControl/action/writeHTMLreport/', {'contextId': contextid, 'fileName': filename, 'apikey': apikey})))

src/zapv2/alert.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,49 @@ def delete_alert(self, id, apikey=''):
101101
Deletes the alert with the given ID.
102102
"""
103103
return six.next(six.itervalues(self.zap._request(self.zap.base + 'alert/action/deleteAlert/', {'id': id, 'apikey': apikey})))
104+
105+
def update_alert(self, id, name, riskid, confidenceid, description, param=None, attack=None, otherinfo=None, solution=None, references=None, evidence=None, cweid=None, wascid=None, apikey=''):
106+
"""
107+
Update the alert with the given ID, with the provided details.
108+
"""
109+
params = {'id': id, 'name': name, 'riskId': riskid, 'confidenceId': confidenceid, 'description': description, 'apikey': apikey}
110+
if param is not None:
111+
params['param'] = param
112+
if attack is not None:
113+
params['attack'] = attack
114+
if otherinfo is not None:
115+
params['otherInfo'] = otherinfo
116+
if solution is not None:
117+
params['solution'] = solution
118+
if references is not None:
119+
params['references'] = references
120+
if evidence is not None:
121+
params['evidence'] = evidence
122+
if cweid is not None:
123+
params['cweId'] = cweid
124+
if wascid is not None:
125+
params['wascId'] = wascid
126+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'alert/action/updateAlert/', params)))
127+
128+
def add_alert(self, messageid, name, riskid, confidenceid, description, param=None, attack=None, otherinfo=None, solution=None, references=None, evidence=None, cweid=None, wascid=None, apikey=''):
129+
"""
130+
Add an alert associated with the given message ID, with the provided details. (The ID of the created alert is returned.)
131+
"""
132+
params = {'messageId': messageid, 'name': name, 'riskId': riskid, 'confidenceId': confidenceid, 'description': description, 'apikey': apikey}
133+
if param is not None:
134+
params['param'] = param
135+
if attack is not None:
136+
params['attack'] = attack
137+
if otherinfo is not None:
138+
params['otherInfo'] = otherinfo
139+
if solution is not None:
140+
params['solution'] = solution
141+
if references is not None:
142+
params['references'] = references
143+
if evidence is not None:
144+
params['evidence'] = evidence
145+
if cweid is not None:
146+
params['cweId'] = cweid
147+
if wascid is not None:
148+
params['wascId'] = wascid
149+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'alert/action/addAlert/', params)))

src/zapv2/alertFilter.py

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ def alert_filter_list(self, contextid):
3434
"""
3535
return six.next(six.itervalues(self.zap._request(self.zap.base + 'alertFilter/view/alertFilterList/', {'contextId': contextid})))
3636

37-
def add_alert_filter(self, contextid, ruleid, newlevel, url=None, urlisregex=None, parameter=None, enabled=None, apikey=''):
37+
@property
38+
def global_alert_filter_list(self):
39+
"""
40+
Lists the global alert filters.
41+
This component is optional and therefore the API will only work if it is installed
42+
"""
43+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'alertFilter/view/globalAlertFilterList/')))
44+
45+
def add_alert_filter(self, contextid, ruleid, newlevel, url=None, urlisregex=None, parameter=None, enabled=None, parameterisregex=None, attack=None, attackisregex=None, evidence=None, evidenceisregex=None, apikey=''):
3846
"""
3947
Adds a new alert filter for the context with the given ID.
4048
This component is optional and therefore the API will only work if it is installed
@@ -48,9 +56,19 @@ def add_alert_filter(self, contextid, ruleid, newlevel, url=None, urlisregex=Non
4856
params['parameter'] = parameter
4957
if enabled is not None:
5058
params['enabled'] = enabled
59+
if parameterisregex is not None:
60+
params['parameterIsRegex'] = parameterisregex
61+
if attack is not None:
62+
params['attack'] = attack
63+
if attackisregex is not None:
64+
params['attackIsRegex'] = attackisregex
65+
if evidence is not None:
66+
params['evidence'] = evidence
67+
if evidenceisregex is not None:
68+
params['evidenceIsRegex'] = evidenceisregex
5169
return six.next(six.itervalues(self.zap._request(self.zap.base + 'alertFilter/action/addAlertFilter/', params)))
5270

53-
def remove_alert_filter(self, contextid, ruleid, newlevel, url=None, urlisregex=None, parameter=None, enabled=None, apikey=''):
71+
def remove_alert_filter(self, contextid, ruleid, newlevel, url=None, urlisregex=None, parameter=None, enabled=None, parameterisregex=None, attack=None, attackisregex=None, evidence=None, evidenceisregex=None, apikey=''):
5472
"""
5573
Removes an alert filter from the context with the given ID.
5674
This component is optional and therefore the API will only work if it is installed
@@ -64,4 +82,66 @@ def remove_alert_filter(self, contextid, ruleid, newlevel, url=None, urlisregex=
6482
params['parameter'] = parameter
6583
if enabled is not None:
6684
params['enabled'] = enabled
85+
if parameterisregex is not None:
86+
params['parameterIsRegex'] = parameterisregex
87+
if attack is not None:
88+
params['attack'] = attack
89+
if attackisregex is not None:
90+
params['attackIsRegex'] = attackisregex
91+
if evidence is not None:
92+
params['evidence'] = evidence
93+
if evidenceisregex is not None:
94+
params['evidenceIsRegex'] = evidenceisregex
6795
return six.next(six.itervalues(self.zap._request(self.zap.base + 'alertFilter/action/removeAlertFilter/', params)))
96+
97+
def add_global_alert_filter(self, ruleid, newlevel, url=None, urlisregex=None, parameter=None, enabled=None, parameterisregex=None, attack=None, attackisregex=None, evidence=None, evidenceisregex=None, apikey=''):
98+
"""
99+
Adds a new global alert filter.
100+
This component is optional and therefore the API will only work if it is installed
101+
"""
102+
params = {'ruleId': ruleid, 'newLevel': newlevel, 'apikey': apikey}
103+
if url is not None:
104+
params['url'] = url
105+
if urlisregex is not None:
106+
params['urlIsRegex'] = urlisregex
107+
if parameter is not None:
108+
params['parameter'] = parameter
109+
if enabled is not None:
110+
params['enabled'] = enabled
111+
if parameterisregex is not None:
112+
params['parameterIsRegex'] = parameterisregex
113+
if attack is not None:
114+
params['attack'] = attack
115+
if attackisregex is not None:
116+
params['attackIsRegex'] = attackisregex
117+
if evidence is not None:
118+
params['evidence'] = evidence
119+
if evidenceisregex is not None:
120+
params['evidenceIsRegex'] = evidenceisregex
121+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'alertFilter/action/addGlobalAlertFilter/', params)))
122+
123+
def remove_global_alert_filter(self, ruleid, newlevel, url=None, urlisregex=None, parameter=None, enabled=None, parameterisregex=None, attack=None, attackisregex=None, evidence=None, evidenceisregex=None, apikey=''):
124+
"""
125+
Removes a global alert filter.
126+
This component is optional and therefore the API will only work if it is installed
127+
"""
128+
params = {'ruleId': ruleid, 'newLevel': newlevel, 'apikey': apikey}
129+
if url is not None:
130+
params['url'] = url
131+
if urlisregex is not None:
132+
params['urlIsRegex'] = urlisregex
133+
if parameter is not None:
134+
params['parameter'] = parameter
135+
if enabled is not None:
136+
params['enabled'] = enabled
137+
if parameterisregex is not None:
138+
params['parameterIsRegex'] = parameterisregex
139+
if attack is not None:
140+
params['attack'] = attack
141+
if attackisregex is not None:
142+
params['attackIsRegex'] = attackisregex
143+
if evidence is not None:
144+
params['evidence'] = evidence
145+
if evidenceisregex is not None:
146+
params['evidenceIsRegex'] = evidenceisregex
147+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'alertFilter/action/removeGlobalAlertFilter/', params)))

src/zapv2/autoupdate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def download_latest_release(self, apikey=''):
136136

137137
def install_addon(self, id, apikey=''):
138138
"""
139-
Installs or updates the specified add-on, returning when complete (ie not asynchronously)
139+
Installs or updates the specified add-on, returning when complete (i.e. not asynchronously)
140140
"""
141141
return six.next(six.itervalues(self.zap._request(self.zap.base + 'autoupdate/action/installAddon/', {'id': id, 'apikey': apikey})))
142142

src/zapv2/brk.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def set_http_message(self, httpheader, httpbody=None, apikey=''):
7575

7676
def cont(self, apikey=''):
7777
"""
78-
Submits the currently intercepted message and unsets the global request/response break points
78+
Submits the currently intercepted message and unsets the global request/response breakpoints
7979
"""
8080
return six.next(six.itervalues(self.zap._request(self.zap.base + 'break/action/continue/', {'apikey': apikey})))
8181

@@ -93,12 +93,12 @@ def drop(self, apikey=''):
9393

9494
def add_http_breakpoint(self, string, location, match, inverse, ignorecase, apikey=''):
9595
"""
96-
Adds a custom HTTP breakpont. 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.
96+
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.
9797
"""
9898
return six.next(six.itervalues(self.zap._request(self.zap.base + 'break/action/addHttpBreakpoint/', {'string': string, 'location': location, 'match': match, 'inverse': inverse, 'ignorecase': ignorecase, 'apikey': apikey})))
9999

100100
def remove_http_breakpoint(self, string, location, match, inverse, ignorecase, apikey=''):
101101
"""
102-
Removes the specified break point
102+
Removes the specified breakpoint
103103
"""
104104
return six.next(six.itervalues(self.zap._request(self.zap.base + 'break/action/removeHttpBreakpoint/', {'string': string, 'location': location, 'match': match, 'inverse': inverse, 'ignorecase': ignorecase, 'apikey': apikey})))

src/zapv2/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def load_session(self, name, apikey=''):
321321

322322
def save_session(self, name, overwrite=None, apikey=''):
323323
"""
324-
Saves the session with the name supplied, optionally overwriting existing files. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir.
324+
Saves the session.
325325
"""
326326
params = {'name': name, 'apikey': apikey}
327327
if overwrite is not None:

src/zapv2/exportreport.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Zed Attack Proxy (ZAP) and its related class files.
2+
#
3+
# ZAP is an HTTP/HTTPS proxy for assessing web application security.
4+
#
5+
# Copyright 2020 the ZAP development team
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
"""
19+
This file was automatically generated.
20+
"""
21+
22+
import six
23+
24+
25+
class exportreport(object):
26+
27+
def __init__(self, zap):
28+
self.zap = zap
29+
30+
@property
31+
def formats(self):
32+
"""
33+
This component is optional and therefore the API will only work if it is installed
34+
"""
35+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'exportreport/view/formats/')))
36+
37+
def generate(self, absolutepath, fileextension, sourcedetails, alertseverity, alertdetails, scanid=None, includepassivealerts=None, apikey=''):
38+
"""
39+
This component is optional and therefore the API will only work if it is installed
40+
"""
41+
params = {'absolutePath': absolutepath, 'fileExtension': fileextension, 'sourceDetails': sourcedetails, 'alertSeverity': alertseverity, 'alertDetails': alertdetails, 'apikey': apikey}
42+
if scanid is not None:
43+
params['scanId'] = scanid
44+
if includepassivealerts is not None:
45+
params['includePassiveAlerts'] = includepassivealerts
46+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'exportreport/action/generate/', params)))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy