Codecademy Logo

Write Your Own Nmap Scripts

Print Cheatsheet

Lua Language

Lua is a lightweight, efficient scripting language that integrates features into other programs written in C/C++.

Lua Is Used In Nmap

Lua is used in Nmap because it is lightweight, efficient, and easily embeddable.

The Lua syntax is similar to Python

The Lua syntax is similar to Python.

Writing Nmap Script

To write a Nmap script in Lua, we create an NSE(Nmap Script Engine) file and create functions to discover information about a target.

Run Nmap Scripts

To run a Nmap script created in Lua, we must create an NSE(Nmap Script Engine) file and save it in the Nmap scripts directory.