Nmap Development mailing list archives

Piping ncat through ssh


From: miniBill <cmt.minibill () gmail com>
Date: Fri, 16 Jul 2010 22:02:35 +0200

Question: would it be possible to make ncat proxy mode "listen to files"?
Question: what's the correct mode to pipe ncat through ssh using a single link?
[i.e.: not sshing for every connection, but once, and merge everything
from clients into the pipe, and copy everything coming from the pipe
to all clients]

[Scenario]

*Computers:
A: my computer, I've got nmap 5.21 [but I can update], and root access
B: a computer I've got a shell account to, no nmap/ncat, no compiling,
strict firewall only allows incoming to port 22
C: a computer I've got a shell account to, nmap/ncat 5.30BETA1, can
compile, strict firewall only allows incoming to port 22

*What I want to achieve
Run "ncat -k -l 54345 --proxy-type http" on C. -- no problem
Run "ncat -k -l 8080" on A. -- no problem
Pipe ncat on A to ncat on C forth and back. -- no problem
Pipe it *without* making a ssh connection for every client connecting
to localhost:8080. -- have some problems

*What I tried to see how this could work [this is the A->C part, but
the idea should also work backwards]:
$ncat -k -l 8080 < filein > fileout
$tail -f fileout | ssh an "ssh hx \"cat - > pipein\" "
$ssh B "ssh C \" cat < pipein | ./ncat localhost 54345\" "
$ssh B "ssh C \" ./ncat -l 54345 \" "

*The problem
When I run
$ncat localhost 8080
multiple times only the odd runs [the first, the third...] produce a
visible effect in the console running
$ssh B "ssh C \" ./ncat -l 54345 \" "
although the even connections don't display any error message in any console

Any idea?

Also, if instead of files I use pipes it doesn't work o_O

$ncat -k -l 8080 > pipeout < pipein
$nmap -p 8080 localhost | grep 8080
8080/tcp closed http-proxy

using -v on ncat and trying to see what pipeout has to say doesn't help

Thank you

Leonardo
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: