Parallelism mechanisms in NSE
When developing NSE scripts that perform operations in parallel, you don't need to worry about protecting memory resources because Nmap is single-threaded. However, network resources such as sockets or network bandwidth do need to be considered if we are working with a large number of script instances.
NSE threads
The stdnse
NSE library supports the creation of NSE threads that can run inside your script's Lua thread, and performs network operations in parallel.
The stdnse.new_thread()
function creates a new NSE thread. This function takes as the first parameter the function to execute in the new thread and, optionally, the arguments needed for the worker thread's main function. To create an NSE worker, you must load ...
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.