Nmap works on both rooted and non rooted phones. On non rooted phones you will be limited to functions which are possible as non-root user (i.e. no OS fingerprinting, SYN scan, etc).
If somebody is not paranoid that much and just wants binaries which simply work. Already compiled arm binary versions of Nmap with OpenSSL support, you can download at: https://github.com/kost/nmap-android/releases
With latest version (7.12) available at: https://github.com/kost/nmap-android/releases/tag/v7.12
Note that it is built for Android on different architectures dynamically (with very few dependencies). You should choose architecture depending on architecture of your phone (probably arm or 64-bit arm).
extract nmap-7.12-android-arm-bin.tar.bz2 to opt directory of the root of storage location. That means, for example, /sdcard/opt
mkdir -p /sdcard/opt cd /sdcard/opt tar xvjf nmap-7.12-android-arm-bin.tar.bz2
check that you have following directory structure: /sdcard/opt/nmap-7.12
As you cannot execute from sdcard by default, you have to copy nmap binaries from bin/ to somewhere where you can execute. If you did not root the Android - that probably means /data/data/jackpal.androidterm/nmap is good place as you will probably run nmap from terminal. Still, you can have data files and scripts on VFAT sdcard and you need to copy only nmap bin directory to somewhere where you have execute permissions (your phone, /sd-ext, /data/data/jackpal.androidterm depending on your type of phone/ownership, ...).
For example, on non-rooted Android you should do something like this (as cp is not possible on most of the Android phones):
mkdir /data/data/jackpal.androidterm/nmap cat /sdcard/opt/nmap-7.12/bin/nmap > /data/data/jackpal.androidterm/nmap/nmap
After that, you can run nmap:
You need to have Linux based OS, as we have tested building it on Linux only. Scripts are for building binaries for different architectures. You need to modify the build in order to compile it for other platforms.
Download android helper Makefile and patches here (for 7.12):
Extract it to Nmap dir. That means you should have android directory inside nmap directory. Go to to nmap-dir/android and run make.
You can do "make doit" which will automatically download Android NDK (~40 Mb) and build nmap. or If you have NDK already installed, you should edit android/Makefile for NDK path and run "make havendk".
Note: patches are not perfect. Some of them are kludgy until nmap devs decide how they want to proceed with patches.
Google released android-ndk-r5b which have infamous output problem fixed. Therefore, nmap android binary now works perfectly. Also, new NDK implements (almost) all C++ - therefore Crystax is not needed any more. In short, that means that build process is much simplified.
- Nmap 7.12 on Android: http://seclists.org/nmap-dev/2016/q2/268
- Nmap 6.46 on Android, blog post: http://k0st.wordpress.com/2014/08/17/nmap-6-46-on-android/
- Nmap Android on GitHub: https://github.com/kost/nmap-android
- Nmap 5.61TEST4 on Android: http://seclists.org/nmap-dev/2012/q1/135
- Nmap automatic build: http://seclists.org/nmap-dev/2011/q1/546
- Nmap on Android, initial release: http://seclists.org/nmap-dev/2010/q2/1021
- Nmap 5.61TEST4 on Android - blog post: http://k0st.wordpress.com/2012/01/12/nmap-5-61test4-on-android/