domingo, 27 de novembro de 2011

[Shell-Script] Install Metasploit in Ubuntu for Beginner

Devido receber vários e-mails perguntando como se instala (e quando digo vários, é vários meeeesmo :S) o metasploit no ubuntu, resolvi fazer rapidamente este script para tal fim.
É eu sei que o código tem bugs, mais ao que se propõe ele cumpre. :D
Testado nas versões 11.04 e 11.10.



#!/bin/bash

clear
echo
echo
echo "         ..:[ Install MSF ]:.."
echo
echo "        Roberto Soares (espreto)"
echo "        robertoespreto@gmail.com"
echo
echo
echo "[+] Install the Metasploit Framework on Ubuntu Linux now? y/n "; read whx
   if [ $whx = "y" ]
   then
      echo
      echo "[+] Installing the Ruby dependencies..."
      apt-get install -y ruby libopenssl-ruby libyaml-ruby libdl-ruby libiconv-ruby libreadline-ruby irb ri rubygems 1> /dev/null 2> /dev/stdout
      echo "OK!"
      echo "[+] Installing the Subversion client..."
      apt-get install -y subversion 1> /dev/null 2> /dev/stdout
      echo "OK!"
      echo "[+] Installing extensions (pcaprub, lorcon2, etc)..."
      apt-get install -y build-essential ruby-dev libpcap-dev 1> /dev/null 2> /dev/stdout
      echo "OK!"
      echo "[+] Download framework..."
      echo
      wget -c http://downloads.metasploit.com/data/releases/framework-latest.tar.bz2
      echo "[+] Unpacking the file..."
      tar -jxvf framework-latest.tar.bz2 1> /dev/null 2> /dev/stdout
      mkdir -p /opt/metasploit
      cp -a msf/ /opt/metasploit/msf3
      chown root:root -R /opt/metasploit/msf3
      ln -sf /opt/metasploit/msf3/msf* /usr/local/bin/
      rm -rf msf/
      echo "OK!"
      echo
      echo "   CONGRATULATIONS! Install Metasploit Successful!!!"
   else
      echo     
      echo "Why?"
      echo "  You do not know what you're missing!"
      echo
      exit 0;
   fi
echo

echo "[+] Update now? y/n "; read whx
   if [ $whx = "y" ]
   then
      echo "   Wait..."
      msfupdate 1> /dev/null 2> /dev/stdout
      echo "   OK!"
   else
      echo "     Future use in the terminal: msfupdate"
   fi
echo
echo "[+] Install PostgreSQL Database now? y/n "; read whx
   if [ $whx = "y" ]
   then
      echo "   Wait..."
      apt-get install -y postgresql-8.4 rubygems libpq-dev 1> /dev/null 2> /dev/stdout
      gem install pg 1> /dev/null 2> /dev/stdout
      apt-get install -y libreadline-dev libssl-dev libpq5 ruby-dev 1> /dev/null 2> /dev/stdout
      echo "   OK!"
      echo
      echo "1º Choice a username (user for connect in database):" ; read username
      sudo -u postgres createuser -D -A -P $username
      echo "   Done!"
      echo
      echo "2º Choice a database name (that will be used by msf):" ; read db_name
      sudo -u postgres createdb -O $username $db_name
      echo "   Done!"
      echo
      echo "        Connect to the postgreSQL database in msfconsole using:"
      echo "             msf> db_driver postgresql"
      echo "             msf> db_connect $username:password@127.0.0.1/$db_name"
      echo "             msf> db_status"
      echo
      sleep 8
   fi
clear
echo
echo "     Installation Complete!"
echo "  In terminal, run: msfconsole"
echo
echo
echo "         Good bye!"
echo
# end script


:wq!

Um comentário:

  1. Boa Noite.

    - Interessante essa Shell Obrigado por compartilhar,estou mesmo querendo saber como personalizo saida do MSF, arte ASCII?

    []'s

    ResponderExcluir

To get the latest update of me and my works

>> <<