packetgen 3.1.3 → 3.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/bin/pgconsole +1 -0
- data/lib/packetgen.rb +33 -4
- data/lib/packetgen/capture.rb +51 -28
- data/lib/packetgen/config.rb +17 -11
- data/lib/packetgen/deprecation.rb +33 -7
- data/lib/packetgen/header.rb +2 -9
- data/lib/packetgen/header/arp.rb +2 -2
- data/lib/packetgen/header/asn1_base.rb +2 -2
- data/lib/packetgen/header/base.rb +70 -74
- data/lib/packetgen/header/bootp.rb +3 -3
- data/lib/packetgen/header/dhcp.rb +2 -2
- data/lib/packetgen/header/dhcp/option.rb +2 -2
- data/lib/packetgen/header/dhcp/options.rb +2 -2
- data/lib/packetgen/header/dhcpv6.rb +12 -12
- data/lib/packetgen/header/dhcpv6/duid.rb +11 -5
- data/lib/packetgen/header/dhcpv6/option.rb +8 -16
- data/lib/packetgen/header/dhcpv6/options.rb +2 -2
- data/lib/packetgen/header/dhcpv6/relay.rb +2 -2
- data/lib/packetgen/header/dns.rb +9 -9
- data/lib/packetgen/header/dns/name.rb +20 -9
- data/lib/packetgen/header/dns/opt.rb +2 -2
- data/lib/packetgen/header/dns/option.rb +2 -2
- data/lib/packetgen/header/dns/qdsection.rb +3 -3
- data/lib/packetgen/header/dns/question.rb +37 -35
- data/lib/packetgen/header/dns/rr.rb +3 -3
- data/lib/packetgen/header/dns/rrsection.rb +2 -2
- data/lib/packetgen/header/dot11.rb +30 -51
- data/lib/packetgen/header/dot11/control.rb +5 -5
- data/lib/packetgen/header/dot11/data.rb +11 -7
- data/lib/packetgen/header/dot11/element.rb +16 -16
- data/lib/packetgen/header/dot11/management.rb +2 -2
- data/lib/packetgen/header/dot11/sub_mngt.rb +2 -12
- data/lib/packetgen/header/dot1q.rb +2 -2
- data/lib/packetgen/header/dot1x.rb +7 -20
- data/lib/packetgen/header/eap.rb +30 -33
- data/lib/packetgen/header/eap/fast.rb +2 -2
- data/lib/packetgen/header/eap/md5.rb +2 -2
- data/lib/packetgen/header/eap/tls.rb +2 -2
- data/lib/packetgen/header/eap/ttls.rb +2 -2
- data/lib/packetgen/header/eth.rb +13 -11
- data/lib/packetgen/header/gre.rb +2 -2
- data/lib/packetgen/header/http.rb +2 -0
- data/lib/packetgen/header/http/headers.rb +6 -4
- data/lib/packetgen/header/http/request.rb +36 -21
- data/lib/packetgen/header/http/response.rb +7 -7
- data/lib/packetgen/header/http/verbs.rb +3 -3
- data/lib/packetgen/header/icmp.rb +2 -2
- data/lib/packetgen/header/icmpv6.rb +2 -2
- data/lib/packetgen/header/igmp.rb +4 -4
- data/lib/packetgen/header/igmpv3.rb +3 -3
- data/lib/packetgen/header/igmpv3/group_record.rb +8 -6
- data/lib/packetgen/header/igmpv3/mq.rb +2 -2
- data/lib/packetgen/header/igmpv3/mr.rb +2 -2
- data/lib/packetgen/header/ip.rb +30 -31
- data/lib/packetgen/header/ip/addr.rb +10 -3
- data/lib/packetgen/header/ip/option.rb +8 -10
- data/lib/packetgen/header/ip/options.rb +3 -5
- data/lib/packetgen/header/ipv6.rb +2 -2
- data/lib/packetgen/header/ipv6/addr.rb +9 -2
- data/lib/packetgen/header/ipv6/extension.rb +2 -2
- data/lib/packetgen/header/ipv6/hop_by_hop.rb +3 -3
- data/lib/packetgen/header/llc.rb +2 -2
- data/lib/packetgen/header/mdns.rb +2 -2
- data/lib/packetgen/header/mld.rb +2 -2
- data/lib/packetgen/header/mldv2.rb +2 -2
- data/lib/packetgen/header/mldv2/mcast_address_record.rb +4 -2
- data/lib/packetgen/header/mldv2/mlq.rb +2 -2
- data/lib/packetgen/header/mldv2/mlr.rb +2 -2
- data/lib/packetgen/header/ospfv2.rb +9 -9
- data/lib/packetgen/header/ospfv2/db_description.rb +2 -2
- data/lib/packetgen/header/ospfv2/hello.rb +2 -2
- data/lib/packetgen/header/ospfv2/ls_ack.rb +2 -2
- data/lib/packetgen/header/ospfv2/ls_request.rb +4 -2
- data/lib/packetgen/header/ospfv2/ls_update.rb +2 -2
- data/lib/packetgen/header/ospfv2/lsa.rb +9 -5
- data/lib/packetgen/header/ospfv2/lsa_header.rb +8 -7
- data/lib/packetgen/header/ospfv3.rb +2 -2
- data/lib/packetgen/header/ospfv3/db_description.rb +2 -2
- data/lib/packetgen/header/ospfv3/hello.rb +2 -2
- data/lib/packetgen/header/ospfv3/ipv6_prefix.rb +4 -2
- data/lib/packetgen/header/ospfv3/ls_ack.rb +2 -2
- data/lib/packetgen/header/ospfv3/ls_request.rb +4 -2
- data/lib/packetgen/header/ospfv3/ls_update.rb +2 -2
- data/lib/packetgen/header/ospfv3/lsa.rb +5 -5
- data/lib/packetgen/header/ospfv3/lsa_header.rb +9 -8
- data/lib/packetgen/header/snmp.rb +33 -29
- data/lib/packetgen/header/tcp.rb +4 -23
- data/lib/packetgen/header/tcp/option.rb +11 -11
- data/lib/packetgen/header/tcp/options.rb +2 -2
- data/lib/packetgen/header/tftp.rb +6 -6
- data/lib/packetgen/header/udp.rb +3 -3
- data/lib/packetgen/headerable.rb +5 -4
- data/lib/packetgen/inject.rb +23 -0
- data/lib/packetgen/inspect.rb +23 -20
- data/lib/packetgen/packet.rb +82 -53
- data/lib/packetgen/pcap.rb +29 -0
- data/lib/packetgen/pcapng.rb +13 -13
- data/lib/packetgen/pcapng/block.rb +26 -13
- data/lib/packetgen/pcapng/epb.rb +25 -22
- data/lib/packetgen/pcapng/file.rb +260 -138
- data/lib/packetgen/pcapng/idb.rb +36 -38
- data/lib/packetgen/pcapng/shb.rb +51 -53
- data/lib/packetgen/pcapng/spb.rb +19 -19
- data/lib/packetgen/pcapng/unknown_block.rb +5 -13
- data/lib/packetgen/pcaprub_wrapper.rb +81 -0
- data/lib/packetgen/proto.rb +2 -2
- data/lib/packetgen/types.rb +3 -0
- data/lib/packetgen/types/abstract_tlv.rb +27 -7
- data/lib/packetgen/types/array.rb +22 -15
- data/lib/packetgen/types/cstring.rb +57 -20
- data/lib/packetgen/types/enum.rb +7 -2
- data/lib/packetgen/types/fieldable.rb +65 -0
- data/lib/packetgen/types/fields.rb +182 -117
- data/lib/packetgen/types/int.rb +18 -6
- data/lib/packetgen/types/int_string.rb +10 -2
- data/lib/packetgen/types/length_from.rb +20 -12
- data/lib/packetgen/types/oui.rb +4 -2
- data/lib/packetgen/types/string.rb +59 -8
- data/lib/packetgen/types/tlv.rb +4 -2
- data/lib/packetgen/utils.rb +4 -4
- data/lib/packetgen/utils/arp_spoofer.rb +2 -2
- data/lib/packetgen/version.rb +3 -3
- metadata +39 -61
- data/.gitignore +0 -13
- data/.rubocop.yml +0 -30
- data/.travis.yml +0 -19
- data/Gemfile +0 -4
- data/Rakefile +0 -21
- data/packetgen.gemspec +0 -36
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
class EAP
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
class EAP
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
class EAP
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
class EAP
|
data/lib/packetgen/header/eth.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
# An Ethernet header consists of:
|
@@ -33,6 +33,8 @@ module PacketGen
|
|
33
33
|
# Ethernet MAC address, as a group of 6 bytes
|
34
34
|
# @author Sylvain Daubert
|
35
35
|
class MacAddr < Types::Fields
|
36
|
+
include Types::Fieldable
|
37
|
+
|
36
38
|
# @!attribute a0
|
37
39
|
# @return [Integer] first byte from MacAddr
|
38
40
|
define_field :a0, Types::Int8
|
@@ -61,12 +63,9 @@ module PacketGen
|
|
61
63
|
bytes = str.split(/:/)
|
62
64
|
raise ArgumentError, 'not a MAC address' unless bytes.size == 6
|
63
65
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
self[:a3].read(bytes[3].to_i(16))
|
68
|
-
self[:a4].read(bytes[4].to_i(16))
|
69
|
-
self[:a5].read(bytes[5].to_i(16))
|
66
|
+
6.times do |i|
|
67
|
+
self["a#{i}".to_sym].read(bytes[i].to_i(16))
|
68
|
+
end
|
70
69
|
self
|
71
70
|
end
|
72
71
|
|
@@ -75,6 +74,11 @@ module PacketGen
|
|
75
74
|
def to_human
|
76
75
|
fields.map { |m| '%02x' % self[m] }.join(':')
|
77
76
|
end
|
77
|
+
|
78
|
+
def ==(other)
|
79
|
+
other.is_a?(self.class) &&
|
80
|
+
fields.all? { |attr| self[attr].value == other[attr].value }
|
81
|
+
end
|
78
82
|
end
|
79
83
|
|
80
84
|
# @!attribute dst
|
@@ -94,9 +98,7 @@ module PacketGen
|
|
94
98
|
# @param [String] iface interface name
|
95
99
|
# @return [void]
|
96
100
|
def to_w(iface)
|
97
|
-
|
98
|
-
pcap.inject self.to_s
|
99
|
-
pcap.close
|
101
|
+
Inject.inject(iface: iface, data: self)
|
100
102
|
end
|
101
103
|
|
102
104
|
# Invert destination and source addresses
|
data/lib/packetgen/header/gre.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
# Generic Routing Encapsulation (RFC 2784 and 2890)
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
# @since 2.2.0
|
@@ -12,13 +12,15 @@ module PacketGen
|
|
12
12
|
# @abstract Base class for HTTP headers.
|
13
13
|
# @author Kent 'picat' Gruber
|
14
14
|
class Headers
|
15
|
+
include Types::Fieldable
|
16
|
+
|
15
17
|
# Underlying Headers data (or nil).
|
16
18
|
# @return [Hash, nil]
|
17
19
|
attr_reader :data
|
18
20
|
alias to_h data
|
19
21
|
|
20
22
|
def initialize
|
21
|
-
@data =
|
23
|
+
@data = {}
|
22
24
|
end
|
23
25
|
|
24
26
|
# Populate object from a string or directly from a hash.
|
@@ -46,7 +48,7 @@ module PacketGen
|
|
46
48
|
|
47
49
|
d = []
|
48
50
|
@data.map do |k, v|
|
49
|
-
d << k
|
51
|
+
d << "#{k}: #{v}"
|
50
52
|
end
|
51
53
|
d.join("\r\n") << "\r\n\r\n"
|
52
54
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
module HTTP
|
@@ -39,7 +39,7 @@ module PacketGen
|
|
39
39
|
# @!attribute verb
|
40
40
|
# @return [Types::String]
|
41
41
|
# @since 3.1.0
|
42
|
-
define_field :verb,
|
42
|
+
define_field :verb, Types::String
|
43
43
|
# @!attribute path
|
44
44
|
# @return [Types::String]
|
45
45
|
define_field :path, Types::String
|
@@ -67,35 +67,50 @@ module PacketGen
|
|
67
67
|
# Read in the HTTP portion of the packet, and parse it.
|
68
68
|
# @return [PacketGen::HTTP::Request]
|
69
69
|
def read(str)
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
self[:path].read first_line[1]
|
77
|
-
self[:version].read first_line[2]
|
70
|
+
lines = lines(str)
|
71
|
+
first_line_words = lines.shift.split
|
72
|
+
self[:verb].read first_line_words[0]
|
73
|
+
self[:path].read first_line_words[1]
|
74
|
+
self[:version].read first_line_words[2]
|
75
|
+
|
78
76
|
# requests can sometimes have a payload
|
79
|
-
|
80
|
-
data = str[data_index + 1..-1].join("\n")
|
81
|
-
headers = str[0..data_index - 1].join("\n")
|
82
|
-
else
|
83
|
-
headers = str.join("\n")
|
84
|
-
end
|
77
|
+
headers, data = headers_and_payload_from_lines(lines)
|
85
78
|
self[:headers].read(headers)
|
86
|
-
self[:body].read
|
79
|
+
self[:body].read(data)
|
80
|
+
|
87
81
|
self
|
88
82
|
end
|
89
83
|
|
90
84
|
# String representation of data.
|
91
85
|
# @return [String]
|
92
86
|
def to_s
|
93
|
-
raise FormatError, 'Missing #verb.'
|
87
|
+
raise FormatError, 'Missing #verb.' if self.verb.empty?
|
94
88
|
raise FormatError, 'Missing #path.' if self.path.empty?
|
95
89
|
raise FormatError, 'Missing #version.' if self.version.empty?
|
96
90
|
|
97
|
-
|
98
|
-
|
91
|
+
"#{self.verb.dup} #{self.path} #{self.version}\r\n#{self[:headers]}#{self.body}"
|
92
|
+
end
|
93
|
+
|
94
|
+
private
|
95
|
+
|
96
|
+
# @todo check verb is correct or raise a ParseError
|
97
|
+
def lines(str)
|
98
|
+
str = str.bytes.map!(&:chr).join unless str.valid_encoding?
|
99
|
+
# vrb = HTTP::VERBS.detect { |verb| str.include?(verb) }
|
100
|
+
|
101
|
+
str.split("\r\n").map(&:chomp)
|
102
|
+
end
|
103
|
+
|
104
|
+
def headers_and_payload_from_lines(lines)
|
105
|
+
if (data_index = lines.find_index(''))
|
106
|
+
data = lines[data_index + 1..-1].join("\n")
|
107
|
+
headers = lines[0..data_index - 1].join("\n")
|
108
|
+
else
|
109
|
+
headers = lines.join("\n")
|
110
|
+
data = nil
|
111
|
+
end
|
112
|
+
|
113
|
+
[headers, data]
|
99
114
|
end
|
100
115
|
end
|
101
116
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
module HTTP
|
@@ -68,10 +68,10 @@ module PacketGen
|
|
68
68
|
# @return [PacketGen::HTTP::Response]
|
69
69
|
def read(str)
|
70
70
|
str = str.bytes.map!(&:chr).join unless str.valid_encoding?
|
71
|
-
arr
|
71
|
+
arr = str.split("\r\n")
|
72
72
|
headers = [] # header stream
|
73
|
-
data
|
74
|
-
switch
|
73
|
+
data = [] # data stream
|
74
|
+
switch = false
|
75
75
|
arr.each do |line|
|
76
76
|
if line.empty?
|
77
77
|
data << line if switch # already done
|
@@ -103,8 +103,8 @@ module PacketGen
|
|
103
103
|
raise FormatError, 'Missing #status_mesg.' if self.status_mesg.empty?
|
104
104
|
raise FormatError, 'Missing #version.' if self.version.empty?
|
105
105
|
|
106
|
-
str = ''
|
107
|
-
str << self
|
106
|
+
str = +''
|
107
|
+
str << self.version << ' ' << self.status_code << ' ' << self.status_mesg << "\r\n"
|
108
108
|
str << self[:headers].to_s if self[:headers].given?
|
109
109
|
str << self.body
|
110
110
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
# @since 2.2.0
|
@@ -16,7 +16,7 @@ module PacketGen
|
|
16
16
|
VERBS = %w[GET HEAD POST PUT DELETE CONNECT OPTIONS TRACE PATCH].freeze
|
17
17
|
|
18
18
|
# Identifiable HTTP request regular expression.
|
19
|
-
REQUEST_REGEX = Regexp.new(
|
19
|
+
REQUEST_REGEX = Regexp.new("(#{VERBS.dup.join('|')})\\s+\\S+\\s+HTTP/1.1")
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
# ICMP header ({https://tools.ietf.org/html/rfc792 RFC 792})
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
# ICMPv6 header ({https://tools.ietf.org/html/rfc4443 RFC 4443})
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
# This class supports IGMPv2 (RFC 2236).
|
@@ -46,10 +46,10 @@ module PacketGen
|
|
46
46
|
|
47
47
|
# Known types
|
48
48
|
TYPES = {
|
49
|
-
'MembershipQuery'
|
49
|
+
'MembershipQuery' => 0x11,
|
50
50
|
'MembershipReportv1' => 0x12,
|
51
51
|
'MembershipReportv2' => 0x16,
|
52
|
-
'LeaveGroup'
|
52
|
+
'LeaveGroup' => 0x17,
|
53
53
|
}.freeze
|
54
54
|
|
55
55
|
# @!attribute type
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
# This class supports IGMPv3 (RFC3376).
|
@@ -66,7 +66,7 @@ module PacketGen
|
|
66
66
|
class IGMPv3 < IGMP
|
67
67
|
# Known types
|
68
68
|
TYPES = {
|
69
|
-
'MembershipQuery'
|
69
|
+
'MembershipQuery' => 0x11,
|
70
70
|
'MembershipReport' => 0x22,
|
71
71
|
}.freeze
|
72
72
|
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
class IGMPv3
|
@@ -40,14 +40,16 @@ module PacketGen
|
|
40
40
|
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
41
41
|
# @author Sylvain Daubert
|
42
42
|
class GroupRecord < Types::Fields
|
43
|
+
include Types::Fieldable
|
44
|
+
|
43
45
|
# Known record types
|
44
46
|
RECORD_TYPES = {
|
45
|
-
'MODE_IS_INCLUDE'
|
46
|
-
'MODE_IS_EXCLUDE'
|
47
|
+
'MODE_IS_INCLUDE' => 1,
|
48
|
+
'MODE_IS_EXCLUDE' => 2,
|
47
49
|
'CHANGE_TO_INCLUDE_MODE' => 3,
|
48
50
|
'CHANGE_TO_EXCLUDE_MODE' => 4,
|
49
|
-
'ALLOW_NEW_SOURCES'
|
50
|
-
'BLOCK_OLD_SOURCES'
|
51
|
+
'ALLOW_NEW_SOURCES' => 5,
|
52
|
+
'BLOCK_OLD_SOURCES' => 6
|
51
53
|
}.freeze
|
52
54
|
|
53
55
|
# @!attribute type
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is part of PacketGen
|
2
4
|
# See https://github.com/sdaubert/packetgen for more informations
|
3
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
4
6
|
# This program is published under MIT license.
|
5
7
|
|
6
|
-
# frozen_string_literal: true
|
7
|
-
|
8
8
|
module PacketGen
|
9
9
|
module Header
|
10
10
|
class IGMPv3
|