|
| 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 2022 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 was hand typed by a human, not generated by a script. |
| 20 | +""" |
| 21 | + |
| 22 | +import warnings |
| 23 | +import six |
| 24 | + |
| 25 | + |
| 26 | +class ClientSpider: |
| 27 | + |
| 28 | + def __init__(self, zap): |
| 29 | + self.zap = zap |
| 30 | + |
| 31 | + def status(self, scanid=None): |
| 32 | + """ |
| 33 | + |
| 34 | + This component is optional and therefore the API will only work if it is installed |
| 35 | + """ |
| 36 | + params = {} |
| 37 | + if scanid is not None: |
| 38 | + params['scanId'] = scanid |
| 39 | + return six.next(six.itervalues(self.zap._request(self.zap.base + 'clientSpider/view/status/', params))) |
| 40 | + |
| 41 | + |
| 42 | + def scan(self, url=None, browser=None, contextName=None, userName=None, subtreeonly=None, apikey=''): |
| 43 | + """ |
| 44 | + Runs the spider against the given URL (or context). Optionally, 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'). |
| 45 | + This component is optional and therefore the API will only work if it is installed. |
| 46 | + """ |
| 47 | + if apikey: |
| 48 | + warnings.warn("The 'apikey' parameter is deprecated (unused) and will be removed in a future release.") |
| 49 | + |
| 50 | + params = {} |
| 51 | + if browser is not None: |
| 52 | + params['browser'] = browser |
| 53 | + if url is not None: |
| 54 | + params['url'] = url |
| 55 | + if contextName is not None: |
| 56 | + params['contextName'] = contextName |
| 57 | + if userName is not None: |
| 58 | + params['userName'] = userName |
| 59 | + if subtreeonly is not None: |
| 60 | + params['subtreeOnly'] = subtreeonly |
| 61 | + return six.next(six.itervalues(self.zap._request(self.zap.base + 'clientSpider/action/scan/', params))) |
| 62 | + |
| 63 | + def stop(self, scanid=None, apikey=''): |
| 64 | + """ |
| 65 | + This component is optional and therefore the API will only work if it is installed |
| 66 | + """ |
| 67 | + if apikey: |
| 68 | + warnings.warn("The 'apikey' parameter is deprecated (unused) and will be removed in a future release.") |
| 69 | + |
| 70 | + params = {} |
| 71 | + if scanid is not None: |
| 72 | + params['scanId'] = scanid |
| 73 | + return six.next(six.itervalues(self.zap._request(self.zap.base + 'clientSpider/action/stop/', params))) |
0 commit comments