Skip to content

Commit 8a3ee2b

Browse files
authored
Merge pull request zaproxy#47 from thc202/add-core-apis
Add more core APIs
2 parents b144a2b + 0106885 commit 8a3ee2b

File tree

4 files changed

+122
-1
lines changed

4 files changed

+122
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
55

66
## [Unreleased]
7-
7+
### Added
8+
- Core APIs from ZAP version 2.8.0.
89

910
## [0.0.15] - 2019-06-14
1011
### Added

src/zapv2/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@
4040
from .httpSessions import httpSessions
4141
from .importLogFiles import importLogFiles
4242
from .importurls import importurls
43+
from .localProxies import localProxies
4344
from .openapi import openapi
4445
from .params import params
4546
from .pnh import pnh
4647
from .pscan import pscan
4748
from .replacer import replacer
4849
from .reveal import reveal
50+
from .ruleConfig import ruleConfig
4951
from .script import script
5052
from .search import search
5153
from .selenium import selenium
@@ -96,12 +98,14 @@ def __init__(self, proxies=None, apikey=None, validate_status_code=False):
9698
self.httpsessions = httpSessions(self)
9799
self.importLogFiles = importLogFiles(self)
98100
self.importurls = importurls(self)
101+
self.localProxies = localProxies(self)
99102
self.openapi = openapi(self)
100103
self.params = params(self)
101104
self.pnh = pnh(self)
102105
self.pscan = pscan(self)
103106
self.replacer = replacer(self)
104107
self.reveal = reveal(self)
108+
self.ruleConfig = ruleConfig(self)
105109
self.script = script(self)
106110
self.search = search(self)
107111
self.selenium = selenium(self)

src/zapv2/localProxies.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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 localProxies(object):
26+
27+
def __init__(self, zap):
28+
self.zap = zap
29+
30+
@property
31+
def additional_proxies(self):
32+
"""
33+
Gets all of the additional proxies that have been configured.
34+
"""
35+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'localProxies/view/additionalProxies/')))
36+
37+
def add_additional_proxy(self, address, port, behindnat=None, alwaysdecodezip=None, removeunsupportedencodings=None, apikey=''):
38+
"""
39+
Adds an new proxy using the details supplied.
40+
"""
41+
params = {'address': address, 'port': port, 'apikey': apikey}
42+
if behindnat is not None:
43+
params['behindNat'] = behindnat
44+
if alwaysdecodezip is not None:
45+
params['alwaysDecodeZip'] = alwaysdecodezip
46+
if removeunsupportedencodings is not None:
47+
params['removeUnsupportedEncodings'] = removeunsupportedencodings
48+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'localProxies/action/addAdditionalProxy/', params)))
49+
50+
def remove_additional_proxy(self, address, port, apikey=''):
51+
"""
52+
Removes the additional proxy with the specified address and port.
53+
"""
54+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'localProxies/action/removeAdditionalProxy/', {'address': address, 'port': port, 'apikey': apikey})))

src/zapv2/ruleConfig.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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 ruleConfig(object):
26+
27+
def __init__(self, zap):
28+
self.zap = zap
29+
30+
def rule_config_value(self, key):
31+
"""
32+
Show the specified rule configuration
33+
"""
34+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'ruleConfig/view/ruleConfigValue/', {'key': key})))
35+
36+
@property
37+
def all_rule_configs(self):
38+
"""
39+
Show all of the rule configurations
40+
"""
41+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'ruleConfig/view/allRuleConfigs/')))
42+
43+
def reset_rule_config_value(self, key, apikey=''):
44+
"""
45+
Reset the specified rule configuration, which must already exist
46+
"""
47+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'ruleConfig/action/resetRuleConfigValue/', {'key': key, 'apikey': apikey})))
48+
49+
def reset_all_rule_config_values(self, apikey=''):
50+
"""
51+
Reset all of the rule configurations
52+
"""
53+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'ruleConfig/action/resetAllRuleConfigValues/', {'apikey': apikey})))
54+
55+
def set_rule_config_value(self, key, value=None, apikey=''):
56+
"""
57+
Set the specified rule configuration, which must already exist
58+
"""
59+
params = {'key': key, 'apikey': apikey}
60+
if value is not None:
61+
params['value'] = value
62+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'ruleConfig/action/setRuleConfigValue/', 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