packetgen 3.1.3 → 3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packetgen.rb +24 -2
- data/lib/packetgen/capture.rb +30 -24
- data/lib/packetgen/config.rb +2 -2
- 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 +2 -4
- 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 +8 -4
- data/lib/packetgen/header/dhcpv6/option.rb +4 -4
- 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 +2 -2
- 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 +2 -2
- data/lib/packetgen/header/dns/question.rb +35 -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 +5 -13
- data/lib/packetgen/header/dot11/control.rb +5 -5
- data/lib/packetgen/header/dot11/data.rb +2 -2
- 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 +6 -6
- data/lib/packetgen/header/eap.rb +16 -16
- 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 +8 -5
- data/lib/packetgen/header/gre.rb +2 -2
- data/lib/packetgen/header/http.rb +2 -0
- data/lib/packetgen/header/http/headers.rb +2 -2
- data/lib/packetgen/header/http/request.rb +5 -5
- data/lib/packetgen/header/http/response.rb +6 -6
- data/lib/packetgen/header/http/verbs.rb +2 -2
- 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 +6 -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 +3 -5
- data/lib/packetgen/header/ip/addr.rb +7 -2
- data/lib/packetgen/header/ip/option.rb +4 -6
- data/lib/packetgen/header/ip/options.rb +3 -5
- data/lib/packetgen/header/ipv6.rb +2 -2
- data/lib/packetgen/header/ipv6/addr.rb +7 -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 +2 -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 +2 -2
- data/lib/packetgen/header/ospfv2/ls_update.rb +2 -2
- data/lib/packetgen/header/ospfv2/lsa.rb +3 -5
- data/lib/packetgen/header/ospfv2/lsa_header.rb +6 -6
- 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 +2 -2
- data/lib/packetgen/header/ospfv3/ls_ack.rb +2 -2
- data/lib/packetgen/header/ospfv3/ls_request.rb +2 -2
- data/lib/packetgen/header/ospfv3/ls_update.rb +2 -2
- data/lib/packetgen/header/ospfv3/lsa.rb +3 -5
- data/lib/packetgen/header/ospfv3/lsa_header.rb +7 -7
- data/lib/packetgen/header/snmp.rb +31 -28
- data/lib/packetgen/header/tcp.rb +3 -3
- data/lib/packetgen/header/tcp/option.rb +3 -5
- 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 +24 -5
- data/lib/packetgen/packet.rb +76 -51
- data/lib/packetgen/pcap.rb +29 -0
- data/lib/packetgen/pcapng.rb +2 -2
- data/lib/packetgen/pcapng/block.rb +12 -12
- data/lib/packetgen/pcapng/epb.rb +3 -7
- data/lib/packetgen/pcapng/file.rb +134 -95
- data/lib/packetgen/pcapng/idb.rb +30 -30
- data/lib/packetgen/pcapng/shb.rb +25 -34
- data/lib/packetgen/pcapng/spb.rb +4 -8
- data/lib/packetgen/pcapng/unknown_block.rb +2 -2
- data/lib/packetgen/pcaprub_wrapper.rb +67 -0
- data/lib/packetgen/proto.rb +2 -2
- data/lib/packetgen/types.rb +2 -0
- data/lib/packetgen/types/abstract_tlv.rb +24 -6
- data/lib/packetgen/types/array.rb +5 -5
- data/lib/packetgen/types/cstring.rb +2 -2
- data/lib/packetgen/types/enum.rb +3 -2
- data/lib/packetgen/types/fields.rb +5 -7
- data/lib/packetgen/types/int.rb +3 -5
- data/lib/packetgen/types/int_string.rb +2 -2
- data/lib/packetgen/types/length_from.rb +3 -3
- data/lib/packetgen/types/oui.rb +2 -2
- data/lib/packetgen/types/string.rb +2 -2
- data/lib/packetgen/types/tlv.rb +2 -2
- data/lib/packetgen/utils.rb +2 -2
- data/lib/packetgen/utils/arp_spoofer.rb +2 -2
- data/lib/packetgen/version.rb +3 -3
- metadata +26 -50
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2adf2b07c2d2d334e4f0ae6e4e7b49571d4d436788bef51df6cf7c1a5aaba9c8
|
4
|
+
data.tar.gz: 8997321a31379ea6952ab42a4642d98a717587ed777652ebdb9e25b5928cc8d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5af6e0d04f8bb03af01d63cde3879a6a13c8a78477811be2b95fee5c597820f4714f8ac8b69f4aa8f04d3d5b81c5e25b5787815ee2237a8c3329721b5dc7895
|
7
|
+
data.tar.gz: 6eebb203f8dfde49505987d16778c1ecbc81c463d6ac8b5f005e2c6f486166ba0cceabd848d3b3aeebe867b138993171026e8dcacfb04c84a126bc149ff5c616
|
data/lib/packetgen.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
# This file is part of PacketGen
|
3
5
|
# See https://github.com/sdaubert/packetgen for more informations
|
4
6
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
5
7
|
# This program is published under MIT license.
|
6
8
|
|
7
|
-
# frozen_string_literal: true
|
8
|
-
|
9
9
|
require 'packetgen/version'
|
10
10
|
require 'interfacez'
|
11
11
|
|
@@ -24,6 +24,26 @@ module PacketGen
|
|
24
24
|
# Sending packet on wire error
|
25
25
|
class WireError < Error; end
|
26
26
|
|
27
|
+
# No known binding
|
28
|
+
class BindingError < Error
|
29
|
+
# @return [Headerable]
|
30
|
+
attr_reader :prev_hdr
|
31
|
+
# @return [Headerable]
|
32
|
+
attr_reader :hdr
|
33
|
+
|
34
|
+
def initialize(prev_hdr, hdr)
|
35
|
+
@prev_hdr = prev_hdr
|
36
|
+
@hdr = hdr
|
37
|
+
end
|
38
|
+
|
39
|
+
def message
|
40
|
+
"#{prev_hdr.class} knowns no layer association with #{hdr.protocol_name}. " \
|
41
|
+
"Try #{prev_hdr.class}.bind_layer(#{hdr.class}, " \
|
42
|
+
"#{prev_hdr.method_name}_proto_field: " \
|
43
|
+
"<value_for_#{hdr.method_name}>)"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
27
47
|
# Shortcut for {Packet.gen}
|
28
48
|
# @param [String] protocol base protocol for packet
|
29
49
|
# @param [Hash] options specific options for +protocol+
|
@@ -97,6 +117,8 @@ require 'packetgen/deprecation'
|
|
97
117
|
require 'packetgen/types'
|
98
118
|
require 'packetgen/inspect'
|
99
119
|
require 'packetgen/pcapng'
|
120
|
+
require 'packetgen/pcap'
|
100
121
|
require 'packetgen/packet'
|
101
122
|
require 'packetgen/capture'
|
123
|
+
require 'packetgen/inject'
|
102
124
|
require 'packetgen/proto'
|
data/lib/packetgen/capture.rb
CHANGED
@@ -1,21 +1,19 @@
|
|
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
|
-
|
6
|
-
# frozen_string_literal: true
|
7
|
+
require_relative 'pcaprub_wrapper'
|
7
8
|
|
8
9
|
module PacketGen
|
9
10
|
# Capture packets from wire
|
10
11
|
# @author Sylvain Daubert
|
11
12
|
# @author Kent 'picat' Gruber
|
12
13
|
class Capture
|
13
|
-
# Default snaplen to use if :snaplen option not defined.
|
14
|
-
DEFAULT_SNAPLEN = 0xffff
|
15
|
-
|
16
14
|
private
|
17
15
|
|
18
|
-
attr_reader :filter, :cap_thread
|
16
|
+
attr_reader :filter, :cap_thread, :snaplen, :promisc
|
19
17
|
|
20
18
|
public
|
21
19
|
|
@@ -44,8 +42,8 @@ module PacketGen
|
|
44
42
|
# @param [Integer] snaplen maximum number of bytes to capture for
|
45
43
|
# each packet.
|
46
44
|
# @since 2.0.0 remove old 1.x API
|
47
|
-
# @since 3.0.0 arguments are kwargs and
|
48
|
-
def initialize(iface: nil, max: nil, timeout: nil, filter: nil, promisc: false, parse: true, snaplen:
|
45
|
+
# @since 3.0.0 arguments are kwargs and no more a hash
|
46
|
+
def initialize(iface: nil, max: nil, timeout: nil, filter: nil, promisc: false, parse: true, snaplen: nil)
|
49
47
|
@iface = iface || Interfacez.default || Interfacez.loopback
|
50
48
|
|
51
49
|
@packets = []
|
@@ -57,23 +55,13 @@ module PacketGen
|
|
57
55
|
# @see {#initialize} for parameters
|
58
56
|
# @yieldparam [Packet,String] packet if a block is given, yield each
|
59
57
|
# captured packet (Packet or raw data String, depending on +:parse+ option)
|
60
|
-
# @since 3.0.0 arguments are kwargs and
|
61
|
-
def start(iface: nil, max: nil, timeout: nil, filter: nil, promisc: false, parse: true, snaplen:
|
58
|
+
# @since 3.0.0 arguments are kwargs and no more a hash
|
59
|
+
def start(iface: nil, max: nil, timeout: nil, filter: nil, promisc: false, parse: true, snaplen: nil, &block)
|
62
60
|
set_options iface, max, timeout, filter, promisc, parse, snaplen
|
63
61
|
|
64
|
-
pcap = PCAPRUB::Pcap.open_live(self.iface, @snaplen, @promisc, 1)
|
65
|
-
set_filter_on pcap
|
66
|
-
|
67
62
|
@cap_thread = Thread.new do
|
68
|
-
|
69
|
-
|
70
|
-
if @parse
|
71
|
-
packet = Packet.parse(packet_data)
|
72
|
-
packets << packet
|
73
|
-
yield packet if block_given?
|
74
|
-
elsif block_given?
|
75
|
-
yield packet_data
|
76
|
-
end
|
63
|
+
PCAPRUBWrapper.capture(**capture_args) do |packet_data|
|
64
|
+
add_packet(packet_data, &block)
|
77
65
|
break if defined?(@max) && (raw_packets.size >= @max)
|
78
66
|
end
|
79
67
|
end
|
@@ -101,10 +89,28 @@ module PacketGen
|
|
101
89
|
@iface = iface unless iface.nil?
|
102
90
|
end
|
103
91
|
|
104
|
-
def
|
92
|
+
def capture_args
|
93
|
+
h = { iface: iface, filter: filter }
|
94
|
+
h[:snaplen] = snaplen unless snaplen.nil?
|
95
|
+
h[:promisc] = promisc unless promisc.nil?
|
96
|
+
h
|
97
|
+
end
|
98
|
+
|
99
|
+
def filter_on(pcap)
|
105
100
|
return if filter.nil? || filter.empty?
|
106
101
|
|
107
|
-
pcap
|
102
|
+
PCAPRUBWrapper.filter_on(pcap: pcap, filter: filter)
|
103
|
+
end
|
104
|
+
|
105
|
+
def add_packet(data, &block)
|
106
|
+
raw_packets << data
|
107
|
+
if @parse
|
108
|
+
packet = Packet.parse(data)
|
109
|
+
packets << packet
|
110
|
+
block&.call(packet)
|
111
|
+
elsif block
|
112
|
+
yield data
|
113
|
+
end
|
108
114
|
end
|
109
115
|
end
|
110
116
|
end
|
data/lib/packetgen/config.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
|
require 'socket'
|
9
9
|
require 'singleton'
|
10
10
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module PacketGen
|
2
4
|
# Deprecation module
|
3
5
|
# @since 2.7.0
|
@@ -8,6 +10,14 @@ module PacketGen
|
|
8
10
|
# @since 3.1.0
|
9
11
|
REMOVE_VERSION = '4.0.0'
|
10
12
|
|
13
|
+
# @private
|
14
|
+
# @param [String] remove_version
|
15
|
+
# @return [String]
|
16
|
+
# @since 3.1.4
|
17
|
+
def self.removed(remove_version)
|
18
|
+
"It will be removed in PacketGen #{remove_version}"
|
19
|
+
end
|
20
|
+
|
11
21
|
# Warn when using a deprecated method
|
12
22
|
# @param [Module] klass class/module of deprecated method
|
13
23
|
# @param [Symbol,String] deprecated_method
|
@@ -17,15 +27,14 @@ module PacketGen
|
|
17
27
|
# @param [String] remove_version version from which +deprecated_method+ will
|
18
28
|
# no more exist.
|
19
29
|
def self.deprecated(klass, deprecated_method, new_method=nil, klass_method: false, remove_version: REMOVE_VERSION)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
complete_new_method_name = base_name + new_method.to_s unless new_method.nil?
|
30
|
+
base_name = "#{klass}#{klass_method ? '.' : '#'}"
|
31
|
+
complete_deprecated_method_name = "#{base_name}#{deprecated_method}"
|
32
|
+
complete_new_method_name = "#{base_name}#{new_method}" unless new_method.nil?
|
24
33
|
|
25
|
-
file, line = caller(2).
|
34
|
+
file, line = caller(2..2).split(':')[0, 2]
|
26
35
|
message = +"#{file}:#{line}: #{complete_deprecated_method_name} is deprecated"
|
27
36
|
message << " in favor of #{complete_new_method_name}" unless new_method.nil?
|
28
|
-
message <<
|
37
|
+
message << '. ' << self.removed(remove_version)
|
29
38
|
warn message
|
30
39
|
end
|
31
40
|
|
@@ -39,7 +48,24 @@ module PacketGen
|
|
39
48
|
file, line = caller(2..2).first.split(':')[0, 2]
|
40
49
|
message = +"#{file}:#{line}: #{klass} is deprecated"
|
41
50
|
message << " in favor of #{new_klass}" unless new_klass.nil?
|
42
|
-
message <<
|
51
|
+
message << '. ' << self.removed(remove_version)
|
52
|
+
warn message
|
53
|
+
end
|
54
|
+
|
55
|
+
# Warn when using a deprecated method's option
|
56
|
+
# @param [Module] klass deprecated class/module
|
57
|
+
# @param [Module] method method name
|
58
|
+
# @param [Symbol] option option name
|
59
|
+
# @param [Boolean] klass_method +deprecated_method+ is a class method (+true+)
|
60
|
+
# or a, instance one (+false+)
|
61
|
+
# @param [String] remove_version version from which +klass+ will
|
62
|
+
# no more exist.
|
63
|
+
# @since 3.1.4
|
64
|
+
def self.deprecated_option(klass, method, option, klass_method: false, remove_version: REMOVE_VERSION)
|
65
|
+
base_name = "#{klass}#{klass_method ? '.' : '#'}"
|
66
|
+
method_name = "#{base_name}#{method}"
|
67
|
+
message = +"option #{option} is deprecated for method #{method_name}. "
|
68
|
+
message << self.removed(remove_version)
|
43
69
|
warn message
|
44
70
|
end
|
45
71
|
end
|
data/lib/packetgen/header.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
# This file is part of PacketGen
|
3
5
|
# See https://github.com/sdaubert/packetgen for more informations
|
4
6
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
5
7
|
# This program is published under MIT license.
|
6
8
|
|
7
|
-
# frozen_string_literal: true
|
8
|
-
|
9
9
|
module PacketGen
|
10
10
|
# Namespace for protocol header classes.
|
11
11
|
#
|
@@ -30,13 +30,6 @@ module PacketGen
|
|
30
30
|
# pkt.myheader.field2.read 0x01
|
31
31
|
# @author Sylvain Daubert
|
32
32
|
module Header
|
33
|
-
# @private snap length for PCAPRUB
|
34
|
-
PCAP_SNAPLEN = 0xffff
|
35
|
-
# @private promiscuous (or not) for PCAPRUB
|
36
|
-
PCAP_PROMISC = false
|
37
|
-
# @private timeout for PCAPRUB
|
38
|
-
PCAP_TIMEOUT = 1
|
39
|
-
|
40
33
|
@added_header_classes = {}
|
41
34
|
|
42
35
|
class << self
|
data/lib/packetgen/header/arp.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 ARP header consists of:
|
@@ -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
|
require 'rasn1'
|
9
9
|
|
10
10
|
module PacketGen
|
@@ -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
|
# @abstract Base class for all header types.
|
@@ -193,7 +193,6 @@ module PacketGen
|
|
193
193
|
end
|
194
194
|
end
|
195
195
|
|
196
|
-
|
197
196
|
# Helper method to calculate length of +hdr+ and set its +length+ field.
|
198
197
|
# To be used by +#calc_length+ in Base subclasses.
|
199
198
|
# @param [Base] hdr
|
@@ -221,7 +220,6 @@ module PacketGen
|
|
221
220
|
super
|
222
221
|
end
|
223
222
|
|
224
|
-
|
225
223
|
# @api private
|
226
224
|
# Get +header+ id in {Packet#headers} array
|
227
225
|
# @param [Header] header
|
@@ -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
|
# Bootstrap Protocol, {https://tools.ietf.org/html/rfc951
|
@@ -45,7 +45,7 @@ module PacketGen
|
|
45
45
|
# DHCP opcodes
|
46
46
|
OPCODES = {
|
47
47
|
'BOOTREQUEST' => 1,
|
48
|
-
'BOOTREPLY'
|
48
|
+
'BOOTREPLY' => 2
|
49
49
|
}.freeze
|
50
50
|
|
51
51
|
# @!attribute op
|
@@ -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
|
# Dynamic Host Configuration Protocol, {https://tools.ietf.org/html/rfc2131
|
@@ -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 DHCP
|
@@ -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 DHCP
|
@@ -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
|
# Dynamic Host Configuration Protocol for IPv6, {https://tools.ietf.org/html/rfc3315
|
@@ -55,16 +55,16 @@ module PacketGen
|
|
55
55
|
|
56
56
|
# DHCPv6 message types
|
57
57
|
MESSAGE_TYPES = {
|
58
|
-
'SOLLICIT'
|
59
|
-
'ADVERTISE'
|
60
|
-
'REQUEST'
|
61
|
-
'CONFIRM'
|
62
|
-
'RENEW'
|
63
|
-
'REBIND'
|
64
|
-
'REPLY'
|
65
|
-
'RELEASE'
|
66
|
-
'DECLINE'
|
67
|
-
'RECONFIGURE'
|
58
|
+
'SOLLICIT' => 1,
|
59
|
+
'ADVERTISE' => 2,
|
60
|
+
'REQUEST' => 3,
|
61
|
+
'CONFIRM' => 4,
|
62
|
+
'RENEW' => 5,
|
63
|
+
'REBIND' => 6,
|
64
|
+
'REPLY' => 7,
|
65
|
+
'RELEASE' => 8,
|
66
|
+
'DECLINE' => 9,
|
67
|
+
'RECONFIGURE' => 10,
|
68
68
|
'INFORMATION-REQUEST' => 11
|
69
69
|
}.freeze
|
70
70
|
|
@@ -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 DHCPv6
|
@@ -13,8 +13,8 @@ module PacketGen
|
|
13
13
|
class DUID < Types::Fields
|
14
14
|
TYPES = {
|
15
15
|
'DUID-LLT' => 1,
|
16
|
-
'DUID-EN'
|
17
|
-
'DUID-LL'
|
16
|
+
'DUID-EN' => 2,
|
17
|
+
'DUID-LL' => 3
|
18
18
|
}.freeze
|
19
19
|
|
20
20
|
# @!attribute type
|
@@ -58,6 +58,8 @@ module PacketGen
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
# rubocop:disable Naming/ClassAndModuleCamelCase
|
62
|
+
|
61
63
|
# DUID Based on Link-layer Address Plus Time
|
62
64
|
# @author Sylvain Daubert
|
63
65
|
class DUID_LLT < DUID
|
@@ -140,3 +142,5 @@ module PacketGen
|
|
140
142
|
end
|
141
143
|
end
|
142
144
|
end
|
145
|
+
|
146
|
+
# rubocop:enable Naming/ClassAndModuleCamelCase
|