Friday, 7 October 2011

Backtrack 5 Shell Script to Change the Ruby Environment automatically

NOTE: I also posted this to the BeEF Project Wiki here

Some Backtrack 5 security tools need ruby 1.8 (i.e. whatweb) and others ruby 1.9.2 (i.e. BeEF). This script automates the switch.
By setting the ruby environment to the correct ruby version we can run all tools. This script aims to make this small task easier to do and in a more scripting-friendly way.
Instalation Instructions:
  1. copy-paste code below into a file called, ideally somewhere in your PATH
  2. chmod 700 # (obviously!)
IMPORTANT: You need to call this script with a ". " in front of it to alter your environment settings.
  1. . 1.8 ; /pentest/enumeration/web/whatweb/whatweb
  2. cd /pentest/web/beef ; . 1.9.2 ; ruby beef
If you try to start BeEF using the incorrect environment you should see an error message like this:
"Ruby version 1.8.7 is no longer supported. Please upgrade 1.9 or later."
If you ran the Backtrack 5 Installation Script then you would only need to run this script to run ruby 1.8 tools.

Source code to copy-paste: