Skip to content

Instantly share code, notes, and snippets.

@cwyang
Created June 8, 2021 12:03
Show Gist options
  • Save cwyang/9b1e09e3d95750027486955ec019ef70 to your computer and use it in GitHub Desktop.
Save cwyang/9b1e09e3d95750027486955ec019ef70 to your computer and use it in GitHub Desktop.
ssl teardown test
import socket, ssl, sys
if len(sys.argv) == 1:
hostname = 'www.naver.com'
else:
hostname = sys.argv[1]
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
with socket.create_connection((hostname, 443)) as sock:
with ctx.wrap_socket(sock, server_hostname = hostname) as ssock:
foo = ssock.unwrap()
print(f"unwap returns {foo}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment