forked from llimllib/chrome-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Security.py
55 lines (42 loc) · 2.56 KB
/
Security.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from enum import Enum
from typing import Any, List
from base import ChromeCommand
# An internal certificate ID value.
CertificateId = int
SecurityState = Enum("SecurityState", "unknown neutral insecure warning secure info")
SecurityState.__doc__ = "The security level of a page or resource."
class SecurityStateExplanation:
"""An explanation of an factor contributing to the security state."""
def __init__(self, securityState: "SecurityState", summary: str, description: str, hasCertificate: bool):
# Security state representing the severity of the factor being explained.
self.securityState = securityState
# Short phrase describing the type of factor.
self.summary = summary
# Full text explanation of the factor.
self.description = description
# True if the page has a certificate.
self.hasCertificate = hasCertificate
class InsecureContentStatus:
"""Information about insecure content on the page."""
def __init__(self, ranMixedContent: bool, displayedMixedContent: bool, ranContentWithCertErrors: bool, displayedContentWithCertErrors: bool, ranInsecureContentStyle: "SecurityState", displayedInsecureContentStyle: "SecurityState"):
# True if the page was loaded over HTTPS and ran mixed (HTTP) content such as scripts.
self.ranMixedContent = ranMixedContent
# True if the page was loaded over HTTPS and displayed mixed (HTTP) content such as images.
self.displayedMixedContent = displayedMixedContent
# True if the page was loaded over HTTPS without certificate errors, and ran content such as scripts that were loaded with certificate errors.
self.ranContentWithCertErrors = ranContentWithCertErrors
# True if the page was loaded over HTTPS without certificate errors, and displayed content such as images that were loaded with certificate errors.
self.displayedContentWithCertErrors = displayedContentWithCertErrors
# Security state representing a page that ran insecure content.
self.ranInsecureContentStyle = ranInsecureContentStyle
# Security state representing a page that displayed insecure content.
self.displayedInsecureContentStyle = displayedInsecureContentStyle
class enable(ChromeCommand):
"""Enables tracking security state changes."""
def __init__(self): pass
class disable(ChromeCommand):
"""Disables tracking security state changes."""
def __init__(self): pass
class showCertificateViewer(ChromeCommand):
"""Displays native dialog with the certificate details."""
def __init__(self): pass