O'Reilly logo

Mastering the Nmap Scripting Engine by Paulino Calderón Pale

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required