Nmap Development mailing list archives
Re: Port number in verbose mode
From: rebellis <rebellis () gmail com>
Date: Mon, 10 May 2010 21:39:18 -0300
Done! Please see patch attached. I'm looking for tasks like that to get my programming skills in shape again. I have good knowledge of C++ (and C to a lesser extent) but no previous experience in network programming. I thought I could learn a bit by helping Nmap's development. Any hints on where to begin? :) Now regarding the link errors. Revision 17520 aborts compilation with the linking shown below. Please notice I can successfully compile Nmap 5.21. I'm using Arch Linux x86_64, gcc 4.5.0 and GNU Make 3.81. The complete make output goes attached. Thanks in advance. MAKE OUTPUT: g++ -Wl,-E -Lnbase -Lnsock/src/ -o nmap main.o nmap.o targets.o tcpip.o nmap_error.o utils.o idle_scan.o osscan.o osscan2.o output.o payload.o scan_engine.o timing.o charpool.o services.o protocols.o nmap_rpc.o portlist.o NmapOps.o TargetGroup.o Target.o FingerPrintResults.o service_scan.o NmapOutputTable.o MACLookup.o nmap_tty.o nmap_dns.o traceroute.o portreasons.o xml.o nse_main.o nse_nsock.o nse_fs.o nse_nmaplib.o nse_debug.o nse_pcrelib.o nse_binlib.o nse_bit.o nse_openssl.o nse_ssl_cert.o -lnbase -lnsock -lpcre libpcap/libpcap.a -lssl -lcrypto libdnet-stripped/src/.libs/libdnet.a -llua -ldl libpcap/libpcap.a(pcap-linux.o): In function `nl80211_init': /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:513: undefined reference to `nl_handle_alloc' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:520: undefined reference to `genl_connect' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:526: undefined reference to `genl_ctrl_alloc_cache' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:533: undefined reference to `genl_ctrl_search_by_name' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:545: undefined reference to `nl_handle_destroy' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:543: undefined reference to `nl_cache_free' libpcap/libpcap.a(pcap-linux.o): In function `del_mon_if': /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:651: undefined reference to `nlmsg_alloc' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:658: undefined reference to `genl_family_get_id' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:658: undefined reference to `genlmsg_put' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:660: undefined reference to `nla_put' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:662: undefined reference to `nl_send_auto_complete' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:683: undefined reference to `nl_wait_for_ack' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:700: undefined reference to `nlmsg_free' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:690: undefined reference to `nlmsg_free' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:708: undefined reference to `nlmsg_free' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:715: undefined reference to `nlmsg_free' libpcap/libpcap.a(pcap-linux.o): In function `nl80211_cleanup': /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:552: undefined reference to `genl_family_put' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:553: undefined reference to `nl_cache_free' libpcap/libpcap.a(pcap-linux.o): In function `add_mon_if': /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:569: undefined reference to `nlmsg_alloc' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:576: undefined reference to `genl_family_get_id' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:576: undefined reference to `genlmsg_put' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:578: undefined reference to `nla_put' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:579: undefined reference to `nla_put' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:580: undefined reference to `nla_put' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:582: undefined reference to `nl_send_auto_complete' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:603: undefined reference to `nl_wait_for_ack' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:610: undefined reference to `nlmsg_free' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:620: undefined reference to `nlmsg_free' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:628: undefined reference to `nlmsg_free' /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:635: undefined reference to `nlmsg_free' libpcap/libpcap.a(pcap-linux.o): In function `nl80211_cleanup': /home/rebellis/sources/nmap/libpcap/./pcap-linux.c:554: undefined reference to `nl_handle_destroy' collect2: ld returned 1 exit status make[1]: *** [nmap] Error 1 make[1]: Leaving directory `/home/rebellis/sources/nmap' make: *** [all] Error 2 -- rebellis On Mon, May 10, 2010 at 11:49 AM, David Fifield <david () bamsoftware com> wrote:
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
Attachment:
make_output.txt
Description:
Attachment:
ncat-srcport.diff
Description:
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Port number in verbose mode Dite Sirte (May 06)
- Re: Port number in verbose mode David Fifield (May 08)
- Re: Port number in verbose mode rebellis (May 09)
- Re: Port number in verbose mode David Fifield (May 10)
- Re: Port number in verbose mode rebellis (May 10)
- Re: Port number in verbose mode David Fifield (May 11)
- Re: Port number in verbose mode rebellis (May 11)
- Re: Port number in verbose mode ithilgore (Jun 08)
- Re: Port number in verbose mode David Fifield (Jun 08)
- Re: Port number in verbose mode Andrew Whatson (Jun 10)
- Re: Port number in verbose mode ithilgore (Jun 10)
- Re: Port number in verbose mode David Fifield (Jun 13)
- Re: Port number in verbose mode Andrew Whatson (Jun 14)
- Re: Port number in verbose mode rebellis (May 09)
- Re: Port number in verbose mode David Fifield (May 08)