Nmap Development mailing list archives
Re: [patch] The most minor issue ever: set noninteractive on -iL -
From: Vlatko Kosturjak <vkosturj () griffin linux hr>
Date: Wed, 04 Apr 2012 11:32:45 +0200
While talking about this, most annoying behaviour is when I'm running nmap inside screen. It automatically turns off interactive keys. Is there any tip or fix for this? -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. David Fifield <david () bamsoftware com> wrote: On Wed, Mar 28, 2012 at 03:01:57PM -0400, Patrick Donnelly wrote:
On Wed, Mar 28, 2012 at 2:14 PM, David Fifield <david () bamsoftware com> wrote:On Wed, Mar 28, 2012 at 12:07:25PM -0500, Daniel Miller wrote:List, While digging through the option parsing in nmap.cc for a presentation, I noticed that the input of hostnames (-iL or -i) could come from stdin. I think if this is used, then o.noninteractive should be set, since there would be no way to get keystrokes:Index: nmap.cc _____________________________________________
--- nmap.cc (revision 28355) +++ nmap.cc (working copy) @@ -1048,6 +1048,7 @@ } if (!strcmp(optarg, "-")) { o.inputfd = stdin; + o.noninteractive = true; } else { o.inputfd = fopen(optarg, "r"); if (!o.inputfd) {I doubt this really matters much, but I thought I'd mention it.Thanks, Dan, but I think this is incorrect. Nmap doesn't get runtime interaction keystrokes from stdin, but from the tty. I just tested it and this works: nmap --scan-delay 10ms -iL - < input.txt But this doesn't: cat input.txt | nmap --scan-delay 10ms -iL - Probably there is some subshell interaction with the tty that prevents the second example from working.The second example doesn't work because, in nmap_tty.cc, Nmap closes the tty FD if it is not the foreground process group leader. In tty_init: #ifndef __CYGWIN32__ if (tcgetpgrp(tty_fd) != getpid()) { close(tty_fd); return; } #endif getpid should maybe be getpgrp so that Nmap accepts terminal input even when it's part of a pipeline (i.e. not the process group leader).
I tried this (getpgrp) but it didn't seem to change anything. David Fifield _____________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/ _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Re: [patch] The most minor issue ever: set noninteractive on -iL - David Fifield (Apr 03)
- Re: [patch] The most minor issue ever: set noninteractive on -iL - Patrick Donnelly (Apr 03)
- Re: [patch] The most minor issue ever: set noninteractive on -iL - David Fifield (Apr 06)
- Re: [patch] The most minor issue ever: set noninteractive on -iL - David Fifield (Apr 06)
- Re: [patch] The most minor issue ever: set noninteractive on -iL - Patrick Donnelly (Apr 06)
- Re: [patch] The most minor issue ever: set noninteractive on -iL - David Fifield (Apr 08)
- Re: [patch] The most minor issue ever: set noninteractive on -iL - David Fifield (Apr 06)
- Re: [patch] The most minor issue ever: set noninteractive on -iL - Patrick Donnelly (Apr 03)
- Re: [patch] The most minor issue ever: set noninteractive on -iL - Daniel Miller (Apr 04)
- Re: [patch] The most minor issue ever: set noninteractive on -iL - David Fifield (Apr 04)