Nmap Development mailing list archives

Re: warning message when overwriting output files


From: Robin Wood <robin@digi.ninja>
Date: Wed, 12 Nov 2014 22:01:06 +0000

On 12 November 2014 21:26, Daniel Miller <bonsaiviking () gmail com> wrote:
I recall having a conversation once about a potential output file
rotation feature. It seems like this could be a related problem, in
that it involves rewriting file names. If we can decide on a good
notation, then this could be used in both cases. Maybe adding another
percent-escaped value for "incrementing ID" such that -oN
example-%n.nmap would create example-0.nmap on the first run,
otherwise it would write example-1.nmap or whatever is one higher than
the highest currently-named file in the output directory. This would
be an easy way to guarantee you never clobber output.

I think that is a useful feature but then we have to remember to put
the %n on the filename and seeing as I missed overwriting the files I
might miss this as well.

I realise this is protecting against human mistakes so feel free to
reject my initial idea.

Nmap does not have an rcfile capability right now, though Jacek did a
little work in that direction, IIRC.

It would be nice to be able to set them to do things like full scans,
check for live hosts and stuff then just do

nmap --rc check_live.rc -iL hosts

You could then add the option to not overwrite into these and forget about it.

Robin

Dan

On Wed, Nov 12, 2014 at 2:08 PM, Robin Wood <robin@digi.ninja> wrote:
I think appending something if the file already exists would be best but it
may mess up people who expect the overwrite in scripted jobs.

Renaming could work as well.

I should know this but is there any way to have a resource file for nmap?
That would be a good way to handle this, the default is overwrite but a
config setting would say rename or change output name as appropriate. A lot
of work for this feature but I can think of a lot of other use cases for the
feature.

Robin

On 12 Nov 2014 19:42, "Daniel Miller" <bonsaiviking () gmail com> wrote:

On Mon, Nov 10, 2014 at 11:37 AM, Robin Wood <robin@digi.ninja> wrote:
It would be good to have a warning when a scan which does outputs
(-o?) is going to overwrite existing files. I've just managed to lose
a load of work when I switched from TCP to UDP and forgot to change
the filename.


Robin,

That sounds like a good idea. How would you expect it to act? We don't
have any other interactive features, so asking for confirmation would
be a departure from our usual way of doing things. We could also just
append to the filename if it exists, or copy the old one to X.orig, or
something.

For future reference, I usually avoid this problem by including %T in
my output filename to include the timestamp, so unless I do two scans
within a second of each other, there's no clobbering.

Dan
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: