Welcome to our

Cyber Security News Aggregator

.

Cyber Tzar

provide a

cyber security risk management

platform; including automated penetration tests and risk assesments culminating in a "cyber risk score" out of 1,000, just like a credit score.

Switching Ruby Version in RVM for Metasploit Development

published on 2017-10-25 12:00:00 UTC by Carlos Perez
Content:

If you have setup a development environment with RVM to do development in Metasploit Framework you are bound to encounter that the Metasploit team has changed preferred Ruby versions.

carlos@ubuntu:/opt$ cd metasploit-framework/
ruby-2.4.2 is not installed.
To install do: 'rvm install ruby-2.4.2'

You get a useful message that mentions the RVM command you need to run to install the new version but there is a bit more to do to fully migrate to the new version. Lets stat installing the new version of Ruby by running the command specified when we switched to the folder rvm install 2.4.2:

$ rvm install 2.4.2

Now that the new version is installed lets migrate gemsets. In my case I set the gemset in RVM to the one recommended by the Metasploit dev team, with the metasploit-framework name. The name tag allows me to migrate one gemset from one version of Ruby to the other using the gemset copy command:

$ rvm gemset copy ruby-2.4.1@metasploit-framework ruby-2.4.2@metasploit-framework

Now that we migrated the gemsets I make the new Ruby and gemset the default for my console.

$ rvm --default use ruby-2.4.2@metasploit-framework

I can quickly test to see I have the correct version of Ruby:

$ ruby -v
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
$ rvm list

rvm rubies

   ruby-2.4.1 [ x86_64 ]
=* ruby-2.4.2 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

I can also check the gemset is the correct one and set as default:

$ rvm gemset list

gemsets for ruby-2.4.2 (found in /home/carlos/.rvm/gems/ruby-2.4.2)
   (default)
   global
=> metasploit-framework

Once that is done I will generate the ri documentation. I find it very useful specially when I'm traveling or in any other environment without internet access where I can not do a simple Google search. 

$ rvm docs generate-ri

Once done I can test that the documentation was generated by looking at the help information for the Array object and for the method each for the object. 

$ ri Array
$ ri Array#each

I hope those of you getting started with coding against Metasploit Framewok find this information useful.

Article: Switching Ruby Version in RVM for Metasploit Development - published about 7 years ago.

https://www.darkoperator.com/blog/2017/10/22/switching-ruby-version-in-rvm-for-metasploit-development   
Published: 2017 10 25 12:00:00
Received: 2021 06 06 09:05:08
Feed: Blog
Source: Blog
Category: Cyber Security
Topic: Cyber Security
Views: 1

Custom HTML Block

Click to Open Code Editor