TCPWatch is a simple Python program which has two operation modes:
  • HTTP proxy
  • Port forwarding
In port forwarding, TCPWatch listens on a local port and relays the HTTP request sent to this port to a remote host. The following command will listen for HTTP requests on port 8000 and forward them to linuxonly.nl:
$ python tcpwatch.py -L 8000:linuxonly.nl:80
Thus the request can be seen by using the URL http://localhost:8000/. However, as TCPWatch does not rewrite the Host header, this will not trigger the right virtual host.

Proxy mode

  1. Start TCPWatch, by running python tcpwatch.py -p 8080.
  2. Configure the client to use the proxy. Host localhost, port 8080.
  3. Do the request.
  4. In TCPWatch, click on the number in the left column.
  5. The request and response are shown in the right column.

Forwarding mode

  1. Start TCPWatch, by running python tcpwatch.py -L 8000:host.example.com:80, where host.example.com is the site to connect to and 8000 is the local port to listen on.
  2. Do the request, using the URL http://localhost:8000/.
  3. In TCPWatch, click on the number in the left column.
  4. The request and response are shown in the right column. A HTTP request shown in TCPWatch