Nmap Development mailing list archives

Re: Port number in verbose mode


From: David Fifield <david () bamsoftware com>
Date: Mon, 10 May 2010 08:49:11 -0600

On Mon, May 10, 2010 at 02:26:18AM -0300, rebellis wrote:
Please correct me if I'm wrong but it looks like the solution is quite
simple (see patch attached).

--- ncat/ncat_listen.c        (revision 17520)
+++ ncat/ncat_listen.c        (working copy)
@@ -288,7 +288,7 @@
     }
 
     if (o.verbose)
-        loguser("Connection from %s.\n", inet_socktop(&remoteaddr));
+        loguser("Connection from %s:%d.\n", inet_socktop(&remoteaddr), ntohs(remoteaddr.in.sin_port));
 
     /* Check conditions that might cause us to deny the connection. */
     conn_count = get_conn_count();

Almost. Remember that remoteaddr could also be an IPv6 address. Please
send another patch that uses the inet_port function to get the port
based on the address family.

I couldn't test it on revision 17520 (Nmap doesn't compile on my box
-- got lots of linking errors related to libpcap). However, when
compiled against Nmap 5.21 sources the patch seems to work nicely:

Please post the linking errors you get.

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: