Preface
Nmap 6: Network Exploration and Security Auditing Cookbook is a 100 percent practical book that follows a cookbook's style. Each recipe focuses on a single task and contains command line examples, sample output, a detailed explanation, and additional tips that could come in handy.
Nmap's vast functionality is explored through nine chapters covering 100 different tasks for penetration testers and system administrators. Unlike Nmap's official book, this cookbook focuses on tasks that you can do with the Nmap Scripting Engine, without forgetting to cover the core functionality of Nmap.
There were many great NSE scripts I wish I had more space to include in this book and many more that will be created after its publication. Luis Martin Garcia recently posted an interesting video that shows how much Nmap has grown over the years at http://www.youtube.com/watch?v=7rlF1MSAbXk. I invite you to register for the development mailing list and stay up-to-date with Nmap's latest features and NSE scripts.
I hope that you not only enjoy reading this cookbook, but also that, as you master the Nmap Scripting Engine, you come up with new ideas to create and contribute to this amazing project.
Finally, don't forget that you can send me your questions and I'll do my best to help you out.
What this book covers
Chapter 1, Nmap Fundamentals, covers the most common tasks performed with Nmap. Additionally, it briefly introduces Ndiff, Nping, and Zenmap.
Chapter 2, Network Exploration, covers host discovery techniques supported by Nmap, and other useful tricks with the Nmap Scripting Engine.
Chapter 3, Gathering Additional Host Information covers interesting information gathering tasks with Nmap and its scripting engine.
Chapter 4, Auditing Web Servers, covers tasks related to web security auditing.
Chapter 5, Auditing Databases, covers security auditing tasks for MongoDB, MySQL, MS SQL, and CouchDB databases.
Chapter 6, Auditing Mail Servers, covers tasks for IMAP, POP3, and SMTP servers.
Chapter 7, Scanning Large Networks, covers tasks that are useful when scanning large networks ranging from scan optimization to distributing scans among several clients.
Chapter 8, Generating Scan Reports, covers the output options supported by Nmap.
Chapter 9, Writing Your Own NSE Scripts, covers the fundamentals of NSE development. It includes specific examples for handling sockets, output, libraries, and parallelism.
Appendix, References, covers references and official documentation used throughout this book.
What you need for this book
You will need the latest version of Nmap (available from http://nmap.org) to follow the recipes in this book.
Who this book is for
This book is for any security consultant, administrator, or enthusiast looking to learn how to use and master Nmap and the Nmap Scripting Engine.
Note
This book contains instructions on how to carry out various penetration tests such as brute force password audits on remote networks and devices. These tasks are likely to be illegal in your jurisdiction in many circumstances, or at least count as a terms of service violation or professional misconduct. The instructions are provided so that you can test your system against threats, understand the nature of those threats, and protect your own systems from similar attacks. Before following them make sure you are on the correct side of the legal and ethical line... use your powers for good!
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "The flag -PS
forces a TCP SYN ping scan."
A block of code is set as follows:
table.insert(fingerprints, { category='cms', probes={ {path='/changelog.txt'}, {path='/tinymce/changelog.txt'}, }, matches={ {match='Version (.-) ', output='Version \\1'}, {output='Interesting, a changelog.'} } })
Any command-line input or output is written as follows:
$ nmap -sP -PS80,21,53 <target> $ nmap -sP -PS1-1000 <target> $ nmap -sP -PS80,100-1000 <target>
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Click on OK to start downloading your new working copy."
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>
, and mention the book title through the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Visit this book's website (http://nmap-cookbook.com) for additional content and updates.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
Questions
You can contact us at <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.