Commit 02dbdc31 authored by anonym's avatar anonym
Browse files

Merge branch 'devel' into feature/stretch

parents 939bd9cb c336187d
......@@ -20,7 +20,10 @@ def pcap_connections_helper(pcap_file, opts = {})
end
sport = nil
dport = nil
if PacketFu::TCPPacket.can_parse?(p)
if PacketFu::IPv6Packet.can_parse?(p)
ip_packet = PacketFu::IPv6Packet.parse(p)
protocol = 'ipv6'
elsif PacketFu::TCPPacket.can_parse?(p)
ip_packet = PacketFu::TCPPacket.parse(p)
protocol = 'tcp'
sport = ip_packet.tcp_sport
......@@ -36,9 +39,6 @@ def pcap_connections_helper(pcap_file, opts = {})
elsif PacketFu::IPPacket.can_parse?(p)
ip_packet = PacketFu::IPPacket.parse(p)
protocol = 'ip'
elsif PacketFu::IPv6Packet.can_parse?(p)
ip_packet = PacketFu::IPv6Packet.parse(p)
protocol = 'ipv6'
else
raise "Found something that cannot be parsed"
end
......@@ -54,16 +54,19 @@ def pcap_connections_helper(pcap_file, opts = {})
sport: sport,
dport: dport,
}
# It seems *Packet.parse can return an IP packet without source
# and/or destination address. (#11508)
begin
packet_info[:saddr] = ip_packet.ip_saddr
packet_info[:daddr] = ip_packet.ip_daddr
rescue NoMethodError
# noop
end
if not(packet_info.has_key?(:saddr)) || not(packet_info.has_key?(:daddr))
puts "We were hit by #11508. PacketFu bug? Packet info: #{packet_info}"
begin
packet_info[:saddr] = ip_packet.ipv6_saddr
packet_info[:daddr] = ip_packet.ipv6_daddr
rescue NoMethodError
puts "We were hit by #11508. PacketFu bug? Packet info: #{ip_packet}"
packet_info[:saddr] = nil
packet_info[:daddr] = nil
end
end
connections << packet_info
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment