Nmap, wireshark, and other programs use Lua as a scripting language to enable users to extend the functionality of the program. Seems that Lua is very popular in security programs. As popular as Tcl in the hospital environment.
This is the nmap scripting chapter from the nmap book;
From the link:
The Nmap Scripting Engine (NSE) is one of Nmap's most powerful and flexible features. It allows users to write (and share) simple scripts to automate a wide variety of networking tasks. Those scripts are then executed in parallel with the speed and efficiency you expect from Nmap. Users can rely on the growing and diverse set of scripts distributed with Nmap, or write their own to meet custom needs.
In the end, Lua excelled in all of our criteria. It is small, distributed under the liberal MIT open source license, has coroutines for efficient parallel script execution, was designed with embeddability in mind, has excellent documentation, and is actively developed by a large and committed community. Lua is now even embedded in other popular open source security tools including the Wireshark sniffer and Snort IDS.
Here is a link to a pdf that discusses extending both nmap and wireshark:
This is a video presentation of the lua interface in nmap by David Fifield:
The Nmap scripting engine
David had been the maintainer of the scripting engine for two years when that video was made.
And "Mastering The Nmap Scripting Engine (Blackhat 2010)" Video:
Learning the Lua LanguageThis is a general tutorial for the language:
From the link:
This tutorial is aimed at all newcomers to the language Lua. We start off with where to find relevant introductory material and then progress to using the language with tutorials in the TutorialDirectory. The style is directed at newcomers to scripting languages, as well as newcomers to Lua. Common uses of Lua are:
- A configuration language for applications.
- A standalone scripting language.
- An embedded language in applications to modify runtime behavior.
There is a link from the above overview to a list of very good, detailed tutorials here:
You can also do functional programming in Lua using lisp like structures
And is one of the few languages to support the power of closures:
The complete language reference is available from here:
And that Lua language book is available from the languages main web site: