module Packetz
Defined in:
packetz.crpacketz/capture.cr
packetz/interfaces.cr
packetz/libpcap.cr
packetz/version.cr
Constant Summary
-
VERSION =
"0.1.0"
Class Method Summary
- .capture(interface = Packetz.interfaces.default, snapshot_length = 65535, promiscuous_mode = false, timeout_ms = 1, monitor_mode = false)
-
.capture(interface = Packetz.interfaces.default, snapshot_length = 65535, promiscuous_mode = false, timeout_ms = 1, monitor_mode = false, &)
When the
#capture
method is used within a block syntax, then it can quickly start yielding packets to the underlying block. -
.interfaces
The
#interfaces
method provides a sweet, syntactic sugar to be able to access the underlyingInterfaces
module for information about network interfaces.
Class Method Detail
The #capture
method provides a delicious, syntactic sugar to be able to
access the underlying Capture
module to perform live packet captures.
When the #capture
method is used within a block syntax, then it can quickly start
yielding packets to the underlying block. This is an optional way to start capturing
packets right away.
The #interfaces
method provides a sweet, syntactic sugar to be able to
access the underlying Interfaces
module for information about network interfaces.
To get the first, default ( non-loopback ) interface name on your system:
Packetz.interfaces.default
# => "eth0"
To access all of the interfaces on your system as an array:
Packetz.interfaces.all
# => ["en0", "lo0", "vboxnet0", "vboxnet1"]
To enumerate through each of the interfaces on your system:
Packetz.interfaces.each do |interface|
puts interface
end