Output a Cert expire report
Project description
ops-py-cert-report
Description
Requests SSL certificate info from a list of URLs and then creates report with status of the SSL certificates.
The report is available in the following format:
- Slack Markdown
- HTML (table)
- JSON
The report contains the following information for each checked SSL certificate:
- SSL cert name: The name of the ssl certificate
- Status:
OK,Warning,Error,Critical!!,Expired!!orUnknown - Message: Error message or message about days till expire or days since expired
- Expiration Date: The expiration date of the SSL certificate
Installation and Usage
pip install ops-py-cert-report
❯ python
Python 3.12.2 (main, Feb 6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from cert_report import certs
>>> from cert_report import report
>>> ssl_certs = ["example.com", "google.com"]
>>> c = certs.Certs(ssl_certs)
>>> c.parse_certs()
>>> crts = c.get_certs()
>>> s = report.Report(crts, 45, 14, skip_ok=False)
>>> s.gen_report()
>>> json_report = s.get_report_json()
>>> for x in json_report:
... print(x)
...
{'name': 'example.com', 'expire_date': 'Mar 1 23:59:59 2025 GMT', 'expire_age': -247, 'comment': 'Will expire in 247 days', 'status': 'OK', 'code': 0}
{'name': 'google.com', 'expire_date': 'Sep 5 15:27:13 2024 GMT', 'expire_age': -70, 'comment': 'Will expire in 70 days', 'status': 'OK', 'code': 0}
>>> html = s.get_html_report()[1]
>>> print(html)
<table bordercolor='black' border='2'>
<thead>
<tr style='background-color: Teal; color: White'>
<th>Status</th>
<th>SSL Cert</th>
<th>Message</th>
<th>Expiration date</th>
</tr>
</thead>
<tbody>
<tr>
<td style='background-color: Green; color: White; font-weight:bold'>OK</td>
<td>google.com</td>
<td>Will expire in 70 days</td>
<td>Sep 5 15:27:13 2024 GMT</td>
</tr>
<tr>
<td style='background-color: Green; color: White; font-weight:bold'>OK</td>
<td>example.com</td>
<td>Will expire in 247 days</td>
<td>Mar 1 23:59:59 2025 GMT</td>
</tr>
</tbody>
</table>
>>> slck = s.get_slack_report()
>>> print(slck)
*SSL certificates report*
:white_check_mark: *google.com* - Will expire in 70 days (Sep 5 15:27:13 2024 GMT).
:white_check_mark: *example.com* - Will expire in 247 days (Mar 1 23:59:59 2025 GMT).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ops_py_cert_report-5.0.3.tar.gz.
File metadata
- Download URL: ops_py_cert_report-5.0.3.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfb2b26a4e3e009cd5016bbafb05ee21015604aac13a902ee6447fcab18d7a3e
|
|
| MD5 |
95004258f2da4628ec61b89e27ca0c06
|
|
| BLAKE2b-256 |
c836c7caf03048bb6e91dd394ed9ea0b9553a43f6001da277cecd75696af9ff7
|
Provenance
The following attestation bundles were made for ops_py_cert_report-5.0.3.tar.gz:
Publisher:
build_pypi.yml on equinor/ops-py-cert-report
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ops_py_cert_report-5.0.3.tar.gz -
Subject digest:
cfb2b26a4e3e009cd5016bbafb05ee21015604aac13a902ee6447fcab18d7a3e - Sigstore transparency entry: 149495959
- Sigstore integration time:
-
Permalink:
equinor/ops-py-cert-report@b5282e3c8431d02cb9499f8a151dc453b167e5b3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/equinor
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_pypi.yml@b5282e3c8431d02cb9499f8a151dc453b167e5b3 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file ops_py_cert_report-5.0.3-py3-none-any.whl.
File metadata
- Download URL: ops_py_cert_report-5.0.3-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c636d3e0f1e0745dc492e874ef0b856a5c4aa2cfd00943e029732c4b2f46d0f3
|
|
| MD5 |
49f88cca238616201ba97ccfd7400786
|
|
| BLAKE2b-256 |
34f0547ec6e087420672602b9bf51cba8bf27b2d879c115ae715818003899d0f
|
Provenance
The following attestation bundles were made for ops_py_cert_report-5.0.3-py3-none-any.whl:
Publisher:
build_pypi.yml on equinor/ops-py-cert-report
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ops_py_cert_report-5.0.3-py3-none-any.whl -
Subject digest:
c636d3e0f1e0745dc492e874ef0b856a5c4aa2cfd00943e029732c4b2f46d0f3 - Sigstore transparency entry: 149495962
- Sigstore integration time:
-
Permalink:
equinor/ops-py-cert-report@b5282e3c8431d02cb9499f8a151dc453b167e5b3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/equinor
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_pypi.yml@b5282e3c8431d02cb9499f8a151dc453b167e5b3 -
Trigger Event:
pull_request
-
Statement type: