CultriX commited on
Commit
0c34587
·
verified ·
1 Parent(s): cf4d362

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -32,9 +32,18 @@ def get_san_list(cert):
32
  return []
33
 
34
  def extract_certificate_details(cert):
 
 
 
 
 
 
 
 
 
35
  now = datetime.now(timezone.utc)
36
- expiry_date = cert.not_valid_after
37
- not_before = cert.not_valid_before
38
  days_remaining = (expiry_date - now).days
39
  fingerprints = get_fingerprints(cert)
40
  san_list = get_san_list(cert)
@@ -49,6 +58,7 @@ def extract_certificate_details(cert):
49
  "san_list": san_list,
50
  }
51
 
 
52
  def establish_tls_connection(hostname, port, timeout):
53
  context = ssl.create_default_context()
54
  context.check_hostname = False
 
32
  return []
33
 
34
  def extract_certificate_details(cert):
35
+ """
36
+ Extract key details from the certificate, including issuer, subject, fingerprints, and validity.
37
+
38
+ Args:
39
+ cert (x509.Certificate): The certificate object.
40
+
41
+ Returns:
42
+ dict: Dictionary containing certificate details.
43
+ """
44
  now = datetime.now(timezone.utc)
45
+ expiry_date = cert.not_valid_after.replace(tzinfo=timezone.utc)
46
+ not_before = cert.not_valid_before.replace(tzinfo=timezone.utc)
47
  days_remaining = (expiry_date - now).days
48
  fingerprints = get_fingerprints(cert)
49
  san_list = get_san_list(cert)
 
58
  "san_list": san_list,
59
  }
60
 
61
+
62
  def establish_tls_connection(hostname, port, timeout):
63
  context = ssl.create_default_context()
64
  context.check_hostname = False