Nmap Development mailing list archives

Patches for a log_output bugfix, and a --no-clobber implementation


From: Dominic White <dominic () sensepost com>
Date: Wed, 14 Sep 2011 14:00:05 +0200

Hello

I'd like to submit 2 patches for consideration by the nmap dev team. The first fixes what appears to be a minor bug in 
the log_open function in output.{h|cc} where the append parameter is passed but never used, rather the append switch is 
read from the options global.

The second set of patches provide two methods of implementing a --no-clobber function. I regularly find myself 
overwriting scans by hitting the up key in my CLI, editing the options but forgetting to update the -oA argument. I 
know this is "human error" and the --append flag technically caters for this. However, --append doesn't fit cleanly, as 
a user usually wouldn't mean to append to that file in the case of error. People who, like me, have this problem can 
alias "nmap" to "nmap --no-clobber" in their shell environment.

The first and simplest option just specifies a --no-clobber switch which, when specified makes nmap stop with an error 
saying the file exists.
The second, implements wget no-clobber-like functionality where a number is appended to the end of a filename e.g. if 
foo.nmap exists write to foo.nmap.1, or if that exists foo.nmap.2 etc. I arbitrarily capped that to 99 copies at which 
point it errors out suggesting you use a different file name.

The patch files included are:
log_open_fix.patch - a bugfix for the unused append parameter
noclobber-fail.patch - the first and simpler --no-clobber implementation
noclobber-changefilename.patch - the second, more complex --no-clobber implementation

These were applied against a vanilla nmap-5.51 branch. The --no-clobber patches include the log_open patch.

Attachment: log_open_fix.patch
Description:

Attachment: noclobber-fail.patch
Description:

Attachment: noclobber-unique.patch
Description:



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

Current thread: