我正在尝试使用 packetfu gem。我是 ruby on rails 的新手,所以请多多包涵。我将 rvm 与 ruby-1.9.3-head [ x86_64 ] 一起使用。我也有 Mac OSX 10.7.4 尝试运行 sudo ruby app/models/simpleSniff.rb 时出现此错误
/Users/aragorn/.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- packetfu (LoadError)
from /Users/aragorn/.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from app/simpleSniff.rb:2:in `<main>'
simpleSniff.rb 中包含的代码是
#!/usr/bin/env ruby
require 'packetfu'
include PacketFu
iface = "eth1"
cap = Capture.new(:iface => iface, :start => true)
cap.stream.each do |p|
put p
end
$gem 列表 * 本地宝石 *
actionmailer (3.2.8)
actionpack (3.2.8)
activemodel (3.2.8)
activerecord (3.2.8)
activeresource (3.2.8)
activesupport (3.2.8)
arel (3.0.2)
builder (3.0.0)
bundler (1.1.5)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.4.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.4)
jquery-rails (2.0.2)
json (1.7.4)
mail (2.4.4)
mime-types (1.19)
multi_json (1.3.6)
packetfu (1.1.5)
pcaprub (0.11.2)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.8)
railties (3.2.8)
rake (0.9.2.2)
rdoc (3.12)
rspec (2.11.0, 0.9.4)
rspec-core (2.11.1)
rspec-expectations (2.11.2)
rspec-mocks (2.11.2)
rubygems-bundler (1.0.6)
rvm (1.11.3.5)
sass (3.2.1)
sass-rails (3.2.5)
sdoc (0.3.16)
sprockets (2.1.3)
sqlite3 (1.3.6)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)
uglifier (1.2.7)
最后我的 Gemfile 是
source 'http://rubygems.org'
gem "rails", "3.2.8"
gem "rspec", "~> 0.9.2"
gem "sdoc", "~> 0.3.16"
gem "pcaprub", "~> 0.11.2"
gem "packetfu", "~>1.1.5"
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'