Nmap Development mailing list archives
ncat usage
From: Dave Henderson <dhenderson () digital-pipe com>
Date: Mon, 07 May 2012 15:34:06 -0400
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, Davewhile (( 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
Basically the above 'while' loop cycles for every request submitted
causing netcat to process the request and then restart. Currently the
webpages are being served using nc, but when I switch to ncat, I get the
following (verbose) output at the command prompt, but no webpage ever
comes up in the browser:
Ncat: Version 5.21 ( http://nmap.org/ncat ) Ncat: Listening on 127.0.0.1:80 NCAT DEBUG: Initialized fdlist with 102 maxfds NCAT DEBUG: Added fd 3 to list, nfds 1, maxfd 3 NCAT DEBUG: Added fd 0 to list, nfds 2, maxfd 3 NCAT DEBUG: Initialized fdlist with 100 maxfds NCAT DEBUG: selecting, fdmax 3 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 3 is ready Ncat: Connection from 127.0.0.1. NCAT DEBUG: Added fd 4 to list, nfds 3, maxfd 4 NCAT DEBUG: Added fd 4 to list, nfds 1, maxfd 4 NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 4 is ready NCAT DEBUG: selecting, fdmax 4Mon May 7 19:22:41 UTC 2012 INFO Executing ./modules/cdb/default.sh script
NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: selecting, fdmax 4 NCAT DEBUG: select returned 1 fds ready NCAT DEBUG: fd 0 is ready NCAT DEBUG: EOF on stdin NCAT DEBUG: selecting, fdmax 4It looks like the correct script gets called (./modules/cdb/default.sh), but again, nothing comes back to the browser. Any ideas about what might be happening? Perhaps something is going wrong in the I/O redirection... Thanks for any help!
Dave PS.Is there a way to have ncat remain running (-k) and simulate EOF so that the connection to the script and browser is closed correctly?
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- ncat usage Dave Henderson (May 07)
- Re: ncat usage David Fifield (May 07)
- Re: ncat usage Dave Henderson (May 07)
- Re: ncat usage Dave Henderson (May 09)
- Re: ncat usage James Rogers (May 09)
- Re: ncat usage Dave Henderson (May 09)
- Re: ncat usage James Rogers (May 09)
- Re: ncat usage Dave Henderson (May 09)
- Re: ncat usage James Rogers (May 09)
- Re: ncat usage Dave Henderson (May 10)
- Re: ncat usage James Rogers (May 10)
- Re: ncat usage Dave Henderson (May 07)
- Re: ncat usage David Fifield (May 07)
