Nmap Development mailing list archives

Re: Output w/ date/time variables?


From: "Norris Carden" <ncarden () ascendfcu org>
Date: Thu, 8 Apr 2010 13:01:48 -0500

I am having trouble getting these arguments to work in Windows. I can make them work live from the command prompt, but 
not if run from a .cmd or .bat file.

Here's what I'm trying:

"c:\program files\nmap\nmap.exe" -sP -PE -iL c:\nmap\input.txt -oA "c:\nmap\testing%D%T"

If run from the command prompt, the output file is named testing040810124758
If run from a .cmd or .bat file, the output file is named testingT
I even removed the %T and got testingD

I don't understand why the arguments work at the command prompt but not from a .bat or .cmd file. Windows obviously 
interprets the commands differently from different sources.

So I will probably have to follow the example at 
http://highsecurity.blogspot.com/2009/02/simple-tcp-udp-continous-monitoring.html then this series of commands...

set yymmdd=%date:~10,4%%date:~4,2%%date:~7,2%
set hhmm=%time:~0,2%%time:~3,2%
nmap x.x.x.x -oA nmaptest-%yymmdd%-%hhmm%

... gives me the output with files named nmaptest-20100408-1208 and is satisfactory.

Norris Carden
 
-----Original Message-----
From: nmap-dev-bounces () insecure org [mailto:nmap-dev-bounces () insecure org] On Behalf Of jah
Sent: Thursday, April 08, 2010 9:41 AM
To: nmap-dev () insecure org
Subject: [BULK] Re: Output w/ date/time variables?
Importance: Low

On 08/04/2010 15:19, Norris Carden wrote:
Is there a way to have Nmap output to a filename that includes variables
of date and time in the filename?

 

-oA %yymmddhhmm%filename
  
Yes there is - from http://nmap.org/book/man-output.html:

"All of these arguments support |strftime|-like conversions in the
filename. |%H|, |%M|, |%S|, |%m|, |%d|, |%y|, and |%Y| are all exactly
the same as in |strftime|. |%T| is the same as |%H%M%S|, |%R| is the
same as |%H%M|, and |%D| is the same as |%m%d%y|. A |%| followed by any
other character just yields that character (|%%| gives you a percent
symbol). So |-oX 'scan-%T-%D.xml'| will use an XML file in the form of
|scan-144840-121307.xml|."

jah



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


Current thread: