Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Re: [patch] The most minor issue ever: set noninteractive on -iL -
From: Patrick Donnelly <batrick () batbytes com>
Date: Tue, 3 Apr 2012 22:50:03 -0400

On Tue, Apr 3, 2012 at 9:17 PM, David Fifield <david () bamsoftware com> wrote:
I tried this (getpgrp) but it didn't seem to change anything.

I just double-double checked and got it to work:

<output>
batrick () batbytes ~/nmap/svn/nmap$ echo batbytes.com | ./nmap -iL
/dev/stdin --scan-delay 10ms

Starting Nmap 5.61TEST5 ( http://nmap.org ) at 2012-04-03 22:46 EDT
djNmap scan report for batbytes.com (72.14.184.61)
Host is up (0.000070s latency).
Not shown: 998 closed ports
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http

Nmap done: 1 IP address (1 host up) scanned in 10.11 seconds
batrick () batbytes ~/nmap/svn/nmap$ # recompile and make
batrick () batbytes ~/nmap/svn/nmap$ echo batbytes.com | ./nmap -iL
/dev/stdin --scan-delay 10ms

Starting Nmap 5.61TEST5 ( http://nmap.org ) at 2012-04-03 22:46 EDT
Debugging Increased to 1.
Overall sending rates: 99.48 packets / s.
Nmap scan report for batbytes.com (72.14.184.61)
Host is up (0.000054s latency).
Scanned at 2012-04-03 22:46:44 EDT for 10s
Not shown: 998 closed ports
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http
Final times for host: srtt: 54 rttvar: 15  to: 100000

Read from /home/batrick/nmap/svn/nmap: nmap-payloads nmap-services.
Nmap done: 1 IP address (1 host up) scanned in 10.11 seconds
</output>

[You can see the times I typed 'd' and 'j' in the first case, before
"Nmap scan report".]

I'm using this patch (make sure to change both calls to getpid):

batrick () batbytes ~/nmap/svn/nmap$ svn diff
Index: nmap_tty.cc
===================================================================
--- nmap_tty.cc (revision 28396)
+++ nmap_tty.cc (working copy)
@@ -157,7 +157,7 @@
        struct timeval tv;
 #endif

-       if (tty_fd && tcgetpgrp(tty_fd) == getpid()) {
+       if (tty_fd && tcgetpgrp(tty_fd) == getpgrp()) {

            // This is so that when the terminal has been
disconnected, it will be reconnected when possible. If it slows things
down, just remove it
            // tty_init();
@@ -213,7 +213,7 @@
        if ((tty_fd = open("/dev/tty", O_RDONLY | O_NONBLOCK)) < 0) return;

 #ifndef __CYGWIN32__
-       if (tcgetpgrp(tty_fd) != getpid()) {
+       if (tcgetpgrp(tty_fd) != getpgrp()) {
                close(tty_fd); return;
        }
 #endif

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


  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]