AnonSec Team
AnonSec Team
Server IP : 149.13.87.7  /  Your IP : 185.174.145.2
Web Server : nginx
System : Linux h2 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64
User : root ( 0)
PHP Version : 8.0.28
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /var/www/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //var/www/check_ssl.py
#!/usr/bin/env python3

import sys
import ssl
import socket

TIMEOUT = 5


def load_domains(filename: str):
    with open(filename, "r", encoding="utf-8") as f:
        return [line.strip() for line in f if line.strip()]


def has_ssl(domain: str) -> bool:
    context = ssl.create_default_context()

    try:
        with socket.create_connection((domain, 443), timeout=TIMEOUT) as sock:
            with context.wrap_socket(sock, server_hostname=domain):
                return True
    except Exception:
        return False


def main():
    if len(sys.argv) != 2:
        print(f"Usage: {sys.argv[0]} domains.txt")
        sys.exit(1)

    domains = load_domains(sys.argv[1])

    has_ssl_list = []
    no_ssl_list = []

    for domain in domains:
        if has_ssl(domain):
            has_ssl_list.append(domain)
        else:
            no_ssl_list.append(domain)

    print("=== HAS SSL ===")
    for domain in has_ssl_list:
        print(domain)

    print("\n=== NO SSL ===")
    for domain in no_ssl_list:
        print(domain)


if __name__ == "__main__":
    main()

AnonSec - 2021