Guide to Installing Metasploit 4 and Armitage on Mac OSX Lion
After many hours of trial and error, I have been able to put together a guide to getting Metasploit 4 and Armitage working properly on Mac OSX. I would also like to give a tremendous amount of credit to BrianCanFixIT @ Faulty Logic. His blog post on setting up Armitage helped me through the missing piece of getting the PostgreSQL database up and running properly.
- Install XCode (I am running v4.2)
- Download and Install PostgreSQL via the free GUI installer.
- Setup your root PostgreSQL password during installation.
- Launch the newly installed PGAdmin III application.
- Connect (double click) on the local PostgreSQL database and enter your root password when prompted.
- Under the PostgreSQL drop down, right click on “Login Roles”, and select “New Login Role”
- Set the role name to msfuser.
- Click on the definition tab, and set the password as msfpassword.
- Click OK to continue.
- Next, right click on the databases list, and select “New Database”.
- Set the name to metasploitdb, and set the owner to msfuser.
- Press OK, and we’re done. You can close PGAdmin.
- Download and install MacPorts from http://www.macports.org/install.php
- Good Tip: add “/opt/local” to your spotlight privacy settings to avoid excessive compile times & unnecessary indexing by spotlight.
- Quit terminal & relaunch to accept new path settings added by MacPorts
Install Ruby, RubyGems (PostgreSQL and MsgPack)
# Run as Root sudo bash # Update MacPorts port selfupdate #Install Ruby port install ruby19 +nosuffix # Install PostgreSQL gem connector (64bit Systems) env ARCHFLAGS='-arch x86_64' gem install pg -- --with-opt-include=/Library/PostgreSQL/9.1/include/ --with-opt-lib=/Library/PostgreSQL/9.1/lib/ #Install Ruby Msgpack port install msgpack #Install the gem MSGPACK gem install msgpack # Add Ruby to your path export PATH=/opt/msf3:$PATH # Ensure that /opt/local/bin appears before /usr/bin, else edit ~/.bash_profile file and source it echo $PATH
Metasploit 4 Installation
# Download Metasploit via Subversion sudo svn co https://www.metasploit.com/svn/framework3/trunk/ /opt/local/msf/ # Create a system link to the msf applications # This is done because including it in your path configuration doesn't seem to work. sudo ln -s /opt/local/msf/msf* /opt/local/bin
Configure the Metasploit Database
# Create the configuration directory sudo mkdir /opt/local/config # Create/Edit the following file sudo vi /opt/local/config/database.yml # Include the following in your database.yml file # These settings are for the database used by the Metasploit Framework # unstable tree included in this installer, not the commercial editions. # production: adapter: "postgresql" database: "metasploitdb" username: "msfuser" password: "msfpassword" port: 5432 host: "localhost" pool: 256 timeout: 5
Running Metasploit and Armitage
# Include the database location in your config export MSF_DATABASE_CONFIG=/opt/local/config/database.yml # Launch Metasploit sudo msfrpcd -U msfuser2 -P msfpassword2 -t Msg # Launch Armitage sudo armitage