Downloading Nmap from the official source code repository
This section describes how to download Nmap's source code from the official subversion repository. By doing so, users can compile the latest version of Nmap and keep up with the daily updates that are committed to the subversion repository.
Getting ready
Before continuing, you need to have a working Internet connection and access to a subversion client. Unix-based platforms come with a command-line client called subversion (svn). To check if its already installed in your system, just open a terminal and type:
$ svn
If it tells you that the command was not found, install svn
using your favorite package manager or build it from source code. The instructions for building svn from source code are out of the scope of this book, but they are widely documented online. Use your favorite search engine to find specific instructions for your system.
If you would rather work with a graphical user interface, RapidSVN is a very popular, cross-platform alternative. You can download and install RapidSVN from http://rapidsvn.tigris.org/.
How to do it...
Open your terminal and enter the following command:
$ svn co --username guest https://svn.nmap.org/nmap/
Tip
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.
Wait until svn downloads all the files stored in the repository. You should see the list of the added files as it finishes, as shown in the following screenshot:
When the program returns/exits, you will have Nmap's source code in your current directory.
How it works...
$ svn checkout https://svn.nmap.org/nmap/
This command downloads a copy of the remote repository located at https://svn.nmap.org/nmap/. This repository has world read access to the latest stable build, allowing svn to download your local working copy.
There's more...
If you are using RapidSVN then follow these steps:
Right-click on Bookmarks.
Click on Checkout New Working Copy.
Type
https://svn.nmap.org/nmap/
in the URL field.Select your local working directory.
Click on OK to start downloading your new working copy.
Experimenting with development branches
If you want to try the latest creations of the development team, there is a folder named nmap-exp
that contains different experimental branches of the project. Code stored there is not guaranteed to work all the time, as the developers use it as a sandbox until it is ready to be merged into the stable branch. The full subversion URL of this folder is https://svn.nmap.org/nmap-exp/.
Keeping your source code up-to-date
To update a previously-downloaded copy of Nmap, use the following command inside your working directory:
$ svn update
You should see the list of files that have been updated, as well as some revision information.
See also
The Compiling Nmap f rom source code recipe
The Listing open ports on a remote host recipe
The Fingerprinting services of a remote host recipe
The Running NSE scripts recipe
The Comparing scan results with Ndiff recipe
The Managing multiple scanning profiles with Zenmap recipe
The Generating a network topology graph with Zenmap recipe in Chapter 8, Generating Scan Reports
The Saving scan results in normal format recipe in Chapter 8, Generating Scan Reports