Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/PDcos
- import socket
- def main():
- v = socket.socket()
- host = 'google.com'
- port = 80
- v.connect((host, port))
- s = socket.socket()
- host = ''
- port = 31665
- s.bind((host, port))
- s.listen(5)
- print('\n-----START-----')
- print('Now listening on port',str(port))
- c, addr = s.accept()
- print('Got connection from', addr)
- request = c.recv(4096).decode()
- print(request)
- #mess with reqiest and put together output
- v.send(request.encode())
- googanswer = v.recv(4096).decode()
- print(googanswer)
- c.send(googanswer.encode())
- request = c.recv(4096).decode()
- v.send(request.encode())
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement