class PacketFu::PcapFile
Public Class Methods
read_packets_with_timestamp(fname) { |pkt| ... }
click to toggle source
# File lib/reassemble_tcp/packetfu_extend.rb, line 12 def self.read_packets_with_timestamp(fname, &block) count = 0 packets = [] unless block read(fname) do |packet| pkt = Packet.parse(packet.data.to_s) pkt.timestamp = packet.timestamp.to_f if block count += 1 yield pkt else packets << pkt end end block ? count : packets end