scapy.layers.tls.automaton_srv

TLS server automaton. This makes for a primitive TLS stack. Obviously you need rights for network access.

We support versions SSLv2 to TLS 1.2, along with many features. There is no session resumption mechanism for now.

In order to run a server listening on tcp/4433: > from scapy.all import * > t = TLSServerAutomaton(mycert=’<cert.pem>’, mykey=’<key.pem>’) > t.run()

class scapy.layers.tls.automaton_srv.TLSServerAutomaton(*args, **kargs)

Bases: scapy.layers.tls.automaton._TLSAutomaton

A simple TLS test server automaton. Try to overload some states or conditions and see what happens on the other side.

Because of socket and automaton limitations, for now, the best way to interrupt the server is by sending him ‘stop_server’. Interruptions with Ctrl-Z should work, but this might leave a loose listening socket behind.

In case the server receives a TLSAlert (whatever its type), or a ‘goodbye’ message in a SSLv2 version, he will close the client session with a similar message, and start waiting for new client connections.

_’mycert’ and ‘mykey’ may be provided as filenames. They are needed for any server authenticated handshake. _’preferred_ciphersuite’ allows the automaton to choose a cipher suite when offered in the ClientHello. If absent, another one will be chosen. _’client_auth’ means the client has to provide a certificate. _’is_echo_server’ means that everything received will be sent back. _’max_client_idle_time’ is the maximum silence duration from the client. Once this limit has been reached, the client (if still here) is dropped, and we wait for a new connection.

ADDED_CERTIFICATE(*args, **kargs)
ADDED_CERTIFICATEREQUEST(*args, **kargs)
ADDED_CHANGECIPHERSPEC(*args, **kargs)
ADDED_SERVERDATA(*args, **kargs)
ADDED_SERVERFINISHED(*args, **kargs)
ADDED_SERVERHELLO(*args, **kargs)
ADDED_SERVERHELLODONE(*args, **kargs)
ADDED_SERVERKEYEXCHANGE(*args, **kargs)
BIND(*args, **kargs)
CLOSE_NOTIFY(*args, **kargs)
CLOSE_NOTIFY_FINAL(*args, **kargs)
FINAL(*args, **kargs)
HANDLED_ALERT_FROM_CHANGECIPHERSPEC(*args, **kargs)
HANDLED_ALERT_FROM_CLIENTCERTIFICATE(*args, **kargs)
HANDLED_ALERT_FROM_CLIENTKEYEXCHANGE(*args, **kargs)
HANDLED_CERTIFICATEVERIFY(*args, **kargs)
HANDLED_CHANGECIPHERSPEC(*args, **kargs)
HANDLED_CLIENTCERTIFICATE(*args, **kargs)
HANDLED_CLIENTDATA(*args, **kargs)
HANDLED_CLIENTFINISHED(*args, **kargs)
HANDLED_CLIENTHELLO(*args, **kargs)
HANDLED_CLIENTKEYEXCHANGE(*args, **kargs)
INITIAL(*args, **kargs)
INIT_TLS_SESSION(*args, **kargs)
MISSING_CERTIFICATEVERIFY(*args, **kargs)
MISSING_CHANGECIPHERSPEC(*args, **kargs)
MISSING_CLIENTCERTIFICATE(*args, **kargs)
MISSING_CLIENTFINISHED(*args, **kargs)
MISSING_CLIENTHELLO(*args, **kargs)
MISSING_CLIENTKEYEXCHANGE(*args, **kargs)
NO_USABLE_CIPHERSUITE(*args, **kargs)
PREPARE_SERVERFLIGHT1(*args, **kargs)
PREPARE_SERVERFLIGHT2(*args, **kargs)
RECEIVED_CLIENTDATA(*args, **kargs)
RECEIVED_CLIENTFLIGHT1(*args, **kargs)
RECEIVED_CLIENTFLIGHT2(*args, **kargs)
SENT_SERVERDATA(*args, **kargs)
SENT_SERVERFLIGHT2(*args, **kargs)
SSLv2_ADDED_REQUESTCERTIFICATE(*args, **kargs)
SSLv2_ADDED_SERVERDATA(*args, **kargs)
SSLv2_ADDED_SERVERFINISHED(*args, **kargs)
SSLv2_ADDED_SERVERHELLO(*args, **kargs)
SSLv2_ADDED_SERVERVERIFY(*args, **kargs)
SSLv2_CLOSE_NOTIFY(*args, **kargs)
SSLv2_CLOSE_NOTIFY_FINAL(*args, **kargs)
SSLv2_HANDLED_CLIENTCERTIFICATE(*args, **kargs)
SSLv2_HANDLED_CLIENTDATA(*args, **kargs)
SSLv2_HANDLED_CLIENTFINISHED(*args, **kargs)
SSLv2_HANDLED_CLIENTHELLO(*args, **kargs)
SSLv2_HANDLED_CLIENTMASTERKEY(*args, **kargs)
SSLv2_MISSING_CLIENTCERTIFICATE(*args, **kargs)
SSLv2_MISSING_CLIENTFINISHED(*args, **kargs)
SSLv2_MISSING_CLIENTMASTERKEY(*args, **kargs)
SSLv2_RECEIVED_CLIENTCERTIFICATE(*args, **kargs)
SSLv2_RECEIVED_CLIENTDATA(*args, **kargs)
SSLv2_RECEIVED_CLIENTFINISHED(*args, **kargs)
SSLv2_RECEIVED_CLIENTMASTERKEY(*args, **kargs)
SSLv2_SENT_REQUESTCERTIFICATE(*args, **kargs)
SSLv2_SENT_SERVERDATA(*args, **kargs)
SSLv2_SENT_SERVERFINISHED(*args, **kargs)
SSLv2_SENT_SERVERHELLO(*args, **kargs)
SSLv2_SENT_SERVERVERIFY(*args, **kargs)
SSLv2_WAITING_CLIENTCERTIFICATE(*args, **kargs)
SSLv2_WAITING_CLIENTDATA(*args, **kargs)
SSLv2_WAITING_CLIENTMASTERKEY(*args, **kargs)
TLS13_HANDLED_CLIENTFINISHED(*args, **kargs)
WAITING_CLIENT(*args, **kargs)
WAITING_CLIENTDATA(*args, **kargs)
WAITING_CLIENTFLIGHT1(*args, **kargs)
WAITING_CLIENTFLIGHT2(*args, **kargs)
actions = {'close_session': [], 'close_session_final': [], 'missing_ChangeCipherSpec': [], 'missing_ClientFinished': [], 'missing_ClientHello': [], 'missing_ClientKeyExchange': [], 'missing_ClientMasterKey': [], 'no_CertificateVerify': [], 'no_ClientCertificate': [], 'should_add_Certificate': [], 'should_add_CertificateRequest': [], 'should_add_ChangeCipherSpec': [], 'should_add_ServerFinished': [], 'should_add_ServerHello': [], 'should_add_ServerHelloDone': [], 'should_add_ServerKeyExchange': [], 'should_handle_Alert_from_ClientCertificate': [], 'should_handle_Alert_from_ClientFinished': [], 'should_handle_Alert_from_ClientKeyExchange': [], 'should_handle_CertificateVerify': [], 'should_handle_ChangeCipherSpec': [], 'should_handle_ClientCertificate': [], 'should_handle_ClientData': [], 'should_handle_ClientFinished': [], 'should_handle_ClientHello': [], 'should_handle_ClientKeyExchange': [], 'should_send_ServerData': [], 'should_send_ServerFlight1': [], 'should_send_ServerFlight2': [], 'sslv2_close_session': [], 'sslv2_close_session_final': [], 'sslv2_missing_ClientCertificate': [], 'sslv2_missing_ClientFinished': [], 'sslv2_should_add_RequestCertificate': [], 'sslv2_should_add_ServerFinished': [], 'sslv2_should_add_ServerHello': [], 'sslv2_should_add_ServerVerify_from_ClientFinished': [], 'sslv2_should_add_ServerVerify_from_NoClientFinished': [], 'sslv2_should_handle_ClientCertificate': [], 'sslv2_should_handle_ClientData': [], 'sslv2_should_handle_ClientFinished': [], 'sslv2_should_handle_ClientHello': [], 'sslv2_should_handle_ClientMasterKey': [], 'sslv2_should_send_RequestCertificate': [], 'sslv2_should_send_ServerData': [], 'sslv2_should_send_ServerFinished': [], 'sslv2_should_send_ServerHello': [], 'sslv2_should_send_ServerVerify': [], 'tls13_should_add_Certificate': [], 'tls13_should_add_CertificateRequest': [], 'tls13_should_add_CertificateVerifiy': [], 'tls13_should_add_EncryptedExtensions': [], 'tls13_should_add_Finished': [], 'tls13_should_add_ServerHello': [], 'tls13_should_handle_ClientFinished': [], 'tls13_should_handle_ClientHello': [], 'tls13_should_send_ServerFlight1': []}
close_session()
close_session_final()
conditions = {'ADDED_CERTIFICATE': [<function TLSServerAutomaton.should_add_ServerKeyExchange>], 'ADDED_CERTIFICATEREQUEST': [<function TLSServerAutomaton.should_add_ServerHelloDone>], 'ADDED_CHANGECIPHERSPEC': [<function TLSServerAutomaton.should_add_ServerFinished>], 'ADDED_SERVERDATA': [<function TLSServerAutomaton.should_send_ServerData>], 'ADDED_SERVERFINISHED': [<function TLSServerAutomaton.should_send_ServerFlight2>], 'ADDED_SERVERHELLO': [<function TLSServerAutomaton.should_add_Certificate>], 'ADDED_SERVERHELLODONE': [<function TLSServerAutomaton.should_send_ServerFlight1>], 'ADDED_SERVERKEYEXCHANGE': [<function TLSServerAutomaton.should_add_CertificateRequest>], 'BIND': [], 'CLOSE_NOTIFY': [<function TLSServerAutomaton.close_session>], 'CLOSE_NOTIFY_FINAL': [<function TLSServerAutomaton.close_session_final>], 'FINAL': [], 'HANDLED_ALERT_FROM_CHANGECIPHERSPEC': [], 'HANDLED_ALERT_FROM_CLIENTCERTIFICATE': [], 'HANDLED_ALERT_FROM_CLIENTKEYEXCHANGE': [], 'HANDLED_CERTIFICATEVERIFY': [<function TLSServerAutomaton.should_handle_ChangeCipherSpec>, <function TLSServerAutomaton.should_handle_Alert_from_ClientKeyExchange>, <function TLSServerAutomaton.missing_ChangeCipherSpec>], 'HANDLED_CHANGECIPHERSPEC': [<function TLSServerAutomaton.should_handle_ClientFinished>, <function TLSServerAutomaton.should_handle_Alert_from_ClientFinished>, <function TLSServerAutomaton.missing_ClientFinished>], 'HANDLED_CLIENTCERTIFICATE': [<function TLSServerAutomaton.should_handle_ClientKeyExchange>, <function TLSServerAutomaton.should_handle_Alert_from_ClientCertificate>, <function TLSServerAutomaton.missing_ClientKeyExchange>], 'HANDLED_CLIENTDATA': [], 'HANDLED_CLIENTFINISHED': [], 'HANDLED_CLIENTHELLO': [], 'HANDLED_CLIENTKEYEXCHANGE': [<function TLSServerAutomaton.should_handle_CertificateVerify>, <function TLSServerAutomaton.no_CertificateVerify>], 'INITIAL': [], 'INIT_TLS_SESSION': [], 'MISSING_CERTIFICATEVERIFY': [], 'MISSING_CHANGECIPHERSPEC': [], 'MISSING_CLIENTCERTIFICATE': [], 'MISSING_CLIENTFINISHED': [], 'MISSING_CLIENTHELLO': [], 'MISSING_CLIENTKEYEXCHANGE': [], 'NO_USABLE_CIPHERSUITE': [], 'PREPARE_SERVERFLIGHT1': [<function TLSServerAutomaton.should_add_ServerHello>], 'PREPARE_SERVERFLIGHT2': [<function TLSServerAutomaton.should_add_ChangeCipherSpec>], 'RECEIVED_CLIENTDATA': [<function TLSServerAutomaton.should_handle_ClientData>], 'RECEIVED_CLIENTFLIGHT1': [<function TLSServerAutomaton.tls13_should_handle_ClientHello>, <function TLSServerAutomaton.should_handle_ClientHello>, <function TLSServerAutomaton.sslv2_should_handle_ClientHello>, <function TLSServerAutomaton.missing_ClientHello>], 'RECEIVED_CLIENTFLIGHT2': [<function TLSServerAutomaton.should_handle_ClientCertificate>, <function TLSServerAutomaton.no_ClientCertificate>], 'SENT_SERVERDATA': [], 'SENT_SERVERFLIGHT2': [], 'SSLv2_ADDED_REQUESTCERTIFICATE': [<function TLSServerAutomaton.sslv2_should_send_RequestCertificate>], 'SSLv2_ADDED_SERVERDATA': [<function TLSServerAutomaton.sslv2_should_send_ServerData>], 'SSLv2_ADDED_SERVERFINISHED': [<function TLSServerAutomaton.sslv2_should_send_ServerFinished>], 'SSLv2_ADDED_SERVERHELLO': [<function TLSServerAutomaton.sslv2_should_send_ServerHello>], 'SSLv2_ADDED_SERVERVERIFY': [<function TLSServerAutomaton.sslv2_should_send_ServerVerify>], 'SSLv2_CLOSE_NOTIFY': [<function TLSServerAutomaton.sslv2_close_session>], 'SSLv2_CLOSE_NOTIFY_FINAL': [<function TLSServerAutomaton.sslv2_close_session_final>], 'SSLv2_HANDLED_CLIENTCERTIFICATE': [], 'SSLv2_HANDLED_CLIENTDATA': [], 'SSLv2_HANDLED_CLIENTFINISHED': [<function TLSServerAutomaton.sslv2_should_add_ServerVerify_from_ClientFinished>, <function TLSServerAutomaton.sslv2_should_add_RequestCertificate>, <function TLSServerAutomaton.sslv2_should_add_ServerFinished>], 'SSLv2_HANDLED_CLIENTHELLO': [<function TLSServerAutomaton.sslv2_should_add_ServerHello>], 'SSLv2_HANDLED_CLIENTMASTERKEY': [], 'SSLv2_MISSING_CLIENTCERTIFICATE': [], 'SSLv2_MISSING_CLIENTFINISHED': [], 'SSLv2_MISSING_CLIENTMASTERKEY': [], 'SSLv2_RECEIVED_CLIENTCERTIFICATE': [<function TLSServerAutomaton.sslv2_should_handle_ClientCertificate>, <function TLSServerAutomaton.sslv2_missing_ClientCertificate>], 'SSLv2_RECEIVED_CLIENTDATA': [<function TLSServerAutomaton.sslv2_should_handle_ClientData>], 'SSLv2_RECEIVED_CLIENTFINISHED': [<function TLSServerAutomaton.sslv2_should_handle_ClientFinished>, <function TLSServerAutomaton.sslv2_should_add_ServerVerify_from_NoClientFinished>, <function TLSServerAutomaton.sslv2_missing_ClientFinished>], 'SSLv2_RECEIVED_CLIENTMASTERKEY': [<function TLSServerAutomaton.sslv2_should_handle_ClientMasterKey>, <function TLSServerAutomaton.missing_ClientMasterKey>], 'SSLv2_SENT_REQUESTCERTIFICATE': [], 'SSLv2_SENT_SERVERDATA': [], 'SSLv2_SENT_SERVERFINISHED': [], 'SSLv2_SENT_SERVERHELLO': [], 'SSLv2_SENT_SERVERVERIFY': [], 'SSLv2_WAITING_CLIENTCERTIFICATE': [], 'SSLv2_WAITING_CLIENTDATA': [], 'SSLv2_WAITING_CLIENTMASTERKEY': [], 'TLS13_HANDLED_CLIENTFINISHED': [], 'WAITING_CLIENT': [], 'WAITING_CLIENTDATA': [], 'WAITING_CLIENTFLIGHT1': [], 'WAITING_CLIENTFLIGHT2': [], 'tls13_ADDED_CERTIFICATE': [<function TLSServerAutomaton.tls13_should_add_CertificateVerifiy>], 'tls13_ADDED_CERTIFICATEREQUEST': [<function TLSServerAutomaton.tls13_should_add_Certificate>], 'tls13_ADDED_CERTIFICATEVERIFY': [<function TLSServerAutomaton.tls13_should_add_Finished>], 'tls13_ADDED_ENCRYPTEDEXTENSIONS': [<function TLSServerAutomaton.tls13_should_add_CertificateRequest>], 'tls13_ADDED_SERVERFINISHED': [<function TLSServerAutomaton.tls13_should_send_ServerFlight1>], 'tls13_ADDED_SERVERHELLO': [<function TLSServerAutomaton.tls13_should_add_EncryptedExtensions>], 'tls13_HANDLED_CLIENTHELLO': [], 'tls13_PREPARE_SERVERFLIGHT1': [<function TLSServerAutomaton.tls13_should_add_ServerHello>], 'tls13_RECEIVED_CLIENTFLIGHT2': [<function TLSServerAutomaton.tls13_should_handle_ClientFinished>], 'tls13_WAITING_CLIENTFLIGHT2': []}
http_sessioninfo()
initial_states = [<function ATMT.state.<locals>.deco.<locals>.state_wrapper>]
ioevents = {'ADDED_CERTIFICATE': [], 'ADDED_CERTIFICATEREQUEST': [], 'ADDED_CHANGECIPHERSPEC': [], 'ADDED_SERVERDATA': [], 'ADDED_SERVERFINISHED': [], 'ADDED_SERVERHELLO': [], 'ADDED_SERVERHELLODONE': [], 'ADDED_SERVERKEYEXCHANGE': [], 'BIND': [], 'CLOSE_NOTIFY': [], 'CLOSE_NOTIFY_FINAL': [], 'FINAL': [], 'HANDLED_ALERT_FROM_CHANGECIPHERSPEC': [], 'HANDLED_ALERT_FROM_CLIENTCERTIFICATE': [], 'HANDLED_ALERT_FROM_CLIENTKEYEXCHANGE': [], 'HANDLED_CERTIFICATEVERIFY': [], 'HANDLED_CHANGECIPHERSPEC': [], 'HANDLED_CLIENTCERTIFICATE': [], 'HANDLED_CLIENTDATA': [], 'HANDLED_CLIENTFINISHED': [], 'HANDLED_CLIENTHELLO': [], 'HANDLED_CLIENTKEYEXCHANGE': [], 'INITIAL': [], 'INIT_TLS_SESSION': [], 'MISSING_CERTIFICATEVERIFY': [], 'MISSING_CHANGECIPHERSPEC': [], 'MISSING_CLIENTCERTIFICATE': [], 'MISSING_CLIENTFINISHED': [], 'MISSING_CLIENTHELLO': [], 'MISSING_CLIENTKEYEXCHANGE': [], 'NO_USABLE_CIPHERSUITE': [], 'PREPARE_SERVERFLIGHT1': [], 'PREPARE_SERVERFLIGHT2': [], 'RECEIVED_CLIENTDATA': [], 'RECEIVED_CLIENTFLIGHT1': [], 'RECEIVED_CLIENTFLIGHT2': [], 'SENT_SERVERDATA': [], 'SENT_SERVERFLIGHT2': [], 'SSLv2_ADDED_REQUESTCERTIFICATE': [], 'SSLv2_ADDED_SERVERDATA': [], 'SSLv2_ADDED_SERVERFINISHED': [], 'SSLv2_ADDED_SERVERHELLO': [], 'SSLv2_ADDED_SERVERVERIFY': [], 'SSLv2_CLOSE_NOTIFY': [], 'SSLv2_CLOSE_NOTIFY_FINAL': [], 'SSLv2_HANDLED_CLIENTCERTIFICATE': [], 'SSLv2_HANDLED_CLIENTDATA': [], 'SSLv2_HANDLED_CLIENTFINISHED': [], 'SSLv2_HANDLED_CLIENTHELLO': [], 'SSLv2_HANDLED_CLIENTMASTERKEY': [], 'SSLv2_MISSING_CLIENTCERTIFICATE': [], 'SSLv2_MISSING_CLIENTFINISHED': [], 'SSLv2_MISSING_CLIENTMASTERKEY': [], 'SSLv2_RECEIVED_CLIENTCERTIFICATE': [], 'SSLv2_RECEIVED_CLIENTDATA': [], 'SSLv2_RECEIVED_CLIENTFINISHED': [], 'SSLv2_RECEIVED_CLIENTMASTERKEY': [], 'SSLv2_SENT_REQUESTCERTIFICATE': [], 'SSLv2_SENT_SERVERDATA': [], 'SSLv2_SENT_SERVERFINISHED': [], 'SSLv2_SENT_SERVERHELLO': [], 'SSLv2_SENT_SERVERVERIFY': [], 'SSLv2_WAITING_CLIENTCERTIFICATE': [], 'SSLv2_WAITING_CLIENTDATA': [], 'SSLv2_WAITING_CLIENTMASTERKEY': [], 'TLS13_HANDLED_CLIENTFINISHED': [], 'WAITING_CLIENT': [], 'WAITING_CLIENTDATA': [], 'WAITING_CLIENTFLIGHT1': [], 'WAITING_CLIENTFLIGHT2': [], 'tls13_ADDED_CERTIFICATE': [], 'tls13_ADDED_CERTIFICATEREQUEST': [], 'tls13_ADDED_CERTIFICATEVERIFY': [], 'tls13_ADDED_ENCRYPTEDEXTENSIONS': [], 'tls13_ADDED_SERVERFINISHED': [], 'tls13_ADDED_SERVERHELLO': [], 'tls13_HANDLED_CLIENTHELLO': [], 'tls13_PREPARE_SERVERFLIGHT1': [], 'tls13_RECEIVED_CLIENTFLIGHT2': [], 'tls13_WAITING_CLIENTFLIGHT2': []}
ionames = []
iosupersockets = []
missing_ChangeCipherSpec()
missing_ClientFinished()
missing_ClientHello()
missing_ClientKeyExchange()
missing_ClientMasterKey()
no_CertificateVerify()
no_ClientCertificate()
parse_args(server='127.0.0.1', sport=4433, mycert=None, mykey=None, preferred_ciphersuite=None, client_auth=False, is_echo_server=True, max_client_idle_time=60, **kargs)
recv_conditions = {'ADDED_CERTIFICATE': [], 'ADDED_CERTIFICATEREQUEST': [], 'ADDED_CHANGECIPHERSPEC': [], 'ADDED_SERVERDATA': [], 'ADDED_SERVERFINISHED': [], 'ADDED_SERVERHELLO': [], 'ADDED_SERVERHELLODONE': [], 'ADDED_SERVERKEYEXCHANGE': [], 'BIND': [], 'CLOSE_NOTIFY': [], 'CLOSE_NOTIFY_FINAL': [], 'FINAL': [], 'HANDLED_ALERT_FROM_CHANGECIPHERSPEC': [], 'HANDLED_ALERT_FROM_CLIENTCERTIFICATE': [], 'HANDLED_ALERT_FROM_CLIENTKEYEXCHANGE': [], 'HANDLED_CERTIFICATEVERIFY': [], 'HANDLED_CHANGECIPHERSPEC': [], 'HANDLED_CLIENTCERTIFICATE': [], 'HANDLED_CLIENTDATA': [], 'HANDLED_CLIENTFINISHED': [], 'HANDLED_CLIENTHELLO': [], 'HANDLED_CLIENTKEYEXCHANGE': [], 'INITIAL': [], 'INIT_TLS_SESSION': [], 'MISSING_CERTIFICATEVERIFY': [], 'MISSING_CHANGECIPHERSPEC': [], 'MISSING_CLIENTCERTIFICATE': [], 'MISSING_CLIENTFINISHED': [], 'MISSING_CLIENTHELLO': [], 'MISSING_CLIENTKEYEXCHANGE': [], 'NO_USABLE_CIPHERSUITE': [], 'PREPARE_SERVERFLIGHT1': [], 'PREPARE_SERVERFLIGHT2': [], 'RECEIVED_CLIENTDATA': [], 'RECEIVED_CLIENTFLIGHT1': [], 'RECEIVED_CLIENTFLIGHT2': [], 'SENT_SERVERDATA': [], 'SENT_SERVERFLIGHT2': [], 'SSLv2_ADDED_REQUESTCERTIFICATE': [], 'SSLv2_ADDED_SERVERDATA': [], 'SSLv2_ADDED_SERVERFINISHED': [], 'SSLv2_ADDED_SERVERHELLO': [], 'SSLv2_ADDED_SERVERVERIFY': [], 'SSLv2_CLOSE_NOTIFY': [], 'SSLv2_CLOSE_NOTIFY_FINAL': [], 'SSLv2_HANDLED_CLIENTCERTIFICATE': [], 'SSLv2_HANDLED_CLIENTDATA': [], 'SSLv2_HANDLED_CLIENTFINISHED': [], 'SSLv2_HANDLED_CLIENTHELLO': [], 'SSLv2_HANDLED_CLIENTMASTERKEY': [], 'SSLv2_MISSING_CLIENTCERTIFICATE': [], 'SSLv2_MISSING_CLIENTFINISHED': [], 'SSLv2_MISSING_CLIENTMASTERKEY': [], 'SSLv2_RECEIVED_CLIENTCERTIFICATE': [], 'SSLv2_RECEIVED_CLIENTDATA': [], 'SSLv2_RECEIVED_CLIENTFINISHED': [], 'SSLv2_RECEIVED_CLIENTMASTERKEY': [], 'SSLv2_SENT_REQUESTCERTIFICATE': [], 'SSLv2_SENT_SERVERDATA': [], 'SSLv2_SENT_SERVERFINISHED': [], 'SSLv2_SENT_SERVERHELLO': [], 'SSLv2_SENT_SERVERVERIFY': [], 'SSLv2_WAITING_CLIENTCERTIFICATE': [], 'SSLv2_WAITING_CLIENTDATA': [], 'SSLv2_WAITING_CLIENTMASTERKEY': [], 'TLS13_HANDLED_CLIENTFINISHED': [], 'WAITING_CLIENT': [], 'WAITING_CLIENTDATA': [], 'WAITING_CLIENTFLIGHT1': [], 'WAITING_CLIENTFLIGHT2': [], 'tls13_ADDED_CERTIFICATE': [], 'tls13_ADDED_CERTIFICATEREQUEST': [], 'tls13_ADDED_CERTIFICATEVERIFY': [], 'tls13_ADDED_ENCRYPTEDEXTENSIONS': [], 'tls13_ADDED_SERVERFINISHED': [], 'tls13_ADDED_SERVERHELLO': [], 'tls13_HANDLED_CLIENTHELLO': [], 'tls13_PREPARE_SERVERFLIGHT1': [], 'tls13_RECEIVED_CLIENTFLIGHT2': [], 'tls13_WAITING_CLIENTFLIGHT2': []}
should_add_Certificate()
should_add_CertificateRequest()
should_add_ChangeCipherSpec()
should_add_ServerFinished()
should_add_ServerHello()

Selecting a cipher suite should be no trouble as we already caught the None case previously.

Also, we do not manage extensions at all.

should_add_ServerHelloDone()
should_add_ServerKeyExchange()
should_handle_Alert_from_ClientCertificate()
should_handle_Alert_from_ClientFinished()
should_handle_Alert_from_ClientKeyExchange()
should_handle_CertificateVerify()
should_handle_ChangeCipherSpec()
should_handle_ClientCertificate()
should_handle_ClientData()
should_handle_ClientFinished()
should_handle_ClientHello()
should_handle_ClientKeyExchange()
should_send_ServerData()
should_send_ServerFlight1()
should_send_ServerFlight2()
sslv2_close_session()
sslv2_close_session_final()
sslv2_missing_ClientCertificate()
sslv2_missing_ClientFinished()
sslv2_should_add_RequestCertificate()
sslv2_should_add_ServerFinished()
sslv2_should_add_ServerHello()
sslv2_should_add_ServerVerify_from_ClientFinished()
sslv2_should_add_ServerVerify_from_NoClientFinished()
sslv2_should_handle_ClientCertificate()
sslv2_should_handle_ClientData()
sslv2_should_handle_ClientFinished()
sslv2_should_handle_ClientHello()
sslv2_should_handle_ClientMasterKey()
sslv2_should_send_RequestCertificate()
sslv2_should_send_ServerData()
sslv2_should_send_ServerFinished()
sslv2_should_send_ServerHello()
sslv2_should_send_ServerVerify()
state = None
states = {'ADDED_CERTIFICATE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'ADDED_CERTIFICATEREQUEST': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'ADDED_CHANGECIPHERSPEC': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'ADDED_SERVERDATA': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'ADDED_SERVERFINISHED': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'ADDED_SERVERHELLO': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'ADDED_SERVERHELLODONE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'ADDED_SERVERKEYEXCHANGE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'BIND': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'CLOSE_NOTIFY': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'CLOSE_NOTIFY_FINAL': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'FINAL': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'HANDLED_ALERT_FROM_CHANGECIPHERSPEC': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'HANDLED_ALERT_FROM_CLIENTCERTIFICATE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'HANDLED_ALERT_FROM_CLIENTKEYEXCHANGE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'HANDLED_CERTIFICATEVERIFY': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'HANDLED_CHANGECIPHERSPEC': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'HANDLED_CLIENTCERTIFICATE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'HANDLED_CLIENTDATA': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'HANDLED_CLIENTFINISHED': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'HANDLED_CLIENTHELLO': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'HANDLED_CLIENTKEYEXCHANGE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'INITIAL': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'INIT_TLS_SESSION': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'MISSING_CERTIFICATEVERIFY': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'MISSING_CHANGECIPHERSPEC': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'MISSING_CLIENTCERTIFICATE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'MISSING_CLIENTFINISHED': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'MISSING_CLIENTHELLO': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'MISSING_CLIENTKEYEXCHANGE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'NO_USABLE_CIPHERSUITE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'PREPARE_SERVERFLIGHT1': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'PREPARE_SERVERFLIGHT2': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'RECEIVED_CLIENTDATA': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'RECEIVED_CLIENTFLIGHT1': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'RECEIVED_CLIENTFLIGHT2': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SENT_SERVERDATA': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SENT_SERVERFLIGHT2': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_ADDED_REQUESTCERTIFICATE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_ADDED_SERVERDATA': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_ADDED_SERVERFINISHED': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_ADDED_SERVERHELLO': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_ADDED_SERVERVERIFY': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_CLOSE_NOTIFY': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_CLOSE_NOTIFY_FINAL': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_HANDLED_CLIENTCERTIFICATE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_HANDLED_CLIENTDATA': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_HANDLED_CLIENTFINISHED': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_HANDLED_CLIENTHELLO': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_HANDLED_CLIENTMASTERKEY': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_MISSING_CLIENTCERTIFICATE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_MISSING_CLIENTFINISHED': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_MISSING_CLIENTMASTERKEY': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_RECEIVED_CLIENTCERTIFICATE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_RECEIVED_CLIENTDATA': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_RECEIVED_CLIENTFINISHED': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_RECEIVED_CLIENTMASTERKEY': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_SENT_REQUESTCERTIFICATE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_SENT_SERVERDATA': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_SENT_SERVERFINISHED': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_SENT_SERVERHELLO': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_SENT_SERVERVERIFY': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_WAITING_CLIENTCERTIFICATE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_WAITING_CLIENTDATA': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'SSLv2_WAITING_CLIENTMASTERKEY': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'TLS13_HANDLED_CLIENTFINISHED': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'WAITING_CLIENT': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'WAITING_CLIENTDATA': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'WAITING_CLIENTFLIGHT1': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'WAITING_CLIENTFLIGHT2': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'tls13_ADDED_CERTIFICATE': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'tls13_ADDED_CERTIFICATEREQUEST': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'tls13_ADDED_CERTIFICATEVERIFY': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'tls13_ADDED_ENCRYPTEDEXTENSIONS': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'tls13_ADDED_SERVERFINISHED': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'tls13_ADDED_SERVERHELLO': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'tls13_HANDLED_CLIENTHELLO': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'tls13_PREPARE_SERVERFLIGHT1': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'tls13_RECEIVED_CLIENTFLIGHT2': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>, 'tls13_WAITING_CLIENTFLIGHT2': <function ATMT.state.<locals>.deco.<locals>.state_wrapper>}
timeout = {'ADDED_CERTIFICATE': [(None, None)], 'ADDED_CERTIFICATEREQUEST': [(None, None)], 'ADDED_CHANGECIPHERSPEC': [(None, None)], 'ADDED_SERVERDATA': [(None, None)], 'ADDED_SERVERFINISHED': [(None, None)], 'ADDED_SERVERHELLO': [(None, None)], 'ADDED_SERVERHELLODONE': [(None, None)], 'ADDED_SERVERKEYEXCHANGE': [(None, None)], 'BIND': [(None, None)], 'CLOSE_NOTIFY': [(None, None)], 'CLOSE_NOTIFY_FINAL': [(None, None)], 'FINAL': [(None, None)], 'HANDLED_ALERT_FROM_CHANGECIPHERSPEC': [(None, None)], 'HANDLED_ALERT_FROM_CLIENTCERTIFICATE': [(None, None)], 'HANDLED_ALERT_FROM_CLIENTKEYEXCHANGE': [(None, None)], 'HANDLED_CERTIFICATEVERIFY': [(None, None)], 'HANDLED_CHANGECIPHERSPEC': [(None, None)], 'HANDLED_CLIENTCERTIFICATE': [(None, None)], 'HANDLED_CLIENTDATA': [(None, None)], 'HANDLED_CLIENTFINISHED': [(None, None)], 'HANDLED_CLIENTHELLO': [(None, None)], 'HANDLED_CLIENTKEYEXCHANGE': [(None, None)], 'INITIAL': [(None, None)], 'INIT_TLS_SESSION': [(None, None)], 'MISSING_CERTIFICATEVERIFY': [(None, None)], 'MISSING_CHANGECIPHERSPEC': [(None, None)], 'MISSING_CLIENTCERTIFICATE': [(None, None)], 'MISSING_CLIENTFINISHED': [(None, None)], 'MISSING_CLIENTHELLO': [(None, None)], 'MISSING_CLIENTKEYEXCHANGE': [(None, None)], 'NO_USABLE_CIPHERSUITE': [(None, None)], 'PREPARE_SERVERFLIGHT1': [(None, None)], 'PREPARE_SERVERFLIGHT2': [(None, None)], 'RECEIVED_CLIENTDATA': [(None, None)], 'RECEIVED_CLIENTFLIGHT1': [(None, None)], 'RECEIVED_CLIENTFLIGHT2': [(None, None)], 'SENT_SERVERDATA': [(None, None)], 'SENT_SERVERFLIGHT2': [(None, None)], 'SSLv2_ADDED_REQUESTCERTIFICATE': [(None, None)], 'SSLv2_ADDED_SERVERDATA': [(None, None)], 'SSLv2_ADDED_SERVERFINISHED': [(None, None)], 'SSLv2_ADDED_SERVERHELLO': [(None, None)], 'SSLv2_ADDED_SERVERVERIFY': [(None, None)], 'SSLv2_CLOSE_NOTIFY': [(None, None)], 'SSLv2_CLOSE_NOTIFY_FINAL': [(None, None)], 'SSLv2_HANDLED_CLIENTCERTIFICATE': [(None, None)], 'SSLv2_HANDLED_CLIENTDATA': [(None, None)], 'SSLv2_HANDLED_CLIENTFINISHED': [(None, None)], 'SSLv2_HANDLED_CLIENTHELLO': [(None, None)], 'SSLv2_HANDLED_CLIENTMASTERKEY': [(None, None)], 'SSLv2_MISSING_CLIENTCERTIFICATE': [(None, None)], 'SSLv2_MISSING_CLIENTFINISHED': [(None, None)], 'SSLv2_MISSING_CLIENTMASTERKEY': [(None, None)], 'SSLv2_RECEIVED_CLIENTCERTIFICATE': [(None, None)], 'SSLv2_RECEIVED_CLIENTDATA': [(None, None)], 'SSLv2_RECEIVED_CLIENTFINISHED': [(None, None)], 'SSLv2_RECEIVED_CLIENTMASTERKEY': [(None, None)], 'SSLv2_SENT_REQUESTCERTIFICATE': [(None, None)], 'SSLv2_SENT_SERVERDATA': [(None, None)], 'SSLv2_SENT_SERVERFINISHED': [(None, None)], 'SSLv2_SENT_SERVERHELLO': [(None, None)], 'SSLv2_SENT_SERVERVERIFY': [(None, None)], 'SSLv2_WAITING_CLIENTCERTIFICATE': [(None, None)], 'SSLv2_WAITING_CLIENTDATA': [(None, None)], 'SSLv2_WAITING_CLIENTMASTERKEY': [(None, None)], 'TLS13_HANDLED_CLIENTFINISHED': [(None, None)], 'WAITING_CLIENT': [(None, None)], 'WAITING_CLIENTDATA': [(None, None)], 'WAITING_CLIENTFLIGHT1': [(None, None)], 'WAITING_CLIENTFLIGHT2': [(None, None)], 'tls13_ADDED_CERTIFICATE': [(None, None)], 'tls13_ADDED_CERTIFICATEREQUEST': [(None, None)], 'tls13_ADDED_CERTIFICATEVERIFY': [(None, None)], 'tls13_ADDED_ENCRYPTEDEXTENSIONS': [(None, None)], 'tls13_ADDED_SERVERFINISHED': [(None, None)], 'tls13_ADDED_SERVERHELLO': [(None, None)], 'tls13_HANDLED_CLIENTHELLO': [(None, None)], 'tls13_PREPARE_SERVERFLIGHT1': [(None, None)], 'tls13_RECEIVED_CLIENTFLIGHT2': [(None, None)], 'tls13_WAITING_CLIENTFLIGHT2': [(None, None)]}
tls13_ADDED_CERTIFICATE(*args, **kargs)
tls13_ADDED_CERTIFICATEREQUEST(*args, **kargs)
tls13_ADDED_CERTIFICATEVERIFY(*args, **kargs)
tls13_ADDED_ENCRYPTEDEXTENSIONS(*args, **kargs)
tls13_ADDED_SERVERFINISHED(*args, **kargs)
tls13_ADDED_SERVERHELLO(*args, **kargs)
tls13_HANDLED_CLIENTHELLO(*args, **kargs)
tls13_PREPARE_SERVERFLIGHT1(*args, **kargs)
tls13_RECEIVED_CLIENTFLIGHT2(*args, **kargs)
tls13_WAITING_CLIENTFLIGHT2(*args, **kargs)
tls13_should_add_Certificate()
tls13_should_add_CertificateRequest()
tls13_should_add_CertificateVerifiy()
tls13_should_add_EncryptedExtensions()
tls13_should_add_Finished()
tls13_should_add_ServerHello()
tls13_should_handle_ClientFinished()
tls13_should_handle_ClientHello()
tls13_should_send_ServerFlight1()
vprint_sessioninfo()