Class: PcapTools::TcpStream
- Inherits:
-
Array
- Object
- Array
- PcapTools::TcpStream
- Defined in:
- lib/pcap_tools.rb
Instance Method Summary collapse
Instance Method Details
#insert_tcp(sym, packet) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/pcap_tools.rb', line 29 def insert_tcp sym, packet data = packet.payload return if data.size == 0 = Time.at(packet.parent.parent.parent.ts_sec, packet.parent.parent.parent.ts_usec) self << {:type => sym, :data => data, :from => packet.parent.src_addr, :to => packet.parent.dst_addr, :from_port => packet.src_port, :to_port => packet.dst_port, :time => } end |
#rebuild_packets ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/pcap_tools.rb', line 36 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 |