21 lines
629 B
Python
21 lines
629 B
Python
import argparse
|
|
|
|
|
|
arg_parser = argparse.ArgumentParser()
|
|
|
|
arg_parser.add_argument("-H", "--host", dest="hostname", type=str, default="127.0.0.1")
|
|
arg_parser.add_argument("-p", "--port", dest="port", type=int, default=57823)
|
|
|
|
arguments = arg_parser.parse_args()
|
|
|
|
|
|
if arguments:
|
|
import ssl
|
|
import socket
|
|
|
|
context = ssl.create_default_context()
|
|
|
|
with socket.create_connection((arguments.hostname, 443)) as sock_client:
|
|
with context.wrap_socket(sock_client, server_hostname=arguments.hostname) as ssl_sock_client:
|
|
print(ssl_sock_client.version())
|
|
ssl_sock_client.send(b"Hello World!")
|