Metasploit on your PiSo you don't want to run Kali on your Pi... fair enough. Perhaps you just want some very
specific tools that you use frequently as part of your day job, or you just want to add to the list of things you can do
with your single versatile Raspberry Pi, and maybe you would like a minimalistic install to run your favourite tool in
the world... metasploit!
EquipmentI'm using a Raspberry Pi B+ (quad core, 1gb RAM), a 32gb microSD card, micro WiFi USB dongle (Ralink
Technology, Corp. RT5370 Wireless Adapter).
- Install Raspbian - I obtained and followed the instructions from http://www.raspbian.org/.
- Setup networking and make sure SSH is enabled.
- From here I detached from the monitor and did everything over SSH.
- Remove all ruby except version 2.1. (or just be normal and install rbenv)
- I do this because metasploit heavily relies upon Ruby and having only one version installed helps :)
- I also found that trying to run msfupdate would fail with ruby errors. This can be avoided by just
setting the correct ruby version in your environment.
- Install required packages to obtain and update metasploit-framework.
- Install the bundler gem
- Fetch metasploit-framework using GIT (subversion has been deprecated).
- Update metasploit-framework.
- Install metasploit-framework prerequisite gems
- Make sure metasploit works!
- On the first run, you may get an error about not being able to find 'robots'. Two approaches to fix this:
- $ chmod 644 /var/lib/gems/2.1.0/gems/robots-0.10.1/lib/robots.rb
- Add your user account to the 'root' group.
- Time to pentest.
$ sudo apt-get remove ruby1.9.1 libruby1.9.1
$ dpkg -l | grep ruby
$ sudo apt-get purge ruby1.9.1 ruby1.8
The following may work instead of removing ruby.
$ sudo apt-get install rbenv
$ rbenv rehash
$ apt-get install git ruby rubygems ruby-pg postgresql-common libpq-dev libpcap0.8 bundler ruby-pcaprub libpcap0.8 libpcap0.8-dev libsqlite3-dev
$ sudo gem install bundler
$ cd $HOME; git clone git://github.com/rapid7/metasploit-framework
$ cd metasploit-framework; ./msfupdate
$ bundle install
Bundle complete! 16 Gemfile dependencies, 86 gems now installed.
=[ metasploit v4.11.4-dev-c1b6de90 ]
+ -- --=[ 1494 exploits - 861 auxiliary - 251 post ]
+ -- --=[ 432 payloads - 37 encoders - 8 nops ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]
If I have missed anything or this does not work for you, feel free to leave a comment.
Thanks Jeremy Hofman for your notes around rbenv instead of trying to purge ruby from the system! I have personally not fully verified the use of rbenv, it may or may not work, let me know.