Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
ruby libpcap fails when passing command-line argument
kenny roytman
10/30/2007 5:36:00 AM
Hi,
Can someone please help me out here? I'm trying to use Ruby/Libpcap
extension to write a rudimentary packet sniffer.
I downloaded ruby/libpcap 0.6 from
http://www.goto.info.waseda.ac.jp/~fukusima/ruby/p...
.
The following code breaks when calling it from the command-line with a
parameter, such as:
$>ruby dumptraffic.rb en1
/usr/local/lib/ruby/site_ruby/1.8/universal-darwin8.0/pcap.bundle:
warning: do not use Fixnums as Symbols
/usr/local/lib/ruby/site_ruby/1.8/universal-darwin8.0/pcap.bundle:
warning: do not use Fixnums as Symbols
/usr/local/lib/ruby/site_ruby/1.8/universal-darwin8.0/pcap.bundle:
warning: do not use Fixnums as Symbols
setfilter: parse error
$>
The code:
------- start of code
require 'pcaplet'
include Pcap
class Sniffer
def sniff(d)
pcaplet = Pcaplet.new("-i " + d)
c = pcaplet.capture
d = Dumper.open(c,"dump.txt")
c.each_packet(50) { |pkt|
if pkt.ip?
d.dump(pkt)
puts "hello from #{pkt.src.to_num_s}"
end
}
pcaplet.close
end
end
if __FILE__ == $0
d = ARGV[0]
sniffit = Sniffer.new
sniffit.sniff(d)
end
---- end of code
Any help would be greatly appreciated. Thanks.
- kenny r.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
ruby libpcap fails when passing command-line argument
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password