In this chapter, you learned all about performing connection-oriented and advanced network I/O operations with NSE sockets. Raw packet manipulation can be complex but, as we have seen, it is very straightforward in NSE. By now, you should be able to write scripts that communicate with other hosts with the help of the Nmap API and the bin
and packet
NSE libraries. Try writing a script that communicates with an unsupported protocol to put in practice the topics covered here.
Next, you will learn about parallelism in Lua and NSE to achieve collaborative multitasking. The objective of the following chapter will be to give you the tools needed to control the execution flow of worker threads inside your NSE scripts, but don't start thinking about threads yet. Lua coroutines are different from threads in preemptive multitasking. Keep on reading to learn these differences and how they can help your scripts.