Skip to content

Instantly share code, notes, and snippets.

@jjfiv
Created March 13, 2024 20:57
Show Gist options
  • Save jjfiv/d43c4566855a8f90286a2d4fb8b20a02 to your computer and use it in GitHub Desktop.
Save jjfiv/d43c4566855a8f90286a2d4fb8b20a02 to your computer and use it in GitHub Desktop.
import sys
import socket
from time import time
args = sys.argv[1:]
if len(args) not in [1,2]:
print("usage: tls_prank_call hostname [port]")
hostname = args[0]
port = 443 if len(args) == 1 else int(args[1])
start_time = time()
err = None
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setblocking(True)
s.connect((hostname, port))
x = s.recv(4096)
except Exception as e:
err = e
finally:
end_time = time()
if err:
print(err)
print("Time Elapsed: {:.3} seconds".format(end_time - start_time))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment