Changeset - 0cd17f37bb89
[Not reviewed]
0 1 0
x - 11 months ago 2024-05-09 17:01:54
xbr@c3l.lu
fix: only import MailVerificator into main file
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
backend/check_domains.py
Show inline comments
 
#!/usr/bin/env python3
 
import json
 
import ssl
 
import socket
 
import os
 
from rich.console import Console
 
from cryptography import x509
 

	
 
import web
 
from mail import *
 
from mail import MailVerificator
 
import tls_utils
 

	
 
if __name__ == "__main__":
 
    console = Console()
 

	
 
    # Parse the input file
 
    path = os.path.split(__file__)[0] + "/"
 
    with open(path + 'input.json') as raw_data:
 
        input = json.load(raw_data)
 

	
 
    context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH)
 

	
 
    console.log("[white]Checking web domains...")
 

	
 
    for web_domain in input["domains"]["web"]:
 
        # Initiate TLS connection
 
        with context.wrap_socket(socket.socket(), server_hostname=web_domain) as s:
 
            try:
 
                s.connect((web_domain, 443))
 
                cert = s.getpeercert()
 
            except ssl.SSLCertVerificationError as e:
 
                saved = e
 
                if e.verify_code == 10:
 
                    expiry = web.web_noconn_expiry_days(web_domain)[1]
0 comments (0 inline, 0 general)