Nmap Development mailing list archives

Re: ncat usage


From: David Fifield <david () bamsoftware com>
Date: Mon, 7 May 2012 12:57:49 -0700

On Mon, May 07, 2012 at 03:34:06PM -0400, Dave Henderson wrote:
Good afternoon gang!  I'm working on a project that currently uses
Berkley's netcat (nc), however, during some research I stumbled on
ncat.  I can see that it's much more comprehensive so I'd like to
make the switch to using it instead, but I can't seem to get it
working right.  The project is basically a bash version of a web
server.  I'll post the working code below.  Any help would greatly
be appreciated!

Thanks,
Dave



while (( 1 == 1 )); do                # causes an infinite loop for
processing requests
    #nc -Cl $sOPTS "$iPORT" < "$SI" > "$SO" 2>>/tmp/debug.txt &   #
netcat-openbsd - DEBUGGING ERRORS/MESSAGES
    nc -Cl $sOPTS "$iPORT" < "$SI" > "$SO" &
# netcat-openbsd
    #ncat $sOPTS -vvv -C -l 127.0.0.1 $iPORT < "$SI" > "$SO" &
# ncat

    trap exitGraceful SIGINT                                    #
traps ctrl-C to exit this script
    head -n 1 "$SO" | procRequest > "$SI"
    trap - SIGINT
done

You will probably be happier with this (no while loop):

ncat -l -k $iPORT --sh-exec "cat \"$SI\""

Compare to some examples here:

http://nmap.org/ncat/guide/ncat-simple-services.html

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


Current thread: