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 sectionportrule = function(host, port) return port.protocol == "tcp" and port.number == 25 and port.state == "open"end//Action sectionaction = function(host, port) return "smtp port is open"end