Nmap Development mailing list archives
Re: Enhanced nsock logging
From: David Fifield <david () bamsoftware com>
Date: Fri, 14 Dec 2012 16:11:05 -0800
On Sat, Dec 08, 2012 at 03:18:14PM +0100, Henri Doreau wrote:
Hello, I've been working on improving the nsock logging abilities recently. The initial problem was that nsock loglevel could not be easily set to a desired value from command line (the easiest was to patch nsock_pool.c and rebuild...) and also that this level could not be adjusted at runtime by pressing d/D. Additionally, I had this personal frustration with the nsock code which directly printed out the messages instead of generating log objects. The patched version of nsock that you can find in my nsock-logging branch[1] exports the following: * four different log levels - NSOCK_LOG_DBG_ALL - NSOCK_LOG_DBG - NSOCK_LOG_INFO - NSOCK_LOG_ERROR * getter/setter to the loglevel of a given nsock_pool * a nsock_log_rec structure type that contains the log message as well as some context information (date, line, file, function name...) * a way to set a custom logging function that will receive every nsock_log_rec object whose level is >= the one set for the current nsock_pool. With this in hand, I've modified nmap, ncat and nping to fix the issues mentioned above. Within nsock, logging is now more consistent and cleaner. Nmap has a mapping between its own log level and nsock (see nmap_adjust_loglevel() in output.cc) , plus this is adaptive. Highest log levels can now be enabled with ncat (was only 0 or 1 before). Things don't change much for nping.
Thank you Henri, good-looking code as always. The Windows build doesn't like the variadic macro NSOCK_LOG_WRAP. It fails to build with error C2010: nsock_log.h(64): error C2010: '.' : unexpected in macro formal parameter list I'm also seeing include/nsock.h(142): error C2079: 'nsock_log_rec::time' uses undefined struct 'timeval' --packet-trace is showing me DEBUG FULL messages, when it shouldn't show that much detail and didn't before. David Fifield _______________________________________________ Sent through the dev mailing list http://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Enhanced nsock logging Henri Doreau (Dec 08)
- Re: Enhanced nsock logging Henri Doreau (Dec 14)
- Re: Enhanced nsock logging David Fifield (Dec 14)
- Message not available
- Re: Enhanced nsock logging David Fifield (Dec 14)
- Re: Enhanced nsock logging Henri Doreau (Dec 15)
- Re: Enhanced nsock logging David Fifield (Dec 15)
- Re: Enhanced nsock logging Henri Doreau (Dec 15)
- Message not available