Appendix B. NSE Script Template

This appendix includes an NSE script template that contains the required script fields scripts and the default licensing values:

description = [[
]]

---
-- @usage
-- 
-- @output
--
-- @args
--
---

author = ""
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {}

--portrule = 

action = function(host, port)

end

This template is available online in my GitHub repository, at https://github.com/cldrn/nmap-nse-scripts/blob/master/nse-script-template.nse.

Other templates online

The Nmap distribution also includes a pretty complete template made by Ron Bowes. It can be downloaded from a previous working copy of the development repository, at https://svn.nmap.org/nmap/docs/sample-script.nse?p=30373

Get Mastering the Nmap Scripting Engine now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.