Created
March 13, 2024 20:57
-
-
Save jjfiv/d43c4566855a8f90286a2d4fb8b20a02 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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