patchPanel is a little tool for redirecting the output of one netstream to the input of another. It needs a bit of debugging, but the next thing I will work on is a filter interface where one can fexec a program to transform the data stream. This will be handy for things like debugging ftp, where proxying in active mode requires a translated data port allocation.
There is no Makefile right now. If there were one, it would read:
gcc -o patchPanel patchPanel.cpp -lreadline
I'll probably get around to more patchPanel work soon as I need to do more protocol work (I originally wrote patchPanel when working on the HTTP/1.1 per- formance paper). Anyone else, however, is quite welcome to dump patches. It is important to be careful, though. If you give me too many patches, I give you the program.
patchPanel
accepts its input from the console where it
was run, unless redirected from some other input port. If you do that,
you should be writing these docs. patchPanel
keeps a
focus
which tells where it should send any output that it
gets from the console. In order to distinguish input commands from
data to be streamed, commands are prefixed wiht a leading '/' (like in
IRC). You may also type '^C' to get the command interpreter's
attention.
not even started
not even started
not even started
not even started
not even started
not even started
not even started
not even started
I typically use proxy
when debugging protocols. A
sample invocation is patchPanel "proxy 8000 dev.w3.org 80" "mask
DATA"
. The "mask DATA"
tells it not to spew info
about when sockets are opend or closed.
Once I've opened a patchPanel proxy socket, I point my
browser to it: Location:
http://localhost:8000/cvsweb/patchPanel/README
and watch the
output in the patchPanel terminal window:
quake:/usr/local/src/patchPanel/patchPanel$ ./patchPanel "proxy 8000 dev.w3.org 80"
proxied 4 to 5 for 3 (proxy 8000 dev.w3.org 80)
reading 305 bytes from 4
GET /cvsweb/patchPanel/README HTTP/1.0
Connection: Keep-Alive
User-Agent: Mozilla/4.7 [en] (X11; I; Linux 2.2.5-22 i686)
Host: localhost:8000
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*
Accept-Encoding: gzip
Accept-Language: en
Accept-Charset: iso-8859-1,*,utf-8
reading 165 bytes from 5
HTTP/1.1 200 OK
Date: Sun, 28 Nov 1999 23:56:09 GMT
Server: Apache/1.3.6 (Unix) PHP/3.0.9
Content-encoding: x-gzip
Connection: close
Content-Type: text/html
reading 1431 bytes from 5
......A8...WQo.H.~.W..U.H...S[j... .B@.4...hm/x...y.R...~36.C..T..!%....73.
7.8.T.0.".<.j.sb3O..c.I..~7.D.`.RX0..#&yb........Q.!.1..........|.? -.lB...k
xN.+..s..w..5..........`..D.xg.},....O]+6f....jU[..T:...?.........K.&...,.......
.Wg.}.......Zwgm......Z..V......z...5..[.B.....r.J.X...e.-/C.$........Qs&d...QoX
e,.4=BE..a..LT.!......q."....fb...=..t~.d p.:.D..ix.#b..=p.(.D.g9...3`.C .
.F.:o_o.7.I...z....eb H...&.Z..!.J./..o.1.....Z..^.S.....Cu.."g..
...-{.f...\....b..U.^p.$j.....Y..\...C...Xv....YQ..a....4_...a.EB*.......q..G.(.
..=..J.H.jj..........
/SNEgA.Ou..$ X..N.f.cp.(...8...4....T..l%5...h..wb~...l.......8.X&.i.2.....M.
l.N X....!.V..b...7p.L..+a.{.fn.....lB.d.h..l..$..].....>Hd...):.1..A...".$.9{..
\d.01.....)0...........f.^..
.=...5.5.......*[-..(V
;.u..q..........(!P...-.'..?.8>@......dPE..(.....V..p<.A..
....f...2.....l+..{.m...A.V...|....-.!
.{73.v.[..'D..'..q.....g.zsG.L&....7.[...#..w..t&...oZ..$4i.*.e........Eq....3..
3.O.....fj .X-..i.......~g.u...w=i.{.....}..w....7Xz.R.5...^......O.MD.i...
....Nn/.}.......4..a...T:f.....r.|A..Op.}..|..$YC1..8.7.h..1.3.Zz...9>yTh...I.V4
G6{...)...;.>.F.1.._.l.n....Z....1....}.n..d.._e.{..Q.....Y...+.p.....o........t
..socket 5 closed..W....$...&...Fl,.`/..........^......
closing tee'd output to 4
closing tee'd output to 5
deleting FdStream 0x805c0d8 (4)
deleting FdStream 0x805c1f8 (5)
proxied 4 to 5 for 3 (proxy 8000 dev.w3.org 80)
reading 347 bytes from 4
GET /icons/back.gif HTTP/1.0
Referer: http://localhost:8000/cvsweb/patchPanel/README
Connection: Keep-Alive
User-Agent: Mozilla/4.7 [en] (X11; I; Linux 2.2.5-22 i686)
Host: localhost:8000
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png
Accept-Encoding: gzip
Accept-Language: en
Accept-Charset: iso-8859-1,*,utf-8
reading 508 bytes from 5
HTTP/1.1 200 OK
Date: Sun, 28 Nov 1999 23:56:10 GMT
Server: Apache/1.3.6 (Unix) PHP/3.0.9
Last-Modified: Thu, 22 Feb 1996 11:45:53 GMT
ETag: "6f2c-d8-312c5771"
Accept-Ranges: bytes
Content-Length: 216
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: image/gif
GIF89a................fff333.........!.NThis art is in the public domain. Kevin
Hughes, kevinh@eit.com, September 1995.!.......,..........K....#..j.3S.....i.7N.
v..t..7*E.nXm/...5FP...x....l.(N. ....:.@..V...U.......;socket 5 closed.
closing tee'd output to 4
closing tee'd output to 5
... and, after a few moments, Netscape drops the connection:deleting FdStream 0x805c0f8 (4)
deleting FdStream 0x805e3a8 (5)
not even started
not even started
not even started
not even started
not even started
not even started
Typing /help
(or ^Chelp
) will bring up a
vaguely useful help screen:
prefix commands with a / or type ^C and the commanderic@w3.org
COMMANDS:
quit
dots - display non-printable characters as dots
hex - hex bytes
strait - pass non-printable characters through to console output
console <index|%fd|0xaddr> - assign console IO to different connection
mask <DATA|ALL||0xmask> - mask console IO
focus <index|%fd|0xaddr> - assign console text to different connection
cat <fname> <index|%fd|0xaddr> - dump file down connection
fexec <path> <argv0> [argv1]...
proxy <local port> <server host> <server port>
connect <host> <port>
accept <port>
close <index|%fd|0xaddr>
tap <source index|%fd|0xaddr> <target index|%fd|0xaddr> - copy source input to target
quote - toggle checking for / commands
status
help|? - this message
$Date: 1999/11/29 01:20:41 $