1#!/usr/bin/env python 2 3## This file is part of Scapy 4## This program is published under a GPLv2 license 5 6""" 7Basic TLS client. A ciphersuite may be commanded via a first argument. 8Default protocol version is TLS 1.2. 9 10For instance, "sudo ./client_simple.py c014" will try to connect to any TLS 11server at 127.0.0.1:4433, with suite TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA. 12""" 13 14import os 15import sys 16 17basedir = os.path.abspath(os.path.join(os.path.dirname(__file__),"../../")) 18sys.path=[basedir]+sys.path 19 20from scapy.layers.tls.automaton_cli import TLSClientAutomaton 21from scapy.layers.tls.handshake import TLSClientHello 22 23 24if len(sys.argv) == 2: 25 ch = TLSClientHello(ciphers=int(sys.argv[1], 16)) 26else: 27 ch = None 28 29t = TLSClientAutomaton(client_hello=ch, 30 version="tls13-d18", 31 mycert=basedir+"/test/tls/pki/cli_cert.pem", 32 mykey=basedir+"/test/tls/pki/cli_key.pem") 33t.run() 34 35