automagically check certificate fingerprint if CERTHASH class attribute is set
This commit is contained in:
parent
702b56d594
commit
56797a7d0c
1 changed files with 8 additions and 1 deletions
|
|
@ -441,6 +441,10 @@ class BaseBrowser(StandardBrowser):
|
||||||
PROTOCOL = 'http'
|
PROTOCOL = 'http'
|
||||||
PAGES = {}
|
PAGES = {}
|
||||||
|
|
||||||
|
# SHA-256 hash of server certificate. If set, it will automatically check it,
|
||||||
|
# and raise a SSLError exception if it doesn't match.
|
||||||
|
CERTHASH = None
|
||||||
|
|
||||||
# ------ Abstract methods --------------------------------------
|
# ------ Abstract methods --------------------------------------
|
||||||
|
|
||||||
def home(self):
|
def home(self):
|
||||||
|
|
@ -479,6 +483,9 @@ class BaseBrowser(StandardBrowser):
|
||||||
self.username = username
|
self.username = username
|
||||||
self.password = password
|
self.password = password
|
||||||
|
|
||||||
|
if self.CERTHASH is not None and self.DOMAIN is not None:
|
||||||
|
self.lowsslcheck(self.DOMAIN, self.CERTHASH)
|
||||||
|
|
||||||
if self.password and get_home:
|
if self.password and get_home:
|
||||||
try:
|
try:
|
||||||
self.home()
|
self.home()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue