diff options
author | anonym <anonym@riseup.net> | 2017-03-19 02:54:21 +0100 |
---|---|---|
committer | anonym <anonym@riseup.net> | 2017-03-19 02:54:21 +0100 |
commit | c336187d6df5a9dd3ea7d9192b70b876eaec598e (patch) | |
tree | 8c7ee216c392b26d0c0b4225a643b6cd9e184f43 | |
parent | 857dac3104e1f57013a6ce766f806c149c9758b3 (diff) | |
parent | 112b34da0648706850d3f780dc620c8de444c33e (diff) |
Merge branch 'stable' into devel
-rw-r--r-- | features/support/helpers/firewall_helper.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/features/support/helpers/firewall_helper.rb b/features/support/helpers/firewall_helper.rb index 97f0eeb..62d9856 100644 --- a/features/support/helpers/firewall_helper.rb +++ b/features/support/helpers/firewall_helper.rb @@ -19,7 +19,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 @@ -35,9 +38,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 @@ -52,16 +52,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 |