An NSE script requires at least the following fields:
Description: This description is read by the
--script-help
Nmap option and is used in the documentation.Categories: This field defines the script category used when selecting scripts. For a list of available categories, see Appendix C, Script Categories.
Action: This is the main function of the NSE script that gets executed on selection.
Execution rule: This defines when the script is going to run. See Chapter 1, Introduction to the Nmap Scripting Engine, for some examples of execution rules.
Note
For a complete list of categories, see Appendix C, Script Categories.
Other available fields describe topics such as licensing, dependencies, and categories. These fields are optional, but I highly encourage you to add them to improve the quality of your script's documentation.