Nmap Development mailing list archives

Re: [PATCH] Logging (filename) extensions


From: "DePriest, Jason R." <jrdepriest () gmail com>
Date: Tue, 18 Sep 2007 16:17:07 -0500

On 9/17/07, Kris Katterjohn  wrote:
Hey everyone!

I've been using the logging options (-oA, -oX, etc.) a lot lately, and I
tend to like dates and times in the filename.

I thought it'd be cool to implement an extension to the logging options
by allowing some strftime()-like conversions for the passed filenames.

I think it would come in handy for people who do automated scans, and
also like dates/times in the filename.


The following are the same as for strftime():

%H - Hour (0-23)
%M - Minute (0-59)
%S - Second (0-60)
%m - Month (1-12)
%d - Day (1-31)
%y - Year (e.g. 07)
%Y - Year (e.g. 2007)
%% - "%"
%T - Same as "%H:%M:%S"


These are different than strftime():

%D - In strftime it's like "%m/%d/%y", here it's like "%m%d%y"
%t - In strftime it's like a <TAB>, here it's like "%H%M%S"


And if it's not a conversion character, then it'll just be that
character (e.g. %w is just w).


Examples:

-oN 'myscan-%T-%D.nmap'

gives:

myscan-19:33:13-091707.nmap

-----

-oN 'myscan-%t-%m%d.nmap'

gives:

myscan-193320-0917.nmap

-----

-oX 'myscan-%H:%M-%m%d%Y.xml'

gives:

myscan-19:34-09172007.xml

-----

-oG 'myscan-100%%.gnmap'

gives:

myscan-100%.gnmap


Please give it a try and let me know what you think!

Thanks,
Kris Katterjohn


I've been using a shell script wrapper to handle this for me.  It
would be nice to have the functionality built in.
Like you, I am wearing out the log file options and I wanted the log
files to be easily identifiable.
My script automatically calls -oA and sets the file template to
+%Y.%m.%d_%H.%M.%S-$ipaddr-nmap so I end up with files like
2007.08.30_08.44.33-10.30.4.21-nmap.gnmap
2007.08.30_08.44.33-10.30.4.21-nmap.nmap
2007.08.30_08.44.33-10.30.4.21-nmap.xml

I am not suggesting adding hostname / hostip to the filename, just
letting you know the functionality would be appreciated.  I've tried
it with multiple hosts and my script works fine with dashes, not so
much with commas.

Thanks for your work.

-Jason

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: