Skip to content

Instantly share code, notes, and snippets.

@TomSellers
Last active January 4, 2023 07:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save TomSellers/9ad59588ca0436f2192a90437a660dcf to your computer and use it in GitHub Desktop.
Save TomSellers/9ad59588ca0436f2192a90437a660dcf to your computer and use it in GitHub Desktop.
Building Nmap from GitHub
If you are looking to build Nmap from GitHub and/or test pull requests you can
use the instructions below. Note that they are not tailored towards those who
will be modifying the code or creating pull requests themselves.
Note: The Nmap GitHub repository is a mirror of the official Nmap Subversion
repository which is considered the 'source of truth' for the Nmap
codebase.
Getting the code
1. Clone the official repository
git clone git@github.com:nmap/nmap.git
2. Change to the nmap directory
cd nmap
3. Configure git to pull down PR information when you fetch a branch listing
for the Nmap repo by adding the following line to the 'remote "origin"'
section of .git/config:
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
It should look something like this:
[remote "origin"]
url = git@github.com:nmap/nmap.git
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
4. Update your branch listing
git fetch --all
5. Check out the pull request you are interested in:
git checkout origin/pr/<PR_number>
git checkout origin/pr/977
Building the code
1. Install any build dependencies. On Ubuntu I use the following:
sudo apt-get install build-essential autoconf libssl-dev
2. To build nmap make sure you are in the top level nmap source directory
and run the following:
./configure --without-zenmap
make clean
sudo make install
3. As a matter of precaution I generally insruct Nmap to rebuild
the script database after a fresh build/installation.
sudo nmap --script-updatedb
As a general reference for building Nmap from the official Subversion repository
I created instructions at the link below. This page includes a variation of the
script that I use to enure I have a clean environment as well as to copy any
custom scripts that I might be working on.
https://github.com/TomSellers/Fathom/wiki/Installing-Nmap
@lordthundera
Copy link

Hi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment