impromptu web server using netcat
Tom Buskey
tom at buskey.name
Mon Jan 15 12:26:37 EST 2007
On 1/15/07, Ric Werme <ewerme at comcast.net> wrote:
>
> Most of you are probably familiar with the ever useful TCP/IP utility
> "netcat" (often /usr/bin/nc).
>
> I'm not sure where netcat came from, I didn't hear about it until a
> year or two ago, and only tried it once or twice.
Hobbit wrote it (it's in the Fedora man pages). Weld Pond ported it to
Windows. They were both part of L0pht Heavy Industries (later bought by
@Stake).
Hobbit showed me this:
A B
\ /
C
ex:
a=51001
b=51002
On C connect to A and B:
ssh A -L $a:127.0.0.1:$a
ssh B -L $b:127.0.0.1:$b
On A (from):
nc -lvnp $a 127.0.0.1 < file
On B (to):
nc -lvnp $b 127.0.0.1 > file
On C (connect from | to ):
nc -v -w 2 127.0.0.1 $a | nc -v -w2 127.0.0.1 $b
Recently, there is a GNU netcat which seems to be the version installed on
Fedora 5. It doesn't allow -l and -p to be on the same line which seems to
be a big bug.
You get in the habit of adding the -L with a different port whenever you use
ssh. Then you always have a port you can connect netcat to for various
things. It runs in the encrypted tunnel and doesn't add any overhead.
TCP/IP takes care of errors in the transmission too.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20070115/f74e2968/attachment.html
More information about the gnhlug-discuss
mailing list