MCPcopy Create free account
hub / github.com/secdev/scapy / TLSClientAutomaton

Class TLSClientAutomaton

scapy/layers/tls/automaton_cli.py:89–1471  ·  view source on GitHub ↗

A simple TLS test client automaton. Try to overload some states or conditions and see what happens on the other side. Rather than with an interruption, the best way to stop this client is by typing 'quit'. This won't be a message sent to the server. :param server: the server I

Source from the content-addressed store, hash-verified

87
88
89class TLSClientAutomaton(_TLSAutomaton):
90 """
91 A simple TLS test client automaton. Try to overload some states or
92 conditions and see what happens on the other side.
93
94 Rather than with an interruption, the best way to stop this client is by
95 typing 'quit'. This won't be a message sent to the server.
96
97 :param server: the server IP or hostname. defaults to 127.0.0.1
98 :param dport: the server port. defaults to 4433
99 :param server_name: the SNI to use. It does not need to be set
100 :param mycert:
101 :param mykey: may be provided as filenames. They will be used in the (or post)
102 handshake, should the server ask for client authentication.
103 :param client_hello: may hold a TLSClientHello, TLS13ClientHello or
104 SSLv2ClientHello to be sent to the server. This is particularly useful
105 for extensions tweaking. If not set, a default is populated accordingly.
106 :param version: is a quicker way to advertise a protocol version ("sslv2",
107 "tls1", "tls12", "tls13", etc.) It may be overridden by the previous
108 'client_hello'.
109 :param session_ticket_file_in: path to a file that contains a session ticket
110 acquired in a previous session.
111 :param session_ticket_file_out: path to store any session ticket acquired during
112 this session.
113 :param data: is a list of raw data to be sent to the server once the
114 handshake has been completed. Both 'stop_server' and 'quit' will
115 work this way.
116 """
117
118 def parse_args(self, server="127.0.0.1", dport=4433, server_name=None,
119 mycert=None, mykey=None,
120 client_hello=None, version=None,
121 resumption_master_secret=None,
122 session_ticket_file_in=None,
123 session_ticket_file_out=None,
124 psk=None, psk_mode=None,
125 data=None,
126 ciphersuite: Optional[int] = None,
127 curve: Optional[str] = None,
128 supported_groups=None,
129 supported_signature_algorithms=None,
130 **kargs):
131
132 super(TLSClientAutomaton, self).parse_args(mycert=mycert,
133 mykey=mykey,
134 **kargs)
135 tmp = socket.getaddrinfo(server, dport)
136 self.remote_family = tmp[0][0]
137 self.remote_ip = tmp[0][4][0]
138 self.remote_port = dport
139 self.server_name = server_name
140 self.local_ip = None
141 self.local_port = None
142 self.socket = None
143
144 if isinstance(client_hello, (SSLv2ClientHello, TLSClientHello,
145 TLS13ClientHello)):
146 self.client_hello = client_hello

Callers 1

example_client.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…