#Install Java Seperate (may give error)

apt-get update
apt-get upgrade


sudo apt-get install build-essential libreadline-dev libssl-dev libpq5 libpq-dev libreadline5 libsqlite3-dev libpcap-dev openjdk-7-jre git-core autoconf postgresql pgadmin3 curl zlib1g-dev libxml2-dev libxslt1-dev vncviewer libyaml-dev curl zlib1g-dev nmap

### Loop as root and user

cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc


# run command as user and sudo so plugin can run Metasploit as root too "rbenv sudo msfconsole"
git clone git://github.com/dcarley/rbenv-sudo.git ~/.rbenv/plugins/rbenv-sudo


exec $SHELL

rbenv install 2.3.3
rbenv global 2.3.3
ruby -v
##End Loop



##Configure Postgres

sudo -s
su postgres


createuser msf -P -S -R -D
createdb -O msf msf
## exit out of postgresql account
exit
## exit out of root account back to user priv
exit
### Install Framework (not root)

cd /opt
sudo git clone https://github.com/rapid7/metasploit-framework.git
sudo chown -R `whoami` /opt/metasploit-framework
cd metasploit-framework


## Install gems
gem install bundler
bundle install

#### run it

./msfconsole



####################### # # Custom Payloads #######################
download sdk only for linux here:
http://developer.android.com/sdk/index.html#Other
wget (latest-in-url-above).tgz
cd Sdk/tools/
./android update sdk -u
## android update sdk --no-ui --obsolete --force (for dev payloads)
cd ../..

download the ndk
http://developer.android.com/ndk/downloads/index.html
wget (latest-in-url-above).bin

chmod a+x (archive).bin
./(archive).bin

apt-get install maven2
apt-get install openjdk-6-jre-headless
apt-get install ia32-libs

### IN Metasploit#
set ExitOnSession false
exploit -j