Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- import socket
- import sys
- TARGET = b'127.0.0.1'
- HOST = "127.0.0.1"
- PORT = 80
- try:
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- print("Socket succesfully created")
- except socket.error as err:
- print("Socket creation failed with error %s" % (err))
- s.settimeout(120)
- s.connect((HOST,PORT))
- s.settimeout(None)
- buffer = b"GET / HTTP/1.1\n"
- buffer += b"Host: %s\n\n" % (TARGET)
- print(buffer)
- s.send(buffer)
- result = s.recv(10000)
- while(len(result) > 0):
- print(result)
- result = s.recv(10000)
- s.close()
Advertisement
Add Comment
Please, Sign In to add comment