Class: SimpleCapture::Capture

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_capture/capture.rb

Constant Summary collapse

SOL_PACKET =

bits/socket.h

0x0107
IFINDEX_SIZE =

sizeof(ifreq.ifr_ifindex) on 64bit

0x0004
IFREQ_SIZE =

sizeof(ifreq) on 64bit

0x0028
SIOCGIFINDEX =

bits/ioctls.h

0x8933
PACKET_MR_PROMISC =

netpacket/packet.h

0x0001
PACKET_MREQ_SIZE =

sizeof(packet_mreq) on 64bit

0x0010
PACKET_ADD_MEMBERSHIP =

netpacket/packet.h

0x0001
ETH_P_ALL =

htons(ETH_P_ALL), linux/if_ether.h

768

Instance Method Summary collapse

Constructor Details

#initialize(interface_name) ⇒ Capture

Returns a new instance of Capture.

Parameters:



15
16
17
# File 'lib/simple_capture/capture.rb', line 15

def initialize(interface_name)
  @interface_name = interface_name
end

Instance Method Details

#runObject

Run Capture



20
21
22
23
# File 'lib/simple_capture/capture.rb', line 20

def run
  socket = generate_socket(@interface_name)
  cap_loop(socket)
end