Časté otázky k informacím na Nezabezpečeno.cz.
Základní informace k problematice Chrome 70 a vyřazení důvěryhodnosti Symantec certifikátů.
The SSL certificate used to load resources from https://www.domenaxyz.cz will be distrusted very soon. Once distrusted, users will be prevented from loading these resources. See https://g.co/chrome/symantecpkicerts for more information.
import ssl import socket from datetime import datetime # import requests from urllib.request import Request, urlopen from urllib.error import URLError, HTTPError socket.setdefaulttimeout(5) count = 0 overall = 0 firstrow = "No;TestDN;CN;BrandCA;CA;Exp;SAN" file_in = "" domains = [] try: if not file_in: file_in = input("Zadej název souboru s TLD (.txt): ") file_in += ".txt" # read data to list file = open(file_in, "r") for line in file: domains.append(line) # file_out = input("Zadej soubor pro export: ") file_out = file_in + ".csv" text = "" except Exception as ex: print(ex) def check(hostname): global text req = Request("https://" + hostname) try: response = urlopen(req) except Exception as ex: text = "0;" + hostname + ";" + str(ex) + ";" return False else: return True def formatdate(date): date = datetime.strptime(date, '%b %d %H:%M:%S %Y %Z') return str(date) try: firstrow += "\n" file_write = open(file_out, "a") file_write.write(firstrow) file_write.close() except Exception as ex: print(ex) for line in domains: try: overall += 1 hostname = line.replace("\n", "") if check(hostname): count += 1 ctx = ssl.create_default_context() s = ctx.wrap_socket(socket.socket(), server_hostname=hostname) s.connect((hostname, 443)) certificate = s.getpeercert() # parsing dictionary certificate cert_cn = dict(x[0] for x in certificate['subject']) cert_ca = dict(x[0] for x in certificate['issuer']) cert_san = certificate['subjectAltName'] sans = '' for val in cert_san: sans += val[1] + ', ' # get certificate data cert = [overall] cert.append(hostname) cert.append(cert_cn['commonName']) # issued_to cert.append(cert_ca['commonName']) # issued_by cert.append(cert_ca['organizationName']) # issued_ca cert.append(formatdate(certificate['notAfter'])) cert.append(sans[:-2]) # odříznutí ',_' text = ';'.join(map(str, cert)) print(text) text += "\n" file_write = open(file_out, "a") file_write.write(text) file_write.close() except Exception as e: print(e) file.close() # {'subject': ((('commonName', 'sslmentor.cz'),),), # 'issuer': ((('countryName', 'US'),), (('organizationName', "Let's Encrypt"),), (('commonName', "Let's Encrypt Authority X3"),)), # 'version': 3, # 'serialNumber': '03EBC0289D7358BD551DE4DFFB9611E193CD', # 'notBefore': 'Jul 29 11:58:52 2018 GMT', # 'notAfter': 'Oct 27 11:58:52 2018 GMT', # 'subjectAltName': (('DNS', 'admin.sslmentor.cz'), ('DNS', 'blog.sslmentor.cz'), ('DNS', 'dev.sslmentor.cz'), ('DNS', # 'sslmentor.com'), ('DNS', 'sslmentor.cz'), ('DNS', 'sslmentor.eu'), ('DNS', 'sslmentor.sk'), ('DNS', 'www.sslmentor.com'), ('DNS', # 'www.sslmentor.cz'), ('DNS', 'www.sslmentor.eu'), ('DNS', 'www.sslmentor.sk')), # 'OCSP': ('http://ocsp.int-x3.letsencrypt.org',), # 'caIssuers': ('http://cert.int-x3.letsencrypt.org/',)}