Skip to content

Commit 9e327a2

Browse files
committed
Update Replacer and Importurls
Update Replacer API, per release of version 7. Add description to Importurls API endpoint.
1 parent eac850a commit 9e327a2

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
1414
sooner if the API request was not successful. This can be enabled when
1515
instantiating the `ZAPv2` class with the argument `validate_status_code`
1616
set to `True`.
17+
- Update Replacer API, per release of version 7.
18+
- Add description to Importurls API endpoint.
1719

1820
## [0.0.14] - 2017-12-04
1921
### Changed

src/zapv2/importurls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def __init__(self, zap):
2929

3030
def importurls(self, filepath, apikey=''):
3131
"""
32+
Imports URLs (one per line) from the file with the given file system path.
3233
This component is optional and therefore the API will only work if it is installed
3334
"""
3435
return six.next(six.itervalues(self.zap._request(self.zap.base + 'importurls/action/importurls/', {'filePath': filepath, 'apikey': apikey})))

src/zapv2/replacer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ def rules(self):
3535
"""
3636
return six.next(six.itervalues(self.zap._request(self.zap.base + 'replacer/view/rules/')))
3737

38-
def add_rule(self, description, enabled, matchtype, matchregex, matchstring, replacement, initiators=None, apikey=''):
38+
def add_rule(self, description, enabled, matchtype, matchregex, matchstring, replacement=None, initiators=None, apikey=''):
3939
"""
4040
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 <a href="https://github.com/zaproxy/zaproxy/blob/develop/src/org/parosproxy/paros/network/HttpSender.java">HttpSender</a>
4141
This component is optional and therefore the API will only work if it is installed
4242
"""
43-
params = {'description': description, 'enabled': enabled, 'matchType': matchtype, 'matchRegex': matchregex, 'matchString': matchstring, 'replacement': replacement, 'apikey': apikey}
43+
params = {'description': description, 'enabled': enabled, 'matchType': matchtype, 'matchRegex': matchregex, 'matchString': matchstring, 'apikey': apikey}
44+
if replacement is not None:
45+
params['replacement'] = replacement
4446
if initiators is not None:
4547
params['initiators'] = initiators
4648
return six.next(six.itervalues(self.zap._request(self.zap.base + 'replacer/action/addRule/', 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