Nmap Development mailing list archives

Re: Output w/ date/time variables?


From: Brandon Enright <bmenrigh () ucsd edu>
Date: Thu, 8 Apr 2010 18:05:54 +0000

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

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


Norris, my batch/cmd scripting is terribly rusty however doesn't %val
have special meaning in batch scripts?  Have you tried anything like
%%D%%T?  A quick perusal of Google results suggest that ^ might be the
escape char.

If you are stuck on Windows you should think about using PowerShell for
your scripting needs rather than cmd scripts.

Brandon

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)

iEYEARECAAYFAku+GwMACgkQqaGPzAsl94JExwCfZgsjWXMd2UMXJoERU7zNPr26
kDYAn1hRBV5NosZwFTHw1knQ/KOMBsY9
=9emA
-----END PGP SIGNATURE-----
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: