Created
June 8, 2021 12:03
-
-
Save cwyang/9b1e09e3d95750027486955ec019ef70 to your computer and use it in GitHub Desktop.
ssl teardown test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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