Export to GitHub

anmap - Build.wiki


How-to build new version

sketch

Compile from source

With Debian and ConnectBot or adb shell right on your device: ``` $ su

bootdebian

cd /usr/src

wget http://nmap.org/dist/nmap-5.59BETA1.tar.bz2

bzip2 -cd nmap-5.59BETA1.tar.bz2 | tar xvf -

cd nmap-5.59BETA1

./configure --enable-static --without-nping --without-zenmap --without-ndiff --without-liblua --without-ncat

make static

Or use this Makefile [nmap.android](http://anmap.googlecode.com/svn/branches/nmap.android) $ su

bootdebian

cd /usr/src

wget http://nmap.org/dist/nmap-5.59BETA1.tar.bz2

wget http://anmap.googlecode.com/svn/branches/nmap.android

bash nmap.android

```

Now, you have compiled nmap, try to strip it: ```

cp nmap nmap.not_stripped

ls -la nmap

strip nmap

ls -la nmap

```

And try to scan: ```

./nmap localhost

```

Android GUI Wrapper

related:

http://code.google.com/p/anmap/'>code.google.com

http://code.google.com/p/androidterm/'>androidterm

http://code.google.com/p/cidrcalculator/source/browse/trunk/src/us/lindanrandy/cidrcalculator/Converter.java'>cidrcalculator/..blabla../Converter.java

https://github.com/rorist/android-network-discovery'>android-network-discovery

http://code.google.com/p/connectbot/'>connectbot

Details

1.Daemon jobs class:

SIGNALL's,
kill
-HUP
-9
etc

Universal class to start/stop/restart/reload config/etc for any daemons from sshd to apache.

2.Content(main.xml):

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Enter target:"/>
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/label"
android:text="nmap" />
<EditText
android:id="@+id/entry"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:layout_toRightOf="@id/button"
android:layout_below="@id/label"/>
</RelativeLayout>

3.Edit: nmap flags & target


big christmass tree button, you push it and look at tcp packets with rather flags fly from left to right side of you mobile device monitor.
from right to left...
etc..

4.Button: start nmap

final Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Toast.makeText(v.getContext(), "Start scanning...\n" + cmd , Toast.LENGTH_SHORT).show();
// Scanning!
Toast.makeText(v.getContext(), "Scanning finished!\n", Toast.LENGTH_SHORT).show();
}
});

5.Get output(like connectbot)

http://code.google.com/p/connectbot/'>connectbot


6.Get root right

http://www.google.com/search?btnG=1&pws=0&q=request+root+access+android'>http://www.google.com/search?btnG=1&pws=0&q=request+root+access+android

http://www.stealthcopter.com/blog/2010/01/android-requesting-root-access-in-your-app/'>http://www.stealthcopter.com/blog/2010/01/android-requesting-root-access-in-your-app/


public static String runRootCommand(String cmd) {
String output = "";
Process process = null;
DataOutputStream os = null;
try {
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes(cmd + "\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
} catch (Exception e) {
String msg = "Unexpected error: " + e.getMessage();
Log.d("*** DEBUG ***", msg);
return msg;
}
finally {
try {
if (os != null) { os.close(); }
process.destroy();
} catch (Exception e) {
// nothing
}
}
return output;
}

7.Button(Menu): Help

Man page / ( nmap -h ) / some doc or links

8.Button(Menu): Bug report/Test how it doing


(Verbose, Sillent)

Button(internal): Send bug report.


try to send me email - bug report with full debug log of root/unroot scanning, and other info, such as:
1. all system data: set, env, root_dir, sdcard_dir, file systems, phone generation, os version etc.
2. md5,sha256 of current unpacked apk release.
3. result of scanning some special targets.(some tower wich will log it) + timestamp


9.Button(Menu): Journal

history by ips/domain-names located on sdcard. When you try again any ip, you can get diff highlighted on old scan log "+"/"-" new/old line.
Some cool format to contain this diff in long time.
with all things

10.Monitor mode(like iftop, nload, nethogs, ipstate, trafshow) (probably, stand alone app)

Network discovery.

Check every ip/arp connection(OS, bytecount in/out, proto).

View in real time state netland, like a top(UNIX).

(by getting headers wireshark/tcpdump)

(by current network settings)

(by nmap -O -iL current_ip_list)

(by mac address, etc, create some profile and monitoring this machine that you have to contact)