# File lib/pcap_tools.rb, line 28 def insert_tcp sym, packet data = packet.payload return if data.size == 0 self << {:type => sym, :data => data, :from => packet.ip_saddr, :to => packet.ip_daddr, :from_port => packet.tcp_src, :to_port => packet.tcp_dst} end
# File lib/pcap_tools.rb, line 34 def rebuild_packets out = TcpStream.new current = nil self.each do |packet| if current if packet[:type] == current[:type] current[:data] += packet[:data] else out << current current = packet.clone end else current = packet.clone end end out << current if current out end