Skip to content

Instantly share code, notes, and snippets.

@leesoh
Last active August 20, 2023 13:34
Show Gist options
  • Save leesoh/83721305357164b17c01ec1bb124ecd1 to your computer and use it in GitHub Desktop.
Save leesoh/83721305357164b17c01ec1bb124ecd1 to your computer and use it in GitHub Desktop.
Installing Metasploit Framework on Ubuntu-based system

Metasploit Install

Install Prerequisites

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

Clone Metasploit

Clone repo

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

Set up symlinks

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

Install RVM

Get the signing key

$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
$ \curl -sSL https://get.rvm.io | bash -s stable

Get RVM

curl -L https://get.rvm.io | bash -s stable

Configure terminal to use RVM's version of Ruby

source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
cd /opt/metasploit-framework
rvm --install .ruby-version

Install Bundler

gem install bundler

Install Bundled Gems

$ cd /opt/metasploit-framework
$ bundle install

Configure Postgre SQL

$ sudo -s
$ su postgres
$ createuser msf -P -S -R -D
$ <password>
$ createdb -O msf msf
$ exit
$ exit

Configure Metasploit

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

# Add the following
production:
 adapter: postgresql
 database: msf
 username: msf
 password: <password>
 host: 127.0.0.1
 port: 5432
 pool: 75
 timeout: 5

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment