Book Image

NMAP Essentials

By : David Shaw
Book Image

NMAP Essentials

By: David Shaw

Overview of this book

Table of Contents (17 chapters)
Nmap Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 7. Writing Nmap Scripts

Now that we have covered how the NSE works, it's time to learn how to write our first Nmap script. Because of the versatile and extremely customized nature of writing Nmap scripts, there are several different ways to produce a script that performs various functions—and also many pros and cons to write your own script.

While creating an Nmap script from scratch may not always be the fastest way to get things done (as there is almost always a script that already exists for whatever purpose you may need), there are certain situations during which leveraging the powerful built-in functions of the Nmap scripting engine leads to exactly the right circumstances to write your own script.

In this chapter, we will cover the following topics:

  • The anatomy of an Nmap script

  • Writing the Nmap script's head

  • Creating a rule

  • Defining a script's action

  • Debugging Nmap scripts