Exploit This

Security News, Exploits, and Vulnerabilities.

How to install Metasploit on Macbook Pro Yosemite 10.10.3

I recently installed Metasploit on a MacBook Pro running Yosemite 10.10.3. Most of the information I found online was outdated so I thought it would be a good idea to create this post.

Before you can begin the installation of metasploit you need to have the Xcode Command line tools installed.

xcode-select —install

You also need to have the latest Java SE JDK installed.

java -version

If you do not have the latest version you can download and install it from here

You also need to have the latest version of Homebrew installed. To learn more about what Homebrew is please visit brew.sh.

The command to install Homebrew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

When you install Homebrew you need to update your PATH.

echo PATH=/usr/local/bin:/usr/local/sbin:$PATH >> ~/.bash_profile
source ~/.bash_profile
brew tap homebrew/versions

We can now install NMAP using Homebrew.

brew install nmap

libxml2 is needed

brew install libxml2

PostgreSQL is needed

brew install postgresql —without-ossp-uuid

The PostgreSQL Configuration

Initialize the database:

initdb /usr/local/var/postgres

Set up the database to start after a user logs in

mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.4.2/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

( replace 9.4.2 with the version you have installed )

Create the database for metasploit.

createuser meta -P -h localhost
createdb -O meta meta -h localhost

Clone and install Metasploit.

cd /usr/local/share/
git clone https://github.com/rapid7/metasploit-framework.git
cd metasploit-framework
for MSF in $(ls msf*); do ln -s /usr/local/share/metasploit-framework/$MSF /usr/local/bin/$MSF;done
sudo chmod go+w /etc/profile
sudo echo export MSF_DATABASE_CONFIG=/usr/local/share/metasploit-framework/config/database.yml >> /etc/profile

Install Nokogiri Gem

bundle config build.nokogiri "--use-system-libraries —with-xml2-include=/usr/local/opt/libxml2/include/libxml2"

Install PG Gem

sudo env ARCHFLAGS="-arch x86_64" gem install pg

In the metasploit folder, use bundle to install the remaining gems.

sudo bundle install

Create the Metasploit Database Configuration

vim /usr/local/share/metasploit-framework/config/database.yml

Paste the following text:

production:
 adapter: postgresql
 database: meta
 username: meta
 password: passwordgoeshere
 host: 127.0.0.1
 port: 5432
 pool: 75
 timeout: 5

Now update your environment:

source /etc/profile
source ~/.bash_profile

You are now ready to run Metasploit

msfconsole

Leave a Reply

%d bloggers like this: