Nmap Development mailing list archives

Re: How do I test differing ports within my NSE script?


From: Tom Sellers <nmap () fadedcode net>
Date: Tue, 14 Sep 2010 20:25:16 -0500

On 9/14/10 2:43 PM, Bob Radvanovsky wrote:
One thing that I've noticed is that the NSE scripts appear to target either ONE port, or a grouped number of ports 
for a specific service (such as "SMB", for example).

Well, as a general rule each (non-host) script is invoked for a particular port if
that port meets the script's portrule requirements.  The scripts, unless coded otherwise,
only really act on the port they were invoked against.  The coder can toss traffic
at other ports or hosts, but this is not a default action.  For example one script
invocation won't hit both port 80 and 8080.  It is called once, independently, for
each.



If I am performing either enumeration and/or validation testing against an appliance that has differing services 
available (such as the most common of ports 80/443 [web/secured web] on TCP and 161 [snmp] on UDP, how can I
incorporate that into a given NSE script?

If you wish for a script to be called against several different ports you can
handle this in the portrule.  Keep in mind that script is called once independently
for each port.  You can get save data to be used by the script during all invocations
but I will leave that topic to someone more versed on the topic.

Hopefully you found this helpful.  If I misunderstood what you are asking or trying
to accomplish please don't hesitate to toss another email at the list.

Tom Sellers





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


Current thread: