Nmap 5.61TEST4 on Android

Since Fyodor released Nmap 5.61TEST4 version, I had to compile it for Android as well. 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).

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.

Download

It is available at usual location:
http://ftp.linux.hr/android/nmap/nmap-5.61TEST4-android-arm-bin.tar.bz2

Note that it is built for Android on arm architecture statically. Therefore, you should build from source if you’re using other platform than standard arm.

How you should install it?

  • extract nmap-5.61TEST4-android-arm-bin.tar.bz2 to opt directory of the root of storage location. That means /sdcard/opt
    cd /sdcard/opt
    tar xvjf nmap-5.61TEST4-android-arm-bin.tar.bz2
  • check that you have following directory structure: /sdcard/opt/nmap-5.61TEST4
    ls /sdcard/opt/nmap-5.61TEST4
  • 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-5.61TEST4/bin/nmap > /data/data/jackpal.androidterm/nmap/nmap

  • run nmap
    /data/data/jackpal.androidterm/nmap/nmap 127.0.0.1
  • Compilation

    You need to have Linux based OS, as we have tested building it on Linux only. Scripts are for building arm based binary. You need to modify the build in order to compile it for other platforms.

    Download android helper Makefile and patches here:

    http://ftp.linux.hr/android/nmap/nmap-5.61TEST4-android-src.tar.bz2

    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.

  • that’s it
  • Wiki

    I’ve made pages for Nmap on Android and Kindle on https://secwiki.org, so up-to-date information regarding these two ports you can always find there:

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

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

    Good luck and let me if it works for you!

    Advertisements

    Nmap 5.61TEST4 on Amazon Kindle

    Amazon Kindle running Nmap

    Amazon Kindle running Nmap

    Happy New Year! Since Fyodor released Nmap 5.61TEST4 version, I had to compile it for Kindle. Again, this port to Amazon Kindle was pretty straightforward (as previous ones). No source patches were needed.

    Download

    It is available at usual location:
    http://ftp.linux.hr/kindle/nmap-5.61TEST4-kindle-bin.tar.bz2

    How you should install it?

  • extract nmap-5.61TEST4-kindle-bin.tar.bz2 to opt directory of the root of storage location. That means /mnt/us/opt
    cd /mnt/us/opt
    tar xvjf nmap-5.61TEST4-kindle-bin.tar.bz2
  • check that you have following directory structure: /mnt/us/opt/nmap-5.61TEST4
    ls /mnt/us/opt/nmap-5.61TEST4
  • run nmap
    /mnt/us/opt/nmap-5.61TEST4/bin/nmap 127.0.0.1
  • Compilation

  • Download appropriate scratchbox for kindle
  • run configure

    LDFLAGS="-static" ac_cv_linux_vers=2 ./configure --host=arm-none-linux --prefix=/mnt/us/opt/nmap-5.61TEST4 --enable-static --without-zenmap --with-pcap=linux --with-liblua=included --with-libpcap=internal

    or if building with OpenSSL (you have to cross compile OpenSSL first which is different story):

    ac_cv_func_EVP_sha256=yes LDFLAGS="-static" ac_cv_linux_vers=2 ./configure --host=arm-none-linux --prefix=/mnt/us/opt/nmap-5.61TEST4 --enable-static --without-zenmap --with-pcap=linux --with-liblua=included --with-libpcap=internal --with-openssl=/mnt/us/opt/openssl-1.0.0e-s
    make
    make install
  • that’s it
  • Tips

    If you’re not familar with Nmap on Amazon Kindle or getting shell on Amazon Kindle, I would recommend to read my previous posts on Nmap on Amazon Kindle:

  • Nmap on Amazon Kindle
  • my post on nmap-dev mailing list
  • Good luck and let me if it works for you!