CheckSSLCert is a Python library that allows you to check the SSL certificate status for single or multiple domains. It provides an easy way to determine if an SSL certificate is active, the number of days left until it expires, and additional certificate information.
You can install CheckSSLCert using pip:
pip install CheckSSLCert
To check the SSL certificate status for a single domain, you can use the from_link
function from validate
class.
Here's a sample code demonstrating the usage:
from CheckSSLCert import validate
# Create an from_link object for the domain
checker = validate.from_link("example.com")
# Check the SSL certificate status
status = checker.IsActive()
days_left = checker.getDayLeft()
info = checker.getInfo()
# Print the results
print("SSL Status:", status)
print("Days Left:", days_left)
print("Certificate Info:", info)
# Print the SSL certificate Report
print(checker)
To check the SSL certificate status for multiple domains, you can use the from_file
function from validate
class.
Here's a sample code demonstrating the usage:
from CheckSSLCert import validate
# Create a from_file object with the path to the domain list file (CSV format)
checker = validate.from_file("domain_list.csv")
# Print the SSL certificate status report to the console (Full Report)
checker.print_report()
# Print the SSL certificate status report to the console (Partial Report)
checker.print_report(IsAll=False)
Note:
- If you want to print the complete report, set
IsAll
toTrue
. By default, the full report is printed. - If you want to print the report only for the domains with expired or expiring in 14 days, set
IsAll
toFalse
.
Here's a sample code demonstrating the usage:
from CheckSSLCert import validate
# Create a from_file object with the path to the domain list file (CSV format)
checker = validate.from_file("domain_list.csv")
# Configure the Mail Server
mail_config = {'sender': "example@gmail.com",
'password': "passward",
'receiver': ["example2@gmail.com", "example3@gmail.com"],
'subject': "SSL Checker Report",
'smtp_server': "smtp.gmail.com",
'port': 587}
# Send the SSL certificate status report to an email address (Full Report)
checker.send_report(mail_config, IsAll=True)
# Send the SSL certificate status report to an email address (Partial Report)
checker.send_report(mail_config, IsAll=False)
Note:
- If you want to you a different mail server, set
smtp_server
to the SMTP server address inmail_config
. - If you want to use TLS, set
port
to587
inmail_config
. - If you want to use SSL, set
port
to465
inmail_config
. - If you want to send the complete report, set
IsAll
toTrue
. By default, the full report is sent. - If you want to send the report only for the domains with expired or expiring in 14 days, set
IsAll
toFalse
.
Here's a sample code demonstrating the usage:
from CheckSSLCert import validate
# Create a from_file object with the path to the domain list file (CSV format)
checker = validate.from_file("domain_list.csv")
# Save the SSL certificate status report to a file (HTML format)
# By default, the report is saved in HTML format
checker.save_report("C:\Users\YourUsername\Desktop")
# Save the SSL certificate status report to a file (CSV format)
checker.save_report("C:\Users\YourUsername\Desktop", file_type="csv")
Note:
- If you want to save the complete report, set
IsAll
toTrue
. By default, the full report is saved. - If you want to save the report only for the domains with expired or expiring in 14 days, set
IsAll
toFalse
. - By default, the report is saved in HTML format. If you want to save the report in CSV format, set
file_type
tocsv
.
The domain list file should be in CSV format. The first row should contain the column names. Here's a sample domain list file:
Click the Download button and Save it as domain_list.csv
.
S.No | Website_Name | Website_URL |
---|---|---|
1 | https://google.com | |
2 | Facebook - Mobile | https://m.facebook.com |
3 | www.twitter.com |
Contributions are welcome! If you have any suggestions, improvements, or bug fixes, please submit a pull request.
Released under MIT by @Huntroid-India.