Monday 19 January 2015

Automatically installing gem dependencies when setting up Metasploit

Quick post! Setting up metasploit from source was being a bitch. I don't often work with ruby, which was more than likely why I was having issues. bundle install was not working as I would have liked and metasploit wanted 101 dependencies installing.. one.. by.. one.

ANYHO, here is a one line script I made to automate the whole process of installing the dependencies:

while true; do package=`./msfconsole 2>&1 | grep -Eo "Could not find.*" | awk {'print $4'}`; if [ -z $package ]; then echo done; break; else nam=`echo $package | grep -oE "^.*-" | sed s/-$//g`; ver=`echo $package | grep -Eo "[0-9][0-9\.]+$"`; echo $nam $ver; gem install $nam -v $ver ;fi; done  

I am sure there is a lovely neat way of doing this, however unfortunately, I did not know how.

No comments:

Post a Comment