Class: ZAPv2::Network

Inherits:
Object
  • Object
show all
Defined in:
lib/zap/v2apis/network.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Network

Returns a new instance of Network.



5
6
7
# File 'lib/zap/v2apis/network.rb', line 5

def initialize(client)
  @client = client
end

Instance Method Details

#add_alias(name, enabled) ⇒ Object



73
74
75
# File 'lib/zap/v2apis/network.rb', line 73

def add_alias(name, enabled)
  @client.get("/JSON/network/action/addAlias/?name=#{name}&enabled=#{enabled}")
end

#add_http_proxy_exclusion(host, enabled) ⇒ Object



77
78
79
# File 'lib/zap/v2apis/network.rb', line 77

def add_http_proxy_exclusion(host, enabled)
  @client.get("/JSON/network/action/addHttpProxyExclusion/?host=#{host}&enabled=#{enabled}")
end

#add_local_server(address, port, api, proxy, behind_nat, decode_response, remove_accept_encoding) ⇒ Object



81
82
83
# File 'lib/zap/v2apis/network.rb', line 81

def add_local_server(address, port, api, proxy, behind_nat, decode_response, remove_accept_encoding)
  @client.get("/JSON/network/action/addLocalServer/?address=#{address}&port=#{port}&api=#{api}&proxy=#{proxy}&behindNat=#{behind_nat}&decodeResponse=#{decode_response}&removeAcceptEncoding=#{remove_accept_encoding}")
end

#add_pass_through(authority, enabled) ⇒ Object



85
86
87
# File 'lib/zap/v2apis/network.rb', line 85

def add_pass_through(authority, enabled)
  @client.get("/JSON/network/action/addPassThrough/?authority=#{authority}&enabled=#{enabled}")
end

#add_pkcs12_client_certificate(file_path, password, index) ⇒ Object



89
90
91
# File 'lib/zap/v2apis/network.rb', line 89

def add_pkcs12_client_certificate(file_path, password, index)
  @client.get("/JSON/network/action/addPkcs12ClientCertificate/?filePath=#{file_path}&password=#{password}&index=#{index}")
end

#add_rate_limit_rule(description, enabled, match_regex, match_string, requests_per_second, group_by) ⇒ Object



93
94
95
# File 'lib/zap/v2apis/network.rb', line 93

def add_rate_limit_rule(description, enabled, match_regex, match_string, requests_per_second, group_by)
  @client.get("/JSON/network/action/addRateLimitRule/?description=#{description}&enabled=#{enabled}&matchRegex=#{match_regex}&matchString=#{match_string}&requestsPerSecond=#{requests_per_second}&groupBy=#{group_by}")
end

#generate_root_ca_certObject



97
98
99
# File 'lib/zap/v2apis/network.rb', line 97

def generate_root_ca_cert
  @client.get('/JSON/network/action/generateRootCaCert/')
end

#get_aliasesObject



9
10
11
# File 'lib/zap/v2apis/network.rb', line 9

def get_aliases
  @client.get('/JSON/network/view/getAliases/')
end

#get_connection_timeoutObject



13
14
15
# File 'lib/zap/v2apis/network.rb', line 13

def get_connection_timeout
  @client.get('/JSON/network/view/getConnectionTimeout/')
end

#get_default_user_agentObject



17
18
19
# File 'lib/zap/v2apis/network.rb', line 17

def get_default_user_agent
  @client.get('/JSON/network/view/getDefaultUserAgent/')
end

#get_dns_ttl_successful_queriesObject



21
22
23
# File 'lib/zap/v2apis/network.rb', line 21

def get_dns_ttl_successful_queries
  @client.get('/JSON/network/view/getDnsTtlSuccessfulQueries/')
end

#get_http_proxyObject



25
26
27
# File 'lib/zap/v2apis/network.rb', line 25

def get_http_proxy
  @client.get('/JSON/network/view/getHttpProxy/')
end

#get_http_proxy_exclusionsObject



29
30
31
# File 'lib/zap/v2apis/network.rb', line 29

def get_http_proxy_exclusions
  @client.get('/JSON/network/view/getHttpProxyExclusions/')
end

#get_local_serversObject



33
34
35
# File 'lib/zap/v2apis/network.rb', line 33

def get_local_servers
  @client.get('/JSON/network/view/getLocalServers/')
end

#get_pass_throughsObject



37
38
39
# File 'lib/zap/v2apis/network.rb', line 37

def get_pass_throughs
  @client.get('/JSON/network/view/getPassThroughs/')
end

#get_rate_limit_rulesObject



41
42
43
# File 'lib/zap/v2apis/network.rb', line 41

def get_rate_limit_rules
  @client.get('/JSON/network/view/getRateLimitRules/')
end

#get_root_ca_cert_validityObject



45
46
47
# File 'lib/zap/v2apis/network.rb', line 45

def get_root_ca_cert_validity
  @client.get('/JSON/network/view/getRootCaCertValidity/')
end

#get_server_cert_validityObject



49
50
51
# File 'lib/zap/v2apis/network.rb', line 49

def get_server_cert_validity
  @client.get('/JSON/network/view/getServerCertValidity/')
end

#get_socks_proxyObject



53
54
55
# File 'lib/zap/v2apis/network.rb', line 53

def get_socks_proxy
  @client.get('/JSON/network/view/getSocksProxy/')
end

#import_root_ca_cert(file_path) ⇒ Object



101
102
103
# File 'lib/zap/v2apis/network.rb', line 101

def import_root_ca_cert(file_path)
  @client.get("/JSON/network/action/importRootCaCert/?filePath=#{file_path}")
end

#is_http_proxy_auth_enabledObject



57
58
59
# File 'lib/zap/v2apis/network.rb', line 57

def is_http_proxy_auth_enabled
  @client.get('/JSON/network/view/isHttpProxyAuthEnabled/')
end

#is_http_proxy_enabledObject



61
62
63
# File 'lib/zap/v2apis/network.rb', line 61

def is_http_proxy_enabled
  @client.get('/JSON/network/view/isHttpProxyEnabled/')
end

#is_socks_proxy_enabledObject



65
66
67
# File 'lib/zap/v2apis/network.rb', line 65

def is_socks_proxy_enabled
  @client.get('/JSON/network/view/isSocksProxyEnabled/')
end

#is_use_global_http_stateObject



69
70
71
# File 'lib/zap/v2apis/network.rb', line 69

def is_use_global_http_state
  @client.get('/JSON/network/view/isUseGlobalHttpState/')
end

#proxy_pacObject



189
190
191
# File 'lib/zap/v2apis/network.rb', line 189

def proxy_pac
  @client.get('/OTHER/network/other/proxy.pac/')
end

#remove_alias(name) ⇒ Object



105
106
107
# File 'lib/zap/v2apis/network.rb', line 105

def remove_alias(name)
  @client.get("/JSON/network/action/removeAlias/?name=#{name}")
end

#remove_http_proxy_exclusion(host) ⇒ Object



109
110
111
# File 'lib/zap/v2apis/network.rb', line 109

def remove_http_proxy_exclusion(host)
  @client.get("/JSON/network/action/removeHttpProxyExclusion/?host=#{host}")
end

#remove_local_server(address, port) ⇒ Object



113
114
115
# File 'lib/zap/v2apis/network.rb', line 113

def remove_local_server(address, port)
  @client.get("/JSON/network/action/removeLocalServer/?address=#{address}&port=#{port}")
end

#remove_pass_through(authority) ⇒ Object



117
118
119
# File 'lib/zap/v2apis/network.rb', line 117

def remove_pass_through(authority)
  @client.get("/JSON/network/action/removePassThrough/?authority=#{authority}")
end

#remove_rate_limit_rule(description) ⇒ Object



121
122
123
# File 'lib/zap/v2apis/network.rb', line 121

def remove_rate_limit_rule(description)
  @client.get("/JSON/network/action/removeRateLimitRule/?description=#{description}")
end

#root_ca_certObject



193
194
195
# File 'lib/zap/v2apis/network.rb', line 193

def root_ca_cert
  @client.get('/OTHER/network/other/rootCaCert/')
end

#set_alias_enabled(name, enabled) ⇒ Object



125
126
127
# File 'lib/zap/v2apis/network.rb', line 125

def set_alias_enabled(name, enabled)
  @client.get("/JSON/network/action/setAliasEnabled/?name=#{name}&enabled=#{enabled}")
end

#set_connection_timeout(timeout) ⇒ Object



129
130
131
# File 'lib/zap/v2apis/network.rb', line 129

def set_connection_timeout(timeout)
  @client.get("/JSON/network/action/setConnectionTimeout/?timeout=#{timeout}")
end

#set_default_user_agent(user_agent) ⇒ Object



133
134
135
# File 'lib/zap/v2apis/network.rb', line 133

def set_default_user_agent(user_agent)
  @client.get("/JSON/network/action/setDefaultUserAgent/?userAgent=#{user_agent}")
end

#set_dns_ttl_successful_queries(ttl) ⇒ Object



137
138
139
# File 'lib/zap/v2apis/network.rb', line 137

def set_dns_ttl_successful_queries(ttl)
  @client.get("/JSON/network/action/setDnsTtlSuccessfulQueries/?ttl=#{ttl}")
end

#set_http_proxy(host, port, realm, username, password) ⇒ Object



141
142
143
# File 'lib/zap/v2apis/network.rb', line 141

def set_http_proxy(host, port, realm, username, password)
  @client.get("/JSON/network/action/setHttpProxy/?host=#{host}&port=#{port}&realm=#{realm}&username=#{username}&password=#{password}")
end

#set_http_proxy_auth_enabled(enabled) ⇒ Object



145
146
147
# File 'lib/zap/v2apis/network.rb', line 145

def set_http_proxy_auth_enabled(enabled)
  @client.get("/JSON/network/action/setHttpProxyAuthEnabled/?enabled=#{enabled}")
end

#set_http_proxy_enabled(enabled) ⇒ Object



149
150
151
# File 'lib/zap/v2apis/network.rb', line 149

def set_http_proxy_enabled(enabled)
  @client.get("/JSON/network/action/setHttpProxyEnabled/?enabled=#{enabled}")
end

#set_http_proxy_exclusion_enabled(host, enabled) ⇒ Object



153
154
155
# File 'lib/zap/v2apis/network.rb', line 153

def set_http_proxy_exclusion_enabled(host, enabled)
  @client.get("/JSON/network/action/setHttpProxyExclusionEnabled/?host=#{host}&enabled=#{enabled}")
end

#set_pass_through_enabled(authority, enabled) ⇒ Object



157
158
159
# File 'lib/zap/v2apis/network.rb', line 157

def set_pass_through_enabled(authority, enabled)
  @client.get("/JSON/network/action/setPassThroughEnabled/?authority=#{authority}&enabled=#{enabled}")
end

#set_proxy(proxy) ⇒ Object



197
198
199
# File 'lib/zap/v2apis/network.rb', line 197

def set_proxy(proxy)
  @client.get("/OTHER/network/other/setProxy/?proxy=#{proxy}")
end

#set_rate_limit_rule_enabled(description, enabled) ⇒ Object



161
162
163
# File 'lib/zap/v2apis/network.rb', line 161

def set_rate_limit_rule_enabled(description, enabled)
  @client.get("/JSON/network/action/setRateLimitRuleEnabled/?description=#{description}&enabled=#{enabled}")
end

#set_root_ca_cert_validity(validity) ⇒ Object



165
166
167
# File 'lib/zap/v2apis/network.rb', line 165

def set_root_ca_cert_validity(validity)
  @client.get("/JSON/network/action/setRootCaCertValidity/?validity=#{validity}")
end

#set_server_cert_validity(validity) ⇒ Object



169
170
171
# File 'lib/zap/v2apis/network.rb', line 169

def set_server_cert_validity(validity)
  @client.get("/JSON/network/action/setServerCertValidity/?validity=#{validity}")
end

#set_socks_proxy(host, port, version, use_dns, username, password) ⇒ Object



173
174
175
# File 'lib/zap/v2apis/network.rb', line 173

def set_socks_proxy(host, port, version, use_dns, username, password)
  @client.get("/JSON/network/action/setSocksProxy/?host=#{host}&port=#{port}&version=#{version}&useDns=#{use_dns}&username=#{username}&password=#{password}")
end

#set_socks_proxy_enabled(enabled) ⇒ Object



177
178
179
# File 'lib/zap/v2apis/network.rb', line 177

def set_socks_proxy_enabled(enabled)
  @client.get("/JSON/network/action/setSocksProxyEnabled/?enabled=#{enabled}")
end

#set_use_client_certificate(use) ⇒ Object



181
182
183
# File 'lib/zap/v2apis/network.rb', line 181

def set_use_client_certificate(use)
  @client.get("/JSON/network/action/setUseClientCertificate/?use=#{use}")
end

#set_use_global_http_state(use) ⇒ Object



185
186
187
# File 'lib/zap/v2apis/network.rb', line 185

def set_use_global_http_state(use)
  @client.get("/JSON/network/action/setUseGlobalHttpState/?use=#{use}")
end