|
| 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 2019 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 alertFilter(object): |
| 26 | + |
| 27 | + def __init__(self, zap): |
| 28 | + self.zap = zap |
| 29 | + |
| 30 | + def alert_filter_list(self, contextid): |
| 31 | + """ |
| 32 | + Lists the alert filters of the context with the given 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 + 'alertFilter/view/alertFilterList/', {'contextId': contextid}))) |
| 36 | + |
| 37 | + def add_alert_filter(self, contextid, ruleid, newlevel, url=None, urlisregex=None, parameter=None, enabled=None, apikey=''): |
| 38 | + """ |
| 39 | + Adds a new alert filter for the context with the given ID. |
| 40 | + This component is optional and therefore the API will only work if it is installed |
| 41 | + """ |
| 42 | + params = {'contextId': contextid, 'ruleId': ruleid, 'newLevel': newlevel, 'apikey': apikey} |
| 43 | + if url is not None: |
| 44 | + params['url'] = url |
| 45 | + if urlisregex is not None: |
| 46 | + params['urlIsRegex'] = urlisregex |
| 47 | + if parameter is not None: |
| 48 | + params['parameter'] = parameter |
| 49 | + if enabled is not None: |
| 50 | + params['enabled'] = enabled |
| 51 | + return six.next(six.itervalues(self.zap._request(self.zap.base + 'alertFilter/action/addAlertFilter/', params))) |
| 52 | + |
| 53 | + def remove_alert_filter(self, contextid, ruleid, newlevel, url=None, urlisregex=None, parameter=None, enabled=None, apikey=''): |
| 54 | + """ |
| 55 | + Removes an alert filter from the context with the given ID. |
| 56 | + This component is optional and therefore the API will only work if it is installed |
| 57 | + """ |
| 58 | + params = {'contextId': contextid, 'ruleId': ruleid, 'newLevel': newlevel, 'apikey': apikey} |
| 59 | + if url is not None: |
| 60 | + params['url'] = url |
| 61 | + if urlisregex is not None: |
| 62 | + params['urlIsRegex'] = urlisregex |
| 63 | + if parameter is not None: |
| 64 | + params['parameter'] = parameter |
| 65 | + if enabled is not None: |
| 66 | + params['enabled'] = enabled |
| 67 | + return six.next(six.itervalues(self.zap._request(self.zap.base + 'alertFilter/action/removeAlertFilter/', params))) |
0 commit comments