Advertisement
tyler569

passthrough

Mar 23rd, 2013
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. #!/usr/PDcos
  2.  
  3. import socket
  4.  
  5. def main():
  6.     v = socket.socket()
  7.     host = 'google.com'
  8.     port = 80
  9.     v.connect((host, port))
  10.  
  11.  
  12.     s = socket.socket()
  13.     host = ''
  14.     port = 31665
  15.     s.bind((host, port))
  16.  
  17.     s.listen(5)
  18.     print('\n-----START-----')
  19.     print('Now listening on port',str(port))
  20.  
  21.     c, addr = s.accept()
  22.     print('Got connection from', addr)
  23.  
  24.     request = c.recv(4096).decode()
  25.     print(request)
  26.  
  27.     #mess with reqiest and put together output
  28.     v.send(request.encode())
  29.  
  30.     googanswer = v.recv(4096).decode()
  31.  
  32.     print(googanswer)
  33.     c.send(googanswer.encode())
  34.  
  35.     request = c.recv(4096).decode()
  36.  
  37.     v.send(request.encode())
  38.    
  39. if __name__ == '__main__':
  40.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement