Chapter 8. Working with Network Sockets and Binary Data

Most NSE scripts need to communicate to other hosts to read or write data. Lua supports native network I/O operations, but there are several advantages to using the interfaces and libraries provided by the Nmap Scripting Engine (NSE). NSE sockets can be programmed as blocking or non-blocking I/O operations, and they support a connect-style method (when a client opens a connection, sends or receives data, and closes the connection) and low-level raw packet handling via a packet capture interface.

Nsock (http://sock-raw.org/nmap-ncrack/nsock.html) is an Nmap library designed to help developers handle parallelizable network I/O operations. It is used by the service detection engine, in DNS operations ...

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.