From 2c7b35193c2ae3acdf6edc1906bec65e6c5b5cef Mon Sep 17 00:00:00 2001 From: HD Moore Date: Thu, 8 Dec 2005 18:26:38 +0000 Subject: [PATCH] Sanity checks for version and pack/unpack git-svn-id: file:///home/svn/incoming/trunk@3196 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core.rb | 5 ++++- lib/msf/sanity.rb | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 lib/msf/sanity.rb diff --git a/lib/msf/core.rb b/lib/msf/core.rb index 477f906256..94092d7b81 100644 --- a/lib/msf/core.rb +++ b/lib/msf/core.rb @@ -9,7 +9,10 @@ # ### -# framework-core depends on Rex +# Sanity check this version of ruby +require 'msf/sanity' + +# The framework-core depends on Rex require 'rex' require 'rex/ui' diff --git a/lib/msf/sanity.rb b/lib/msf/sanity.rb new file mode 100644 index 0000000000..2b25e12338 --- /dev/null +++ b/lib/msf/sanity.rb @@ -0,0 +1,23 @@ +# +# Provides some sanity checks against the ruby build and version +# + + +# Check for the broken pack/unpack in OS X 10.4.x +if ([1].pack('n') == "\x01\x00") + puts "*** This ruby build has a broken pack/unpack implementation! " + + if (RUBY_PLATFORM =~ /darwin/) + puts " Apple shipped a broken version of ruby with the 10.4.x " + puts " release. Please install ruby from source, or use one of " + puts " the free package managers to obtain a working ruby build." + end + + exit(0) +end + +# Check for ruby 1.8.0 as the minimal supported version +if (RUBY_VERSION =~ /^1\.[0-7]\./) + puts "*** This version of ruby is not supported, please upgrade to 1.8.3+" + exit(0) +end