This is the core API that allows scripts to obtain host and port information such as name resolution, state, version detection results, Mac address, and more (if available). It also provides the interface to Nsock
, Nmap's socket library, which will be covered in Chapter 8, Working with Network Sockets and Binary Data.
The arguments passed to the main action function consist of two Lua tables corresponding to host and port information. The amount of information available depends on the options used during the scans. For example, the host.os
table will show nothing if the OS detection mode (-O
) was not set.