Skip to content

Instantly share code, notes, and snippets.

@njsmith
Created October 20, 2016 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save njsmith/5ecda1f24911e54097d63ed1d9c050cd to your computer and use it in GitHub Desktop.
Save njsmith/5ecda1f24911e54097d63ed1d9c050cd to your computer and use it in GitHub Desktop.
import sys
import socket
host, port = sys.argv[1], int(sys.argv[2])
with socket.create_connection((host, port)) as sock:
get = b"GET / HTTP/1.1\r\nHost: " + host.encode("ascii") + b"\r\n\r\n"
count = 0
while True:
sock.sendall(get)
count += 1
if count % 10000 == 0:
sys.stdout.write("\rRequests sent: {}".format(count))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment