Automatic Nmap Installation

Okay, so lately we got a new Nmap version 6.25 which has better support in detecting Windows 7 services and Windows 8. For full change log at Nmap you can click here. Now, since it has not been pushed in the repository, and it can for now be updates only by SubVersion we built this for you. This will detect local Nmap version and latest Nmap version and will download the tarball, decompress it and compile it.

You can get it directly via wget from here.

#! /bin/bash

# Moving to temporary directory to prevent junking the system
cd /tmp
curr_ver=`nmap -V | grep version`
curr_ver=`echo ${curr_ver:13:4}`

# Getting new Latest Nmap version
echo ""
echo ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
echo ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
echo ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
echo ''
echo '    .__.................__......................_._.........'
echo '    / _\.___..___....../ _\.___..___._..._._.__(_) |_._..._.'
echo '    \ \./ _ \/ _ \_____\ \./ _ \/ __| |.| |  __| | __| |.| |'
echo '    _\ \  __/  __/_____|\ \  __/ (__| |_| | |..| | |_| |_| |'
echo '    \__/\___|\___|.....\__/\___|\___|\__,_|_|..|_|\__|\__, |'
echo '    ..................................................|___/.'
echo ''
echo '                 Automatic Nmap Update Script'
echo ''
echo '      Built by Yuval (tisf) Nativ of the See-Security Group'
echo ''
echo '                  http://www.see-security.com'
echo '                 http://www.hackingdefined.org'
echo ''
echo ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
echo ""

if [[ $EUID -ne 0 ]]; then
echo ''
echo 'Error:  This script must be run as root so that Nmap can be installed.' 1>&2
echo ''
exit 1
fi

echo "Getting latest Nmap Version."
wget http://nmap.org/download.html 2> /dev/null
var=`cat download.html | grep 'stable</u>--> Nmap release tarball'`
nmap_ver=`echo ${var:92:4}`
echo "Latest Nmap Version detected is $nmap_ver."
echo ""

echo "Currently installed is version $curr_ver when latest version is $nmap_ver."
echo "Do you with to continue with downloading and recompiling new source? [y/n]"
read answer

if [[ $answer == 'n' ]]; then
echo "Nothing to be done. Exiting now. "
echo ""
exit 1
fi

echo "Getting source code for Nmap $nmap_var......"
wget http://nmap.org/dist/nmap-`echo $nmap_ver`.tar.bz2 2> /dev/null
echo "Got tarball...."
tar xvjf nmap-*.tar.bz2
cd nmap-*
echo "Starting configuration and compilation. Please hold on, this might take some time."
./configure
make
sudo make install
echo "Installation all done. Please enjoy your new and updated Nmap $nmap_ver."

About The Authors

Yuval Nativ

Yuval Nativ

Yuval (tisf) Nativ is the manager of the Cyber Assualt Division of See-Security Technologies. As part of his job he is the manager of the Hacking Defined Experts program, a penetration tester, security researcher and developer. If you like to find him in our offices, just ask where Moriarty is…

Yuval Nativ

Bar Hofesh

Bar Hofesh is an Information Security Architect in Safe-T inc. and a Linux enthuhist in his spair time, between those too he also likes every thing gaming related…and Hardware..yes…hardware.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please type the characters of this captcha image in the input box

Please type the characters of this captcha image in the input box

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>