How to install the latest Nmap for Debian/Ubuntu
A quick & dirty script to download the latest version of nmap (sourcecode) and generate a deb and install it (so that it’s correctly in the package management). Yes, I know this is not much more than a glorified configure && make && checkinstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/bin/bash
# some packages we will need. I put nmap in here to satisfy any dependencies like LUA
apt-get -qqy install checkinstall nmap build-essential
# get latest version
URL='http://nmap.org/dist/'
FILE="$(wget -qO - ${URL}|cut -d\" -f8|grep "tar.bz2"|sort -rn|head -n1)"
INSTALLED="$(dpkg -p nmap|grep Version:|awk '{print $2}')"
echo "Installed version: ${INSTALLED}, Downloaded version: ${FILE/.tar.bz2/}"
read -p "Compile and install new version? [Y/n] " answer
if [[ ${answer,,} = "n" ]] ; then
exit 0
fi
echo "Downloading ${FILE}"
[[ -e ${FILE} ]] || wget -qO ${FILE} ${URL}${FILE}
tar -xjf ${FILE}
cd ${FILE/.tar.bz2/}
./configure
if [[ ${FILE} =~ ^nmap-6.40. ]] ; then
# fixing an error in the 6.40 ncat Makefile
sed -i 's/^LUA_LIBS.*/LUA_LIBS = $(top_srcdir)\/..\/liblua\/liblua.a -ldl -lm/1' ncat/Makefile
fi
make && \
checkinstall -y
echo -e "\n Installed nmap version:"
$(which nmap) --version
|