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:
- copy-paste code below into a file called setrubyenv.sh, ideally somewhere in your PATH
- chmod 700 setrubyenv.sh # (obviously!)
IMPORTANT: You need to call this script with a “. ” in front of it to alter your environment settings.
Examples:
- . setrubyenv.sh 1.8 ; /pentest/enumeration/web/whatweb/whatweb http://target.com
- cd /pentest/web/beef ; . setrubyenv.sh 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: