The following are the environment variables used in preparing an Nmap script:
- SCRIPT_PATH: This describes the path of the script
- SCRIPT_NAME: This describes the name given to the script
- SCRIPT_TYPE: This variable is used to describe the type of rule which has invoked by the script for a remote host
The following is a structure of a simple Nmap script:
//Rule section
portrule = function(host, port)
return port.protocol == "tcp"
and port.number == 25
and port.state == "open"
end
//Action section
action = function(host, port)
return "smtp port is open"
end