Wednesday, January 4, 2017

installing metasploit framework on debian 8 or ubuntu 14+


installing the metasploit on debian isn't Difficult

this guide is very simple

first setup you need to update your system with apt-get:

$ sudo apt-get update
$ sudo apt-get upgrade


now you should install the dependent packages for matasploit

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


now you gonna Installing Ruby using RVM

RVM stands for Ruby Version Manager. Which provides efficient way to install and manage ruby version independently. Install latest stable version of RVM on your system using following command. This command will automatically download all required files and install on your system.

$ cd
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
$ curl -L https://get.rvm.io | bash -s stable
$ source ~/.rvm/scripts/rvm
$ echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
$ source ~/.bashrc
$ RUBYVERSION=$(wget https://raw.githubusercontent.com/rapid7/metasploit-framework/master/.ruby-version -q -O - )
$ rvm install $RUBYVERSION
$ rvm use $RUBYVERSION --default
$ ruby -v
$ gem install rails
$ rails -v



install nmap


you should have nmap for scanning network to install it go here

Configuring Postgres SQL Server

We start by switching to the postgres user so we can create the user and database that we will use for Metasploit

$ sudo -s
# su postgres



Now we create the user and Database, do record the database that you gave to the user since it will be used in the database.yml file that Metasploit and Armitage use to connect to the database

# createuser msf -P -S -R -D
# createdb -O msf msf
# exit
# exit



Installing Metasploit Framework

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



Install using bundler the required gems and versions:

$ cd metasploit-framework
$ rvm --default use ruby-${RUByVERSION}@metasploit-framework
$ gem install bundler
$ bundle install



Lets create the links to the commands so we can use them under any user and not being under the framework folder:

$ cd metasploit-framework
$ sudo bash -c 'for MSF in $(ls msf*); do ln -s /opt/metasploit-framework/$MSF /usr/local/bin/$MSF;done'



Lets create the database.yml file that will contain the configuration parameters that will be use by framework:

$ sudo nano /opt/metasploit-framework/config/database.yml


Copy the YAML entries and make sure you provide the password you entered in the user creating step in the password field for the database

production:
adapter: postgresql
database: msf
username: msf
password: yourmsfpassword
host: 127.0.0.1
port: 5432
pool: 75
timeout: 5



Create and environment variable so it is loaded by Armitage and by msfconsole when running and load the variable in to your current shell:


$ sudo sh -c "echo export MSF_DATABASE_CONFIG=/opt/metasploit-framework/config/database.yml >> /etc/profile"

$ source /etc/profile



First Run

$ msfconsole

0 comments:

Post a Comment