Created
March 16, 2018 12:59
-
-
Save cbodley/3e6003450b0e9a13b92df374513330f5 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/python | |
import argparse | |
import socket | |
parser = argparse.ArgumentParser() | |
parser.add_argument('hostname', help='Hostname of the http server') | |
parser.add_argument('port', type=int, help='Port number of the http server') | |
args = parser.parse_args() | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.connect((args.hostname, args.port)) | |
# send http message with incomplete Host header | |
sock.send('GET / HTTP/1.1\r\nHost\r\n\r\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment