Simple command-line HTTP proxy that outputs to STDOUT

grephttp-proxyPROXYstdouttransparent-proxy

Is there a command-line HTTP proxy that outputs to STDOUT so I can use it with Unix pipes?

I want to do something like this:

  1. Start the proxy at the command-line:
    $ proxy -p 8888 | grep "Text I'm interested in" > ~/my_log.txt
  2. Configure my browser to use the HTTP proxy on port 8888.
  3. Browse the Internet. As I browse, HTML is grepped and saved to my_log.txt
  4. CTRLC when I'm done.

UPDATE: I hadn't thought about this before, but the solution needs to handle gzipped/deflated content correctly.

Best Answer

Can you skip the proxy, and just use tcpdump with the -A option and a filter?

# capture everything destined for port 80
tcpdump -qni eth0 -s 0 -A port 80

# capture everything destined for port 80 on 192.168.32.1
tcpdump -qni eth0 -s 0 -A port 80 and host 192.168.32.1

# capture everything destined for port 80 and display only the interesting bit.
tcpdump -qni eth0 -s 0 -A port 80 | grep "Text I'm interested in"
Related Topic