Untitled
unknown
plain_text
5 months ago
1.2 kB
2
Indexable
import socket import ssl def check_3des_support(server, port): # Define the 3DES cipher suite cipher = 'DES-CBC3-SHA' # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(3) # Set a timeout for the connection try: # Wrap the socket with SSL context specifying the 3DES cipher context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) context.set_ciphers(cipher) # Attempt to establish the connection ssl_sock = context.wrap_socket(sock, server_hostname=server) ssl_sock.connect((server, port)) # If the connection is successful, print a message and close the socket print(f"Server {server} supports 3DES cipher: {cipher}") ssl_sock.close() except ssl.SSLError as e: print(f"Server {server} does NOT support 3DES cipher: {cipher}") print(f"SSL Error: {e}") except socket.error as e: print(f"Connection error: {e}") finally: sock.close() if __name__ == "__main__": # Example usage server = "example.com" # Replace with your server port = 443 # HTTPS port check_3des_support(server, port)
Editor is loading...
Leave a Comment