Allow multiple CERTHASH values in a module

Also fix typos and usage of reserved hash() function.
This commit is contained in:
Laurent Bachelier 2012-11-10 18:18:28 +01:00
commit 3eba9a809b
2 changed files with 6 additions and 4 deletions

View file

@ -403,12 +403,14 @@ class StandardBrowser(mechanize.Browser):
except ControlNotFoundError:
return
def lowsslcheck(self, domain, hash):
def lowsslcheck(self, domain, hsh):
certs = ssl.get_server_certificate((domain, 443))
certhash = hashlib.sha256(certs).hexdigest()
if self.logger:
self.logger.debug('Found %s as certificat hash' % certhash)
if certhash != hash:
self.logger.debug('Found %s as certificate hash' % certhash)
if isinstance(hsh, basestring):
hsh = [hsh]
if certhash not in hsh:
raise ssl.SSLError()