I do have Kali/CyanogenMod running on my phone right now, I can launch and use Metasploit but postgresql doesn't yet work so no database, it works just no db to store info thats all, maybe connecting to a db on laptop over network might work but I haven't tried it. This is not a chroot enviroment, /bin /sbin /usr /var /opt have all been added to Android's / directory and then the files that belong in them get --bind mounted, (right now I run a script when I turn on my phone for mounting, but it will be added to the init boot sequence when I get into it).
Apt-get works because the actual Linux-side directories exist on my external sdcard (a few permissions in Android's source had to be changed, then built into the rom) and then get mounted as I said before to Android's root.
The biggest issue of getting Linux binaries to run in Android's root is that, normally there is not a /lib directory with the proper /glibc (special gnu or gpl libc for embedded devices). Android uses a different clib called Bionic that gets linked to executables ( Bionic is in /system/lib I believe and linker is in /system/bin) so as I understand it, now that I have added /lib to Android, glibc based executables can now link with it via the linker in /usr/bin I believe, correct me if I am wrong).
Very few specific mods/hack to Android's source need to be done to accomplish this. I know the Kali docs have info on patching a Sumsung device with wireless injection drivers, though I am not sure if it will work with G S I/II/III. I own an S III. I need to look into this so thank you everyone for the links.
Py4A can also be extracted from its installation location (need root) to /system/xbin and if you put the libs in a good place and add PYTHON_HOME and all that, you can get python working on the command line like bash does on CM, not sure if other roms come with bash.
But as far as I know Metasploit uses Ruby, and Sl4A has JRuby and I am not sure if they are compatable. But I had to install Metasploit on my phone and the package wasnt available from Kali's repository for whatever reason, so what I did (remember I have a full distro running) was follow some instructions for compiling Ruby 1.9.3 (i think) and then using that to install Metasploit, yes, on my phone with no chroot. ( I didn't install any Desktop or gui apps for somewhat obvious reasons regarding X windows and Android's front "destop" on dalvik.) But, still no postgresql db, but u don't need a db to run Metasploit, you just can't save the nmap scans for automation, I am sure some modules require a db. As a note, Android does now have sqlite3 which I have heard is usable with Metasploit but not optimal for large scale testing, but I have yet to figure out how to use sqlite3 instead of postgresql.
In regards to getting postgresql and services like nfs-kernel-server, nfs-common, openssh, samba, cups, beef , etc etc. I think permissions for those services need to baked into Android ROMs, so I need to get off my ars and get to work.
localhost / # ls
localhost / # export HOME=/root
localhost / # cd
localhost ~ # ls
localhost ~ # which ruby
localhost ~ # echo $PATH
localhost ~ # which python
localhost ~ # which gcc
localhost ~ # which apt-get
localhost ~ # which msfconsole
localhost ~ # which aircrack-ng
localhost ~ # ifconfig wlan0 permisc
localhost ~ #
"Wise man say, 'Forgiveness is divine,
but never pay full price for late pizza'."
Some Usefull links:
// Good read on the Android specificities of the kernel
// Info on Binder and ashmem and how to share memory!