module PacketGen::Pcap

Module to read PCAP files @author Sylvain Daubert @api private @since 3.1.4

Public Class Methods

read(filename) click to toggle source

Read a PCAP file @param [String] filename @return [Array<Packet>] @author Kent Gruber

# File lib/packetgen/pcap.rb, line 19
def self.read(filename)
  packets = []
  PCAPRUBWrapper.read_pcap(filename: filename) do |packet|
    next unless (packet = PacketGen.parse(packet.to_s))

    packets << packet
  end
  packets
end