mithwire 0.50.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mithwire/__init__.py +32 -0
- mithwire/cdp/README.md +4 -0
- mithwire/cdp/__init__.py +6 -0
- mithwire/cdp/accessibility.py +668 -0
- mithwire/cdp/animation.py +494 -0
- mithwire/cdp/audits.py +1995 -0
- mithwire/cdp/autofill.py +292 -0
- mithwire/cdp/background_service.py +215 -0
- mithwire/cdp/bluetooth_emulation.py +626 -0
- mithwire/cdp/browser.py +821 -0
- mithwire/cdp/cache_storage.py +311 -0
- mithwire/cdp/cast.py +172 -0
- mithwire/cdp/console.py +107 -0
- mithwire/cdp/crash_report_context.py +55 -0
- mithwire/cdp/css.py +2750 -0
- mithwire/cdp/database.py +179 -0
- mithwire/cdp/debugger.py +1405 -0
- mithwire/cdp/device_access.py +141 -0
- mithwire/cdp/device_orientation.py +45 -0
- mithwire/cdp/dom.py +2257 -0
- mithwire/cdp/dom_debugger.py +321 -0
- mithwire/cdp/dom_snapshot.py +876 -0
- mithwire/cdp/dom_storage.py +222 -0
- mithwire/cdp/emulation.py +1779 -0
- mithwire/cdp/event_breakpoints.py +56 -0
- mithwire/cdp/extensions.py +238 -0
- mithwire/cdp/fed_cm.py +283 -0
- mithwire/cdp/fetch.py +507 -0
- mithwire/cdp/file_system.py +115 -0
- mithwire/cdp/headless_experimental.py +115 -0
- mithwire/cdp/heap_profiler.py +401 -0
- mithwire/cdp/indexed_db.py +528 -0
- mithwire/cdp/input_.py +701 -0
- mithwire/cdp/inspector.py +95 -0
- mithwire/cdp/io.py +101 -0
- mithwire/cdp/layer_tree.py +464 -0
- mithwire/cdp/log.py +190 -0
- mithwire/cdp/media.py +313 -0
- mithwire/cdp/memory.py +305 -0
- mithwire/cdp/network.py +5342 -0
- mithwire/cdp/overlay.py +1468 -0
- mithwire/cdp/page.py +3972 -0
- mithwire/cdp/performance.py +124 -0
- mithwire/cdp/performance_timeline.py +200 -0
- mithwire/cdp/preload.py +575 -0
- mithwire/cdp/profiler.py +420 -0
- mithwire/cdp/pwa.py +278 -0
- mithwire/cdp/py.typed +0 -0
- mithwire/cdp/runtime.py +1589 -0
- mithwire/cdp/schema.py +50 -0
- mithwire/cdp/security.py +518 -0
- mithwire/cdp/service_worker.py +401 -0
- mithwire/cdp/smart_card_emulation.py +891 -0
- mithwire/cdp/storage.py +1573 -0
- mithwire/cdp/system_info.py +327 -0
- mithwire/cdp/target.py +829 -0
- mithwire/cdp/tethering.py +65 -0
- mithwire/cdp/tracing.py +377 -0
- mithwire/cdp/util.py +18 -0
- mithwire/cdp/web_audio.py +606 -0
- mithwire/cdp/web_authn.py +598 -0
- mithwire/cdp/web_mcp.py +293 -0
- mithwire/core/_contradict.py +142 -0
- mithwire/core/browser.py +923 -0
- mithwire/core/cf_templates/cf_dark_checkbox.png +0 -0
- mithwire/core/cf_templates/cf_light_checkbox.png +0 -0
- mithwire/core/config.py +323 -0
- mithwire/core/connection.py +564 -0
- mithwire/core/element.py +1205 -0
- mithwire/core/tab.py +2202 -0
- mithwire/core/util.py +5063 -0
- mithwire-0.50.3.dist-info/METADATA +1049 -0
- mithwire-0.50.3.dist-info/RECORD +76 -0
- mithwire-0.50.3.dist-info/WHEEL +5 -0
- mithwire-0.50.3.dist-info/licenses/LICENSE.txt +619 -0
- mithwire-0.50.3.dist-info/top_level.txt +1 -0
mithwire/cdp/schema.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# DO NOT EDIT THIS FILE!
|
|
2
|
+
#
|
|
3
|
+
# This file is generated from the CDP specification. If you need to make
|
|
4
|
+
# changes, edit the generator and regenerate all of the modules.
|
|
5
|
+
#
|
|
6
|
+
# CDP domain: Schema
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
import enum
|
|
10
|
+
import typing
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
from .util import event_class, T_JSON_DICT
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass
|
|
16
|
+
class Domain:
|
|
17
|
+
'''
|
|
18
|
+
Description of the protocol domain.
|
|
19
|
+
'''
|
|
20
|
+
#: Domain name.
|
|
21
|
+
name: str
|
|
22
|
+
|
|
23
|
+
#: Domain version.
|
|
24
|
+
version: str
|
|
25
|
+
|
|
26
|
+
def to_json(self) -> T_JSON_DICT:
|
|
27
|
+
json: T_JSON_DICT = dict()
|
|
28
|
+
json['name'] = self.name
|
|
29
|
+
json['version'] = self.version
|
|
30
|
+
return json
|
|
31
|
+
|
|
32
|
+
@classmethod
|
|
33
|
+
def from_json(cls, json: T_JSON_DICT) -> Domain:
|
|
34
|
+
return cls(
|
|
35
|
+
name=str(json['name']),
|
|
36
|
+
version=str(json['version']),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def get_domains() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Domain]]:
|
|
41
|
+
'''
|
|
42
|
+
Returns supported domains.
|
|
43
|
+
|
|
44
|
+
:returns: List of supported domains.
|
|
45
|
+
'''
|
|
46
|
+
cmd_dict: T_JSON_DICT = {
|
|
47
|
+
'method': 'Schema.getDomains',
|
|
48
|
+
}
|
|
49
|
+
json = yield cmd_dict
|
|
50
|
+
return [Domain.from_json(i) for i in json['domains']]
|
mithwire/cdp/security.py
ADDED
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
# DO NOT EDIT THIS FILE!
|
|
2
|
+
#
|
|
3
|
+
# This file is generated from the CDP specification. If you need to make
|
|
4
|
+
# changes, edit the generator and regenerate all of the modules.
|
|
5
|
+
#
|
|
6
|
+
# CDP domain: Security
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
import enum
|
|
10
|
+
import typing
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
from .util import event_class, T_JSON_DICT
|
|
13
|
+
|
|
14
|
+
from . import network
|
|
15
|
+
from deprecated.sphinx import deprecated # type: ignore
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class CertificateId(int):
|
|
19
|
+
'''
|
|
20
|
+
An internal certificate ID value.
|
|
21
|
+
'''
|
|
22
|
+
def to_json(self) -> int:
|
|
23
|
+
return self
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
def from_json(cls, json: int) -> CertificateId:
|
|
27
|
+
return cls(json)
|
|
28
|
+
|
|
29
|
+
def __repr__(self):
|
|
30
|
+
return 'CertificateId({})'.format(super().__repr__())
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class MixedContentType(enum.Enum):
|
|
34
|
+
'''
|
|
35
|
+
A description of mixed content (HTTP resources on HTTPS pages), as defined by
|
|
36
|
+
https://www.w3.org/TR/mixed-content/#categories
|
|
37
|
+
'''
|
|
38
|
+
BLOCKABLE = "blockable"
|
|
39
|
+
OPTIONALLY_BLOCKABLE = "optionally-blockable"
|
|
40
|
+
NONE = "none"
|
|
41
|
+
|
|
42
|
+
def to_json(self) -> str:
|
|
43
|
+
return self.value
|
|
44
|
+
|
|
45
|
+
@classmethod
|
|
46
|
+
def from_json(cls, json: str) -> MixedContentType:
|
|
47
|
+
return cls(json)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class SecurityState(enum.Enum):
|
|
51
|
+
'''
|
|
52
|
+
The security level of a page or resource.
|
|
53
|
+
'''
|
|
54
|
+
UNKNOWN = "unknown"
|
|
55
|
+
NEUTRAL = "neutral"
|
|
56
|
+
INSECURE = "insecure"
|
|
57
|
+
SECURE = "secure"
|
|
58
|
+
INFO = "info"
|
|
59
|
+
INSECURE_BROKEN = "insecure-broken"
|
|
60
|
+
|
|
61
|
+
def to_json(self) -> str:
|
|
62
|
+
return self.value
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def from_json(cls, json: str) -> SecurityState:
|
|
66
|
+
return cls(json)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@dataclass
|
|
70
|
+
class CertificateSecurityState:
|
|
71
|
+
'''
|
|
72
|
+
Details about the security state of the page certificate.
|
|
73
|
+
'''
|
|
74
|
+
#: Protocol name (e.g. "TLS 1.2" or "QUIC").
|
|
75
|
+
protocol: str
|
|
76
|
+
|
|
77
|
+
#: Key Exchange used by the connection, or the empty string if not applicable.
|
|
78
|
+
key_exchange: str
|
|
79
|
+
|
|
80
|
+
#: Cipher name.
|
|
81
|
+
cipher: str
|
|
82
|
+
|
|
83
|
+
#: Page certificate.
|
|
84
|
+
certificate: typing.List[str]
|
|
85
|
+
|
|
86
|
+
#: Certificate subject name.
|
|
87
|
+
subject_name: str
|
|
88
|
+
|
|
89
|
+
#: Name of the issuing CA.
|
|
90
|
+
issuer: str
|
|
91
|
+
|
|
92
|
+
#: Certificate valid from date.
|
|
93
|
+
valid_from: network.TimeSinceEpoch
|
|
94
|
+
|
|
95
|
+
#: Certificate valid to (expiration) date
|
|
96
|
+
valid_to: network.TimeSinceEpoch
|
|
97
|
+
|
|
98
|
+
#: True if the certificate uses a weak signature algorithm.
|
|
99
|
+
certificate_has_weak_signature: bool
|
|
100
|
+
|
|
101
|
+
#: True if the certificate has a SHA1 signature in the chain.
|
|
102
|
+
certificate_has_sha1_signature: bool
|
|
103
|
+
|
|
104
|
+
#: True if modern SSL
|
|
105
|
+
modern_ssl: bool
|
|
106
|
+
|
|
107
|
+
#: True if the connection is using an obsolete SSL protocol.
|
|
108
|
+
obsolete_ssl_protocol: bool
|
|
109
|
+
|
|
110
|
+
#: True if the connection is using an obsolete SSL key exchange.
|
|
111
|
+
obsolete_ssl_key_exchange: bool
|
|
112
|
+
|
|
113
|
+
#: True if the connection is using an obsolete SSL cipher.
|
|
114
|
+
obsolete_ssl_cipher: bool
|
|
115
|
+
|
|
116
|
+
#: True if the connection is using an obsolete SSL signature.
|
|
117
|
+
obsolete_ssl_signature: bool
|
|
118
|
+
|
|
119
|
+
#: (EC)DH group used by the connection, if applicable.
|
|
120
|
+
key_exchange_group: typing.Optional[str] = None
|
|
121
|
+
|
|
122
|
+
#: TLS MAC. Note that AEAD ciphers do not have separate MACs.
|
|
123
|
+
mac: typing.Optional[str] = None
|
|
124
|
+
|
|
125
|
+
#: The highest priority network error code, if the certificate has an error.
|
|
126
|
+
certificate_network_error: typing.Optional[str] = None
|
|
127
|
+
|
|
128
|
+
def to_json(self) -> T_JSON_DICT:
|
|
129
|
+
json: T_JSON_DICT = dict()
|
|
130
|
+
json['protocol'] = self.protocol
|
|
131
|
+
json['keyExchange'] = self.key_exchange
|
|
132
|
+
json['cipher'] = self.cipher
|
|
133
|
+
json['certificate'] = [i for i in self.certificate]
|
|
134
|
+
json['subjectName'] = self.subject_name
|
|
135
|
+
json['issuer'] = self.issuer
|
|
136
|
+
json['validFrom'] = self.valid_from.to_json()
|
|
137
|
+
json['validTo'] = self.valid_to.to_json()
|
|
138
|
+
json['certificateHasWeakSignature'] = self.certificate_has_weak_signature
|
|
139
|
+
json['certificateHasSha1Signature'] = self.certificate_has_sha1_signature
|
|
140
|
+
json['modernSSL'] = self.modern_ssl
|
|
141
|
+
json['obsoleteSslProtocol'] = self.obsolete_ssl_protocol
|
|
142
|
+
json['obsoleteSslKeyExchange'] = self.obsolete_ssl_key_exchange
|
|
143
|
+
json['obsoleteSslCipher'] = self.obsolete_ssl_cipher
|
|
144
|
+
json['obsoleteSslSignature'] = self.obsolete_ssl_signature
|
|
145
|
+
if self.key_exchange_group is not None:
|
|
146
|
+
json['keyExchangeGroup'] = self.key_exchange_group
|
|
147
|
+
if self.mac is not None:
|
|
148
|
+
json['mac'] = self.mac
|
|
149
|
+
if self.certificate_network_error is not None:
|
|
150
|
+
json['certificateNetworkError'] = self.certificate_network_error
|
|
151
|
+
return json
|
|
152
|
+
|
|
153
|
+
@classmethod
|
|
154
|
+
def from_json(cls, json: T_JSON_DICT) -> CertificateSecurityState:
|
|
155
|
+
return cls(
|
|
156
|
+
protocol=str(json['protocol']),
|
|
157
|
+
key_exchange=str(json['keyExchange']),
|
|
158
|
+
cipher=str(json['cipher']),
|
|
159
|
+
certificate=[str(i) for i in json['certificate']],
|
|
160
|
+
subject_name=str(json['subjectName']),
|
|
161
|
+
issuer=str(json['issuer']),
|
|
162
|
+
valid_from=network.TimeSinceEpoch.from_json(json['validFrom']),
|
|
163
|
+
valid_to=network.TimeSinceEpoch.from_json(json['validTo']),
|
|
164
|
+
certificate_has_weak_signature=bool(json['certificateHasWeakSignature']),
|
|
165
|
+
certificate_has_sha1_signature=bool(json['certificateHasSha1Signature']),
|
|
166
|
+
modern_ssl=bool(json['modernSSL']),
|
|
167
|
+
obsolete_ssl_protocol=bool(json['obsoleteSslProtocol']),
|
|
168
|
+
obsolete_ssl_key_exchange=bool(json['obsoleteSslKeyExchange']),
|
|
169
|
+
obsolete_ssl_cipher=bool(json['obsoleteSslCipher']),
|
|
170
|
+
obsolete_ssl_signature=bool(json['obsoleteSslSignature']),
|
|
171
|
+
key_exchange_group=str(json['keyExchangeGroup']) if json.get('keyExchangeGroup', None) is not None else None,
|
|
172
|
+
mac=str(json['mac']) if json.get('mac', None) is not None else None,
|
|
173
|
+
certificate_network_error=str(json['certificateNetworkError']) if json.get('certificateNetworkError', None) is not None else None,
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class SafetyTipStatus(enum.Enum):
|
|
178
|
+
BAD_REPUTATION = "badReputation"
|
|
179
|
+
LOOKALIKE = "lookalike"
|
|
180
|
+
|
|
181
|
+
def to_json(self) -> str:
|
|
182
|
+
return self.value
|
|
183
|
+
|
|
184
|
+
@classmethod
|
|
185
|
+
def from_json(cls, json: str) -> SafetyTipStatus:
|
|
186
|
+
return cls(json)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
@dataclass
|
|
190
|
+
class SafetyTipInfo:
|
|
191
|
+
#: Describes whether the page triggers any safety tips or reputation warnings. Default is unknown.
|
|
192
|
+
safety_tip_status: SafetyTipStatus
|
|
193
|
+
|
|
194
|
+
#: The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches.
|
|
195
|
+
safe_url: typing.Optional[str] = None
|
|
196
|
+
|
|
197
|
+
def to_json(self) -> T_JSON_DICT:
|
|
198
|
+
json: T_JSON_DICT = dict()
|
|
199
|
+
json['safetyTipStatus'] = self.safety_tip_status.to_json()
|
|
200
|
+
if self.safe_url is not None:
|
|
201
|
+
json['safeUrl'] = self.safe_url
|
|
202
|
+
return json
|
|
203
|
+
|
|
204
|
+
@classmethod
|
|
205
|
+
def from_json(cls, json: T_JSON_DICT) -> SafetyTipInfo:
|
|
206
|
+
return cls(
|
|
207
|
+
safety_tip_status=SafetyTipStatus.from_json(json['safetyTipStatus']),
|
|
208
|
+
safe_url=str(json['safeUrl']) if json.get('safeUrl', None) is not None else None,
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
@dataclass
|
|
213
|
+
class VisibleSecurityState:
|
|
214
|
+
'''
|
|
215
|
+
Security state information about the page.
|
|
216
|
+
'''
|
|
217
|
+
#: The security level of the page.
|
|
218
|
+
security_state: SecurityState
|
|
219
|
+
|
|
220
|
+
#: Array of security state issues ids.
|
|
221
|
+
security_state_issue_ids: typing.List[str]
|
|
222
|
+
|
|
223
|
+
#: Security state details about the page certificate.
|
|
224
|
+
certificate_security_state: typing.Optional[CertificateSecurityState] = None
|
|
225
|
+
|
|
226
|
+
#: The type of Safety Tip triggered on the page. Note that this field will be set even if the Safety Tip UI was not actually shown.
|
|
227
|
+
safety_tip_info: typing.Optional[SafetyTipInfo] = None
|
|
228
|
+
|
|
229
|
+
def to_json(self) -> T_JSON_DICT:
|
|
230
|
+
json: T_JSON_DICT = dict()
|
|
231
|
+
json['securityState'] = self.security_state.to_json()
|
|
232
|
+
json['securityStateIssueIds'] = [i for i in self.security_state_issue_ids]
|
|
233
|
+
if self.certificate_security_state is not None:
|
|
234
|
+
json['certificateSecurityState'] = self.certificate_security_state.to_json()
|
|
235
|
+
if self.safety_tip_info is not None:
|
|
236
|
+
json['safetyTipInfo'] = self.safety_tip_info.to_json()
|
|
237
|
+
return json
|
|
238
|
+
|
|
239
|
+
@classmethod
|
|
240
|
+
def from_json(cls, json: T_JSON_DICT) -> VisibleSecurityState:
|
|
241
|
+
return cls(
|
|
242
|
+
security_state=SecurityState.from_json(json['securityState']),
|
|
243
|
+
security_state_issue_ids=[str(i) for i in json['securityStateIssueIds']],
|
|
244
|
+
certificate_security_state=CertificateSecurityState.from_json(json['certificateSecurityState']) if json.get('certificateSecurityState', None) is not None else None,
|
|
245
|
+
safety_tip_info=SafetyTipInfo.from_json(json['safetyTipInfo']) if json.get('safetyTipInfo', None) is not None else None,
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
@dataclass
|
|
250
|
+
class SecurityStateExplanation:
|
|
251
|
+
'''
|
|
252
|
+
An explanation of an factor contributing to the security state.
|
|
253
|
+
'''
|
|
254
|
+
#: Security state representing the severity of the factor being explained.
|
|
255
|
+
security_state: SecurityState
|
|
256
|
+
|
|
257
|
+
#: Title describing the type of factor.
|
|
258
|
+
title: str
|
|
259
|
+
|
|
260
|
+
#: Short phrase describing the type of factor.
|
|
261
|
+
summary: str
|
|
262
|
+
|
|
263
|
+
#: Full text explanation of the factor.
|
|
264
|
+
description: str
|
|
265
|
+
|
|
266
|
+
#: The type of mixed content described by the explanation.
|
|
267
|
+
mixed_content_type: MixedContentType
|
|
268
|
+
|
|
269
|
+
#: Page certificate.
|
|
270
|
+
certificate: typing.List[str]
|
|
271
|
+
|
|
272
|
+
#: Recommendations to fix any issues.
|
|
273
|
+
recommendations: typing.Optional[typing.List[str]] = None
|
|
274
|
+
|
|
275
|
+
def to_json(self) -> T_JSON_DICT:
|
|
276
|
+
json: T_JSON_DICT = dict()
|
|
277
|
+
json['securityState'] = self.security_state.to_json()
|
|
278
|
+
json['title'] = self.title
|
|
279
|
+
json['summary'] = self.summary
|
|
280
|
+
json['description'] = self.description
|
|
281
|
+
json['mixedContentType'] = self.mixed_content_type.to_json()
|
|
282
|
+
json['certificate'] = [i for i in self.certificate]
|
|
283
|
+
if self.recommendations is not None:
|
|
284
|
+
json['recommendations'] = [i for i in self.recommendations]
|
|
285
|
+
return json
|
|
286
|
+
|
|
287
|
+
@classmethod
|
|
288
|
+
def from_json(cls, json: T_JSON_DICT) -> SecurityStateExplanation:
|
|
289
|
+
return cls(
|
|
290
|
+
security_state=SecurityState.from_json(json['securityState']),
|
|
291
|
+
title=str(json['title']),
|
|
292
|
+
summary=str(json['summary']),
|
|
293
|
+
description=str(json['description']),
|
|
294
|
+
mixed_content_type=MixedContentType.from_json(json['mixedContentType']),
|
|
295
|
+
certificate=[str(i) for i in json['certificate']],
|
|
296
|
+
recommendations=[str(i) for i in json['recommendations']] if json.get('recommendations', None) is not None else None,
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
@dataclass
|
|
301
|
+
class InsecureContentStatus:
|
|
302
|
+
'''
|
|
303
|
+
Information about insecure content on the page.
|
|
304
|
+
'''
|
|
305
|
+
#: Always false.
|
|
306
|
+
ran_mixed_content: bool
|
|
307
|
+
|
|
308
|
+
#: Always false.
|
|
309
|
+
displayed_mixed_content: bool
|
|
310
|
+
|
|
311
|
+
#: Always false.
|
|
312
|
+
contained_mixed_form: bool
|
|
313
|
+
|
|
314
|
+
#: Always false.
|
|
315
|
+
ran_content_with_cert_errors: bool
|
|
316
|
+
|
|
317
|
+
#: Always false.
|
|
318
|
+
displayed_content_with_cert_errors: bool
|
|
319
|
+
|
|
320
|
+
#: Always set to unknown.
|
|
321
|
+
ran_insecure_content_style: SecurityState
|
|
322
|
+
|
|
323
|
+
#: Always set to unknown.
|
|
324
|
+
displayed_insecure_content_style: SecurityState
|
|
325
|
+
|
|
326
|
+
def to_json(self) -> T_JSON_DICT:
|
|
327
|
+
json: T_JSON_DICT = dict()
|
|
328
|
+
json['ranMixedContent'] = self.ran_mixed_content
|
|
329
|
+
json['displayedMixedContent'] = self.displayed_mixed_content
|
|
330
|
+
json['containedMixedForm'] = self.contained_mixed_form
|
|
331
|
+
json['ranContentWithCertErrors'] = self.ran_content_with_cert_errors
|
|
332
|
+
json['displayedContentWithCertErrors'] = self.displayed_content_with_cert_errors
|
|
333
|
+
json['ranInsecureContentStyle'] = self.ran_insecure_content_style.to_json()
|
|
334
|
+
json['displayedInsecureContentStyle'] = self.displayed_insecure_content_style.to_json()
|
|
335
|
+
return json
|
|
336
|
+
|
|
337
|
+
@classmethod
|
|
338
|
+
def from_json(cls, json: T_JSON_DICT) -> InsecureContentStatus:
|
|
339
|
+
return cls(
|
|
340
|
+
ran_mixed_content=bool(json['ranMixedContent']),
|
|
341
|
+
displayed_mixed_content=bool(json['displayedMixedContent']),
|
|
342
|
+
contained_mixed_form=bool(json['containedMixedForm']),
|
|
343
|
+
ran_content_with_cert_errors=bool(json['ranContentWithCertErrors']),
|
|
344
|
+
displayed_content_with_cert_errors=bool(json['displayedContentWithCertErrors']),
|
|
345
|
+
ran_insecure_content_style=SecurityState.from_json(json['ranInsecureContentStyle']),
|
|
346
|
+
displayed_insecure_content_style=SecurityState.from_json(json['displayedInsecureContentStyle']),
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
class CertificateErrorAction(enum.Enum):
|
|
351
|
+
'''
|
|
352
|
+
The action to take when a certificate error occurs. continue will continue processing the
|
|
353
|
+
request and cancel will cancel the request.
|
|
354
|
+
'''
|
|
355
|
+
CONTINUE = "continue"
|
|
356
|
+
CANCEL = "cancel"
|
|
357
|
+
|
|
358
|
+
def to_json(self) -> str:
|
|
359
|
+
return self.value
|
|
360
|
+
|
|
361
|
+
@classmethod
|
|
362
|
+
def from_json(cls, json: str) -> CertificateErrorAction:
|
|
363
|
+
return cls(json)
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
367
|
+
'''
|
|
368
|
+
Disables tracking security state changes.
|
|
369
|
+
'''
|
|
370
|
+
cmd_dict: T_JSON_DICT = {
|
|
371
|
+
'method': 'Security.disable',
|
|
372
|
+
}
|
|
373
|
+
json = yield cmd_dict
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
377
|
+
'''
|
|
378
|
+
Enables tracking security state changes.
|
|
379
|
+
'''
|
|
380
|
+
cmd_dict: T_JSON_DICT = {
|
|
381
|
+
'method': 'Security.enable',
|
|
382
|
+
}
|
|
383
|
+
json = yield cmd_dict
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
def set_ignore_certificate_errors(
|
|
387
|
+
ignore: bool
|
|
388
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
389
|
+
'''
|
|
390
|
+
Enable/disable whether all certificate errors should be ignored.
|
|
391
|
+
|
|
392
|
+
:param ignore: If true, all certificate errors will be ignored.
|
|
393
|
+
'''
|
|
394
|
+
params: T_JSON_DICT = dict()
|
|
395
|
+
params['ignore'] = ignore
|
|
396
|
+
cmd_dict: T_JSON_DICT = {
|
|
397
|
+
'method': 'Security.setIgnoreCertificateErrors',
|
|
398
|
+
'params': params,
|
|
399
|
+
}
|
|
400
|
+
json = yield cmd_dict
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
@deprecated(version="1.3")
|
|
404
|
+
def handle_certificate_error(
|
|
405
|
+
event_id: int,
|
|
406
|
+
action: CertificateErrorAction
|
|
407
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
408
|
+
'''
|
|
409
|
+
Handles a certificate error that fired a certificateError event.
|
|
410
|
+
|
|
411
|
+
.. deprecated:: 1.3
|
|
412
|
+
|
|
413
|
+
:param event_id: The ID of the event.
|
|
414
|
+
:param action: The action to take on the certificate error.
|
|
415
|
+
'''
|
|
416
|
+
params: T_JSON_DICT = dict()
|
|
417
|
+
params['eventId'] = event_id
|
|
418
|
+
params['action'] = action.to_json()
|
|
419
|
+
cmd_dict: T_JSON_DICT = {
|
|
420
|
+
'method': 'Security.handleCertificateError',
|
|
421
|
+
'params': params,
|
|
422
|
+
}
|
|
423
|
+
json = yield cmd_dict
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
@deprecated(version="1.3")
|
|
427
|
+
def set_override_certificate_errors(
|
|
428
|
+
override: bool
|
|
429
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
430
|
+
'''
|
|
431
|
+
Enable/disable overriding certificate errors. If enabled, all certificate error events need to
|
|
432
|
+
be handled by the DevTools client and should be answered with ``handleCertificateError`` commands.
|
|
433
|
+
|
|
434
|
+
.. deprecated:: 1.3
|
|
435
|
+
|
|
436
|
+
:param override: If true, certificate errors will be overridden.
|
|
437
|
+
'''
|
|
438
|
+
params: T_JSON_DICT = dict()
|
|
439
|
+
params['override'] = override
|
|
440
|
+
cmd_dict: T_JSON_DICT = {
|
|
441
|
+
'method': 'Security.setOverrideCertificateErrors',
|
|
442
|
+
'params': params,
|
|
443
|
+
}
|
|
444
|
+
json = yield cmd_dict
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
@deprecated(version="1.3")
|
|
448
|
+
@event_class('Security.certificateError')
|
|
449
|
+
@dataclass
|
|
450
|
+
class CertificateError:
|
|
451
|
+
'''
|
|
452
|
+
There is a certificate error. If overriding certificate errors is enabled, then it should be
|
|
453
|
+
handled with the ``handleCertificateError`` command. Note: this event does not fire if the
|
|
454
|
+
certificate error has been allowed internally. Only one client per target should override
|
|
455
|
+
certificate errors at the same time.
|
|
456
|
+
'''
|
|
457
|
+
#: The ID of the event.
|
|
458
|
+
event_id: int
|
|
459
|
+
#: The type of the error.
|
|
460
|
+
error_type: str
|
|
461
|
+
#: The url that was requested.
|
|
462
|
+
request_url: str
|
|
463
|
+
|
|
464
|
+
@classmethod
|
|
465
|
+
def from_json(cls, json: T_JSON_DICT) -> CertificateError:
|
|
466
|
+
return cls(
|
|
467
|
+
event_id=int(json['eventId']),
|
|
468
|
+
error_type=str(json['errorType']),
|
|
469
|
+
request_url=str(json['requestURL'])
|
|
470
|
+
)
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
@event_class('Security.visibleSecurityStateChanged')
|
|
474
|
+
@dataclass
|
|
475
|
+
class VisibleSecurityStateChanged:
|
|
476
|
+
'''
|
|
477
|
+
**EXPERIMENTAL**
|
|
478
|
+
|
|
479
|
+
The security state of the page changed.
|
|
480
|
+
'''
|
|
481
|
+
#: Security state information about the page.
|
|
482
|
+
visible_security_state: VisibleSecurityState
|
|
483
|
+
|
|
484
|
+
@classmethod
|
|
485
|
+
def from_json(cls, json: T_JSON_DICT) -> VisibleSecurityStateChanged:
|
|
486
|
+
return cls(
|
|
487
|
+
visible_security_state=VisibleSecurityState.from_json(json['visibleSecurityState'])
|
|
488
|
+
)
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
@deprecated(version="1.3")
|
|
492
|
+
@event_class('Security.securityStateChanged')
|
|
493
|
+
@dataclass
|
|
494
|
+
class SecurityStateChanged:
|
|
495
|
+
'''
|
|
496
|
+
The security state of the page changed. No longer being sent.
|
|
497
|
+
'''
|
|
498
|
+
#: Security state.
|
|
499
|
+
security_state: SecurityState
|
|
500
|
+
#: True if the page was loaded over cryptographic transport such as HTTPS.
|
|
501
|
+
scheme_is_cryptographic: bool
|
|
502
|
+
#: Previously a list of explanations for the security state. Now always
|
|
503
|
+
#: empty.
|
|
504
|
+
explanations: typing.List[SecurityStateExplanation]
|
|
505
|
+
#: Information about insecure content on the page.
|
|
506
|
+
insecure_content_status: InsecureContentStatus
|
|
507
|
+
#: Overrides user-visible description of the state. Always omitted.
|
|
508
|
+
summary: typing.Optional[str]
|
|
509
|
+
|
|
510
|
+
@classmethod
|
|
511
|
+
def from_json(cls, json: T_JSON_DICT) -> SecurityStateChanged:
|
|
512
|
+
return cls(
|
|
513
|
+
security_state=SecurityState.from_json(json['securityState']),
|
|
514
|
+
scheme_is_cryptographic=bool(json['schemeIsCryptographic']),
|
|
515
|
+
explanations=[SecurityStateExplanation.from_json(i) for i in json['explanations']],
|
|
516
|
+
insecure_content_status=InsecureContentStatus.from_json(json['insecureContentStatus']),
|
|
517
|
+
summary=str(json['summary']) if json.get('summary', None) is not None else None
|
|
518
|
+
)
|