root@bt:~# irb
irb(main):001:0> require 'oci8'
LoadError: no such file to load -- oci8lib_191
from /usr/local/lib/site_ruby/1.9.2/oci8.rb:40:in `require'
from /usr/local/lib/site_ruby/1.9.2/oci8.rb:40:in `<top (required)>'
from (irb):1:in `require'
from (irb):1
from /usr/bin/irb:12:in `<main>'
因为我的ruby版本是1.9.2,安装的时候生成的是oci8lib_192,所以需要改一个oci8.rb这个文件
root@bt:/usr/local/lib/site_ruby/1.9.2# vi oci8.rb
多加一个when, 让其使用oci8lib_192这个库
# The suffix number indicates the ruby API version.
# 18 - ruby 1.8.x
# 191 - ruby 1.9.1 and 1.9.2
# 19x - ruby 1.9.x future version which will break the API compatibility
case RUBY_VERSION
when /^1\.9\.1/
so_basename += '191'
when /^1\.9\.2/
so_basename += '192'
when /^1\.8/
so_basename += '18'
else
raise 'unsupported ruby version: ' + RUBY_VERSION
end
require so_basename
这时我们再来确认一下,出现下面类似的信息就可以了。
irb(main):002:0> require 'oci8'
Warning: NLS_LANG is not set. fallback to US-ASCII.
=> true
在backtrack5 R1上,msf这时还是会出现
[-] Failed to load the OCI library: no such file to load -- oci8
这是因为metasploit的环境变量中没有包含我们安装的OCI8的缘故,可以在metasploit执行如下命令确认一下
msf auxiliary(oracle_login) > ruby -r rbconfig -e "puts Config::CONFIG['sitelibdir']"
[*] exec: ruby -r rbconfig -e "puts Config::CONFIG['sitelibdir']"
/opt/framework/ruby/lib/ruby/site_ruby/1.9.1
msf auxiliary(oracle_login) > env | grep RUBYLIB
[*] exec: env | grep RUBYLIB
RUBYLIB=/opt/framework/ruby/lib:/opt/framework/ruby/lib/ruby:/opt/framework/ruby/lib/ruby/1.9.1:/opt/framework/ruby/lib/ruby/1.9.1/i686-linux:/opt/framework/ruby/lib/ruby/site_ruby:/opt/framework/ruby/lib/ruby/site_ruby/1.9.1:/opt/framework/ruby/lib/ruby/site_ruby/1.9.1/i686-linux
在/opt/framework3/scripts/setenv.sh的 RUBLIB中加入你安装的OCI8所在的目录。
:/usr/local/lib/site_ruby/1.9.2:/usr/local/lib/site_ruby/1.9.2/i486-linux
重新启动msfconsole