Armitage is a new GUI for Metasploit, which is very interactive and makes hacking or like white-hats call it pen-testing real easy.
To install Armitage, all you have to do is download it and run it on Linux using the following command:
The reason I’m writing this blog is that while trying to run it with Metasploit and MySQL, I came across two errors and it took me a while to find the answers.
I was trying to install Armitage on Backtrack4, not 4r2 version for which the instructions are available here.
So the first error i was getting was when installing the gem mysql. The gem is required if you want to use MySQL database. When I tried installing the gem in Metasploit itself or in shell I was getting the following error:
ERROR: could not find gem mysql locally or in a repository
So I need to update the gem repository and I tried:
gem update --system
This returned an error:
ERROR: While executing gem ... (RuntimeError)
gem update --system is disabled on Debian. RubyGems can be updated using the
official Debian repositories by aptitude or apt-get.
Wandered on the Interwebs for a while and found no solution. So I tried updating the ruby gems by doing:
apt-get install rubygems
And this updated the package and the following command now worked:
gem install mysql
But wait, I’m still not able to connect to the MySQL database in Metasploit or Armitage, when I run the following command:
msf > db_connect root:firstname.lastname@example.org/msf3
The error I get is:
[-] Error while running command db_connect: Failed to connect to the database: uninitialized constant MysqlCompat::MysqlRes
/opt/metasploit3/msf3/lib/rex/ui/text/dispatcher_shell.rb:208:in `block in run_single'
Searched for the error on Google and found an article on how to resolve this error on Mac OS X. Unix Linux same shit. Knew it will work. So ran the following command:
sudo gem install --no-rdoc --no-ri -v=2.7 mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-config=/usr/bin/mysql_config
It worked and Armitage now successfully connected to the Metaploit db in MySQL.