English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Is there a way to restart a netcat session.. basically I'm trying to use NC to do port forwarding so my imap server will listen on another port too.. but the problem is, is that once the user disconnects, nc stops listening.. is there a way to get it to restart itself or stay in a listening state so it will grab the next request too??

2006-08-02 08:22:51 · 2 answers · asked by jrv116psu 2 in Computers & Internet Security

2 answers

You have 2 basic options:

1) FInd a version of netcat that supports the -L flag (this is an add-on to the standard version).

2) Create yourself a little shell script (perl not needed):

% cat > ./listenharder.sh
#!/bin/bash
while [ 1 ]; do nc -l -p 3394; done
^D
% chmod +x listenharder.sh
% ./listenaharder.sh

Change the exact nc command as needed for your circumstances. Of course, you can issue the 'while' command at an interactive shell prompt as well if you're so inclined.

You *may* also want to investigate using ssh to do your port forwarding instead - that will likely support persistend listeners and multiple connections better (and give you encryption if you're forwarding acrossa a network too).

2006-08-02 17:16:34 · answer #1 · answered by Valdis K 6 · 0 0

wrap it in a perl script that relaunches the session once the first one's terminated.

2006-08-02 18:33:29 · answer #2 · answered by knieveltech 3 · 0 0

fedest.com, questions and answers