Book Image

Mastering the Nmap Scripting Engine

By : Paulino Calderon
Book Image

Mastering the Nmap Scripting Engine

By: Paulino Calderon

Overview of this book

Table of Contents (23 chapters)
Mastering the Nmap Scripting Engine
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Scan Phases
Script Categories
Nmap Options Mind Map
References
Index

Chapter 9. Parallelism

NSE scripts are executed inside Lua threads (one thread per script) in parallel without developers having to explicitly define this behavior. However, the Nmap Scripting Engine (NSE) supports different mechanisms to offer finer execution control to developers who may want to work with additional threads to perform multiple network operations simultaneously. Also, NSE automatically executes network I/O operations in parallel. Execution of scripts is normally stopped when a network read task is performed and then yielded back. In order to expand or alter this behavior, we will need to use the parallelism mechanisms supported in NSE.

In this chapter, you will learn everything you need to know about parallelism when developing for NSE. This chapter covers the following topics:

  • Coroutines in Lua

  • Condition variables

  • Mutexes

  • NSE threads

  • Other Nmap options affecting parallelism during scans

Hopefully, after this chapter, you will have mastered the concepts related to parallelism...