Pcaplet 'lookupdev': no suitable device found

Hello,

I’m trying to prototype using Ruby for a networking class that I’m
taking, and I need to be able to use libpcap. I found ‘pcaplet’ and
have been trying to get set up with that, but when trying to execute the
following line:

$network = Pcaplet.new(’-s 1500’)

I get the following error:

/usr/lib/ruby/1.8/pcaplet.rb:51:in ‘lookupdev’: no suitable device found
(Pcap::PcapError)
from /usr/lib/ruby/1.8/pcaplet.rb:51:in ‘initialize’
from test.rb:3

I’m running on Ubuntu 6.10 under Microsoft Virtual PC 2007 as I don’t
have Linux installed directly on my laptop.

Thanks in advance,
-Mike

On 29 Mar 2007, at 20:33, Mike Cook wrote:

/usr/lib/ruby/1.8/pcaplet.rb:51:in ‘lookupdev’: no suitable device
found
(Pcap::PcapError)
from /usr/lib/ruby/1.8/pcaplet.rb:51:in ‘initialize’
from test.rb:3

You need to specify the interface to listen on. For example:

en0_listener = Pcaplet.new(’-s 1500 -i en0’)

which on my Mac will listen on en0.

Ellie

Eleanor McHugh
Games With Brains

raise ArgumentError unless @reality.responds_to? :reason

Eleanor McHugh wrote:

On 29 Mar 2007, at 20:33, Mike Cook wrote:

/usr/lib/ruby/1.8/pcaplet.rb:51:in ‘lookupdev’: no suitable device
found
(Pcap::PcapError)
from /usr/lib/ruby/1.8/pcaplet.rb:51:in ‘initialize’
from test.rb:3

You need to specify the interface to listen on. For example:

en0_listener = Pcaplet.new(‘-s 1500 -i en0’)

which on my Mac will listen on en0.

Ellie

Eleanor McHugh
Games With Brains

raise ArgumentError unless @reality.responds_to? :reason

Ellie,

Thanks for your quick reply, your solution worked like a charm. I was
following a Ruby/Pcap tutorial from Arstechnica.com and they didn’t make
any mention of specifying the interface.

-Mike

On 29 Mar 2007, at 23:45, Mike Cook wrote:

Thanks for your quick reply, your solution worked like a charm. I was
following a Ruby/Pcap tutorial from Arstechnica.com and they didn’t
make
any mention of specifying the interface.

Unfortunately Ruby/Pcap is a very thin wrapper to the underlying
library, which makes it a little less Rubyish than one would like -
in particular passing in configuration strings is just ugly. Still,
it works as advertised and is great for quick sniffing/logging tasks.

My colleague Romek and I use it extensively for our DNS work and he
covered it very briefly as part of our RailsConf Europe presentation
last year. Needless to say there were some baffled faces in the
audience lol

Ellie

Being and Doing are merely useful abstractions for the ‘time’-
dependent asymmetries of phase space.