Nmap Development mailing list archives
Verbose data file path reporting
From: David Fifield <david () bamsoftware com>
Date: Wed, 6 Jun 2007 16:04:08 -0600
I have checked into /nmap-exp/soc07/nmap a revision that allows Nmap to show which data files it loaded and where it loaded them from. Right now, this information is displayed only in verbose mode. Here are some examples: # nmap -v localhost Read from /usr/local/share/nmap: nmap-services. # nmap -v -A 192.168.0.0/24 Read from /usr/local/share/nmap: nmap-mac-prefixes nmap-os-db nmap-os-fingerprints nmap-rpc nmap-service-probes nmap-services. # nmap -v --servicedb /home/david/my-services 192.168.0.0/24 Read from /home/david: my-services. Read from /usr/local/share/nmap: nmap-mac-prefixes. # nmap -v --versiondb nmap-service-probes localhost Read from /usr/local/share/nmap: nmap-services. # nmap -v -sV --versiondb nmap-service-probes localhost Read from .: nmap-service-probes. Read from /usr/local/share/nmap: nmap-rpc nmap-services. # rm nmap-os-db # nmap -v -A --datadir . --servicedb /etc/services localhost Read from .: nmap-os-fingerprints nmap-service-probes. Read from /etc: services. Read from /usr/local/share/nmap: nmap-os-db. The patch doesn't say if a different file name, rather than just a different directory, is used. The user has to know, for example, that my-services was loaded instead of nmap-services. It would not be hard to add support for this. The data_file_record struct in output.cc carries both the original and the actual file names. This code involves splitting a path into its directory and file components. There are POSIX functions dirname and basename that do this, but they are exceedingly nasty and hard to use, not to mention not available on Windows. I wrote short reimplementations of those functions and put them in output.cc. I noticed, though, that a similar problem has been solved at least twice before: in main.cc:main to get the nmap executable name, and in nse_init.cc:get_filename. Is this something that should be moved into utils.cc or nbase? I wasn't sure where to keep the global map of data file names to paths. I put it in NmapOps.h, even though it's not really an option. There are some other non-option things in there, though, like numhosts_scanned. I'd appreciate it if some SoCers or other developers did a "svn diff -c 4860" and looked it over. I'm still learning C++ STL stuff and it would be good to have some more eyes look it over. Is the placement of this new information in the output right? It has to be near the end (after the port tables) because not all data files have been opened until then. David Fifield _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- Verbose data file path reporting David Fifield (Jun 06)
- Re: Verbose data file path reporting Fyodor (Jun 06)