Nmap 6.46 on Android

August 17, 2014

I’ve just cross compiled Nmap 6.46 on Android since I did not do it for a while. If you just need binary, it’s here:

http://ftp.linux.hr/android/nmap/nmap-6.46-android-arm-bin.tar.bz2

If you need details, go here:

https://secwiki.org/w/Nmap/Android

Building Nmap from source (without SSL)

If you want to build it from the source, process is pretty straightforward:

git clone https://github.com/kost/nmap-android.git

cd nmap-android

cp -a android ~/src/nmap-6.46/

cd ~/src/nmap-6.46/android

#(adjust paths if needed in Makefile)

make doit



Building Nmap from source (with OpenSSL)

I see many people try to cross compile Nmap with OpenSSL support. Since, I did not specify OpenSSL part of cross compiling, I see there’s lot of complicated ways people do it. For example, like Gorjan Petrovski here:

http://blog.umitproject.org/2012/05/cross-compilation-of-static-nmap-with.html

In short, compiling of whole Android tree is not necessary. You just need to use same compiler for everything. I’m assuming you have NDK installed and standalone toolchain in PATH.

For building zlib, I’m using following snippet:



export CCARCH=arm-linux-androideabi

CC="${CCARCH}-gcc" ./configure --prefix=/sdcard/opt/zlib-1.2.8

make

make install



For building OpenSSL, I’m using following snippet:



export CCARCH=arm-linux-androideabi

./Configure dist --prefix=/sdcard/opt/openssl-1.0.1i

make CC="${CCARCH}-gcc" AR="${CCARCH}-ar r" RANLIB="${CCARCH}-ranlib" LDFLAGS="-static"

make install



For building Nmap, I’m using following snippet:



git clone https://github.com/kost/nmap-android.git

cd nmap-android

cp -a android ~/src/nmap-6.46/

cd ~/src/nmap-6.46/android

#(YOU have to EDIT makefile to adjust NDK and OpenSSL paths)

make havendk



Note: If you plan to compile OpenSSL support, you need to edit Makefile before issuing make havendk in order to specify OpenSSL path.

You should have binaries in place after build. You can strip them and transfer to your Android device.