Skip to content

Commit

Permalink
One more thing for 7.5.1
Browse files Browse the repository at this point in the history
- Make the `expires` timestamp more readable
  • Loading branch information
seanthegeek committed Oct 29, 2024
1 parent f3b9851 commit fba6d47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changelog

- Properly parse a certificate SAN
- Certificate warnings fire properly
- Make the `expires` timestamp more readable

5.7.0
-----
Expand Down
7 changes: 5 additions & 2 deletions checkdmarc/bimi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from __future__ import annotations

import logging
from datetime import datetime
from typing import Union
import re
from collections import OrderedDict
Expand Down Expand Up @@ -278,8 +279,10 @@ def decode_components(components: dict):
vmc = loaded_certs[0]
metadata["issuer"] = decode_components(vmc.get_issuer().get_components())
metadata["subject"] = decode_components(vmc.get_subject().get_components())
metadata["serial_number"] = vmc.get_serial_number()
metadata["expires"] = str(vmc.get_notAfter())
metadata["serial_number"] = vmc.get_serial_number().__str__()
metadata["expires"] = vmc.get_notAfter().decode("utf-8", errors="ignore")
metadata["expires"] = datetime.strptime(metadata["expires"], "%Y%m%d%H%M%SZ")
metadata["expires"] = metadata["expires"].strftime("%Y-%m-%d %H:%M:%SZ")
metadata["valid"] = valid and not vmc.has_expired()
san = _get_certificate_san(vmc)
metadata["domains"] = san
Expand Down

0 comments on commit fba6d47

Please sign in to comment.