Nmap Development mailing list archives

Re: [PATCH] nmap-service-probes: Misc database corrections, printer additions


From: David Fifield <david () bamsoftware com>
Date: Mon, 13 Jul 2009 09:58:29 -0600

On Mon, Jul 13, 2009 at 08:18:20AM -0700, Aaron Leininger wrote:
The name "msg" is too general for the script arg name. Maybe it can be
pjl.ready-message or pjl-ready-message.message. Those are a bit long,
but it should be something that identifies it as belonging to this
script.

In trying to incorporate a variable name like yours I am getting a very weird result and I am hoping someone can shed 
some light on this for me. I noticed that any attempt at using a hyphen in a variable name results in the script 
doing nothing, whether or not I provide an argument to the script....

ex from my script: if not nmap.registry.args.pjl-msg then

You have to do it like this:
        nmap.registry.args["pjl-msg"]

Same if the argument name has dots in it, the dots go inside the quotes.

If I use pjl-msg as the variable instead of msg like I had before(no other changes to the script), I get the 
following output (w/ --script-trace on)

=========
$nmap -p9100 --script-trace --script=./hprdymsg.nse printerip

Starting Nmap 4.85BETA10 ( http://nmap.org ) at 2009-07-13 08:08 PDT
Warning: File ./nselib/ exists, but Nmap is using /usr/local/share/nmap/nselib/ for security and consistency reasons. 
 set NMAPDIR=. to give priority to files in your local directory (may affect the other data files too).
NSOCK (0.2090s) nsock_loop() started (timeout=50ms). 0 events pending
Interesting ports on printername (printerip):
PORT     STATE SERVICE
9100/tcp open  jetdirect

Nmap done: 1 IP address (1 host up) scanned in 0.21 seconds
=========
Notice the distinct lack of any output from the script...

Always run with -d when you are working on a script. That will give you
a traceback to where the error was.

$ ./nmap --script=hprdymsg localhost -d
...
NSE: Starting hprdymsg against 127.0.0.1:9100.
NSE: hprdymsg against 127.0.0.1:9100 threw an error!
./scripts/hprdymsg.nse:20: attempt to perform arithmetic on a boolean value
stack traceback:
        ./scripts/hprdymsg.nse:20: in function <./scripts/hprdymsg.nse:16>
        (tail call): ?

Here you can see that it's interpreting the dash as a subtraction.

David Fifield

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


Current thread: