tcp_forward
| |
With this script you can view and/or filter the data flow in either direction.
As an example, I used it between my browser and a web site in order to learn about the basics of the HTTP protocol.
You can either pass the data as lines or single characters. Sending it as single characters is less efficient on your network, but is necessary in some cases (such as logins and data transfers). If you want to filter, you need to turn this off by setting the LINE_BY_LINE variables at the top of the script (not an option because some code modifications that you might want to make will require a specific setting).
A simple forwarding example would be:
% tcp_forward -f 2000 -t GetDave.com:80 -send
Then you can point your browser at localhost:2000 and it will be forwarded to GetDave.com.
Unfortunately most web servers need to know what domain you are asking for (the server at GetDave.com actually hosts multiple domains, including this one), but our browser thinks it is going to an unknown domain, at localhost.
We can fix this with filtering - there is an example filter built in that you can turn on with the EXAMPLE_FILTER setting at the top of the script. It converts the GET command sent into one that specifies the GetDave.com domain (in a somewhat kludgy way, since it has to change the HTTP protocol to 1.1 as well). Try it both ways and see what happens.