packetgen 3.3.0 → 3.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -0
- data/README.md +7 -7
- data/lib/packetgen/capture.rb +2 -1
- data/lib/packetgen/config.rb +2 -1
- data/lib/packetgen/header/arp.rb +2 -1
- data/lib/packetgen/header/asn1_base.rb +2 -1
- data/lib/packetgen/header/base.rb +4 -3
- data/lib/packetgen/header/bootp.rb +2 -1
- data/lib/packetgen/header/dhcp/option.rb +2 -1
- data/lib/packetgen/header/dhcp/options.rb +2 -1
- data/lib/packetgen/header/dhcp.rb +2 -1
- data/lib/packetgen/header/dhcpv6/duid.rb +2 -1
- data/lib/packetgen/header/dhcpv6/option.rb +2 -1
- data/lib/packetgen/header/dhcpv6/options.rb +2 -1
- data/lib/packetgen/header/dhcpv6/relay.rb +2 -1
- data/lib/packetgen/header/dhcpv6.rb +2 -1
- data/lib/packetgen/header/dns/name.rb +2 -1
- data/lib/packetgen/header/dns/opt.rb +3 -2
- data/lib/packetgen/header/dns/option.rb +3 -2
- data/lib/packetgen/header/dns/qdsection.rb +2 -1
- data/lib/packetgen/header/dns/question.rb +2 -1
- data/lib/packetgen/header/dns/rr.rb +2 -1
- data/lib/packetgen/header/dns/rrsection.rb +2 -1
- data/lib/packetgen/header/dns.rb +3 -2
- data/lib/packetgen/header/dot11/control.rb +2 -1
- data/lib/packetgen/header/dot11/data.rb +4 -3
- data/lib/packetgen/header/dot11/element.rb +2 -1
- data/lib/packetgen/header/dot11/management.rb +2 -1
- data/lib/packetgen/header/dot11/sub_mngt.rb +2 -1
- data/lib/packetgen/header/dot11.rb +2 -1
- data/lib/packetgen/header/dot1q.rb +2 -1
- data/lib/packetgen/header/dot1x.rb +2 -1
- data/lib/packetgen/header/eap/fast.rb +2 -1
- data/lib/packetgen/header/eap/md5.rb +2 -1
- data/lib/packetgen/header/eap/tls.rb +3 -2
- data/lib/packetgen/header/eap/ttls.rb +3 -2
- data/lib/packetgen/header/eap.rb +3 -2
- data/lib/packetgen/header/eth.rb +3 -2
- data/lib/packetgen/header/gre.rb +2 -1
- data/lib/packetgen/header/http/headers.rb +4 -3
- data/lib/packetgen/header/http/request.rb +2 -1
- data/lib/packetgen/header/http/response.rb +2 -1
- data/lib/packetgen/header/http/verbs.rb +2 -1
- data/lib/packetgen/header/http.rb +2 -1
- data/lib/packetgen/header/icmp.rb +2 -1
- data/lib/packetgen/header/icmpv6.rb +2 -1
- data/lib/packetgen/header/igmp.rb +2 -1
- data/lib/packetgen/header/igmpv3/group_record.rb +2 -1
- data/lib/packetgen/header/igmpv3/mq.rb +2 -1
- data/lib/packetgen/header/igmpv3/mr.rb +2 -1
- data/lib/packetgen/header/igmpv3.rb +2 -1
- data/lib/packetgen/header/ip/addr.rb +2 -1
- data/lib/packetgen/header/ip/option.rb +3 -2
- data/lib/packetgen/header/ip/options.rb +2 -1
- data/lib/packetgen/header/ip.rb +3 -2
- data/lib/packetgen/header/ipv6/addr.rb +2 -1
- data/lib/packetgen/header/ipv6/extension.rb +2 -1
- data/lib/packetgen/header/ipv6/hop_by_hop.rb +2 -1
- data/lib/packetgen/header/ipv6.rb +2 -1
- data/lib/packetgen/header/llc.rb +2 -1
- data/lib/packetgen/header/mdns.rb +2 -1
- data/lib/packetgen/header/mld.rb +2 -1
- data/lib/packetgen/header/mldv2/mcast_address_record.rb +2 -1
- data/lib/packetgen/header/mldv2/mlq.rb +2 -1
- data/lib/packetgen/header/mldv2/mlr.rb +2 -1
- data/lib/packetgen/header/mldv2.rb +2 -1
- data/lib/packetgen/header/ospfv2/db_description.rb +2 -1
- data/lib/packetgen/header/ospfv2/hello.rb +2 -1
- data/lib/packetgen/header/ospfv2/ls_ack.rb +2 -1
- data/lib/packetgen/header/ospfv2/ls_request.rb +2 -1
- data/lib/packetgen/header/ospfv2/ls_update.rb +2 -1
- data/lib/packetgen/header/ospfv2/lsa.rb +2 -1
- data/lib/packetgen/header/ospfv2/lsa_header.rb +2 -1
- data/lib/packetgen/header/ospfv2.rb +2 -1
- data/lib/packetgen/header/ospfv3/db_description.rb +2 -1
- data/lib/packetgen/header/ospfv3/hello.rb +2 -1
- data/lib/packetgen/header/ospfv3/ipv6_prefix.rb +2 -1
- data/lib/packetgen/header/ospfv3/ls_ack.rb +2 -1
- data/lib/packetgen/header/ospfv3/ls_request.rb +2 -1
- data/lib/packetgen/header/ospfv3/ls_update.rb +2 -1
- data/lib/packetgen/header/ospfv3/lsa.rb +2 -1
- data/lib/packetgen/header/ospfv3/lsa_header.rb +2 -1
- data/lib/packetgen/header/ospfv3.rb +2 -1
- data/lib/packetgen/header/sctp/chunk.rb +547 -0
- data/lib/packetgen/header/sctp/error.rb +347 -0
- data/lib/packetgen/header/sctp/padded32.rb +34 -0
- data/lib/packetgen/header/sctp/parameter.rb +229 -0
- data/lib/packetgen/header/sctp.rb +96 -0
- data/lib/packetgen/header/snmp.rb +3 -2
- data/lib/packetgen/header/tcp/option.rb +2 -1
- data/lib/packetgen/header/tcp/options.rb +2 -1
- data/lib/packetgen/header/tcp.rb +3 -2
- data/lib/packetgen/header/tftp.rb +2 -1
- data/lib/packetgen/header/udp.rb +2 -1
- data/lib/packetgen/header.rb +4 -2
- data/lib/packetgen/headerable.rb +2 -1
- data/lib/packetgen/inject.rb +2 -1
- data/lib/packetgen/inspect.rb +2 -1
- data/lib/packetgen/packet.rb +4 -3
- data/lib/packetgen/pcap.rb +2 -1
- data/lib/packetgen/pcapng/block.rb +3 -2
- data/lib/packetgen/pcapng/epb.rb +2 -1
- data/lib/packetgen/pcapng/file.rb +2 -1
- data/lib/packetgen/pcapng/idb.rb +2 -1
- data/lib/packetgen/pcapng/shb.rb +2 -1
- data/lib/packetgen/pcapng/spb.rb +2 -1
- data/lib/packetgen/pcapng/unknown_block.rb +2 -1
- data/lib/packetgen/pcapng.rb +2 -1
- data/lib/packetgen/pcaprub_wrapper.rb +2 -1
- data/lib/packetgen/proto.rb +2 -1
- data/lib/packetgen/types/abstract_tlv.rb +146 -56
- data/lib/packetgen/types/array.rb +20 -3
- data/lib/packetgen/types/cstring.rb +2 -1
- data/lib/packetgen/types/enum.rb +3 -2
- data/lib/packetgen/types/fieldable.rb +3 -2
- data/lib/packetgen/types/fields.rb +8 -7
- data/lib/packetgen/types/int.rb +114 -13
- data/lib/packetgen/types/int_string.rb +2 -1
- data/lib/packetgen/types/length_from.rb +2 -1
- data/lib/packetgen/types/oui.rb +2 -1
- data/lib/packetgen/types/string.rb +2 -1
- data/lib/packetgen/types/tlv.rb +2 -1
- data/lib/packetgen/types.rb +2 -1
- data/lib/packetgen/unknown_packet.rb +3 -2
- data/lib/packetgen/utils/arp_spoofer.rb +4 -3
- data/lib/packetgen/utils.rb +2 -1
- data/lib/packetgen/version.rb +3 -2
- data/lib/packetgen.rb +2 -1
- metadata +27 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8b6287713be7731dc7050bde9a8a568ebbd9696862807303f754a38a8d869f0
|
4
|
+
data.tar.gz: ce5542ab4acd3acc9e6e175eda8c77b1c627a24fc22def27ede0b713dcb86a84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e278d877f15ff1e5e33d97302d2dc2f1b086ad1a4bceb794bf081c4cdd5e37259730db720de5017942fe925df9f163f30e4e8390840e682ce2407228c56ca11e
|
7
|
+
data.tar.gz: 0103233c414436e3a661ddaf2278ea96a6865437a4978098562516e084abe71099d82f2d1bfa0ef292ac886c19ba183550be6de40e8bf7d0ecf1699e3a6b3e35
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/packetgen.svg)](https://badge.fury.io/rb/packetgen)
|
3
|
-
[![Action status](https://github.com/
|
3
|
+
[![Action status](https://github.com/lemontree55/packetgen/workflows/ci/badge.svg?branch=master)](https://github.com/lemontree55/packetgen/actions?query=workflow%3Aci)
|
4
4
|
# PacketGen
|
5
5
|
|
6
6
|
PacketGen provides simple ways to generate, send and capture network packets.
|
@@ -158,26 +158,26 @@ If `pry` gem is installed, it is used as backend for `pgconsole`, else IRB is us
|
|
158
158
|
|
159
159
|
## Plugins
|
160
160
|
|
161
|
-
PacketGen provides a plugin system (see [wiki](https://github.com/
|
161
|
+
PacketGen provides a plugin system (see [wiki](https://github.com/lemontree55/packetgen/wiki/Create-Custom-Protocol)).
|
162
162
|
|
163
163
|
Available plugins (available as gem) are:
|
164
164
|
|
165
|
-
* [packetgen-plugin-ipsec](https://github.com/
|
166
|
-
* [packetgen-plugin-smb](https://github.com/
|
165
|
+
* [packetgen-plugin-ipsec](https://github.com/lemontree55/packetgen-plugin-ipsec): add support for ESP and IKEv2 protocols. Before PacketGen3, these protocols were included in packetgen.
|
166
|
+
* [packetgen-plugin-smb](https://github.com/lemontree55/packetgen-plugin-smb): add support for SMB protocol suite.
|
167
167
|
|
168
168
|
## See also
|
169
169
|
|
170
|
-
Wiki: https://github.com/
|
170
|
+
Wiki: https://github.com/lemontree55/packetgen/wiki
|
171
171
|
|
172
172
|
API documentation: http://www.rubydoc.info/gems/packetgen
|
173
173
|
|
174
174
|
## Contributing
|
175
175
|
|
176
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
176
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/lemontree55/packetgen.
|
177
177
|
|
178
178
|
## License
|
179
179
|
|
180
|
-
MIT License (see [LICENSE](https://github.com/
|
180
|
+
MIT License (see [LICENSE](https://github.com/lemontree55/packetgen/blob/master/LICENSE))
|
181
181
|
|
182
182
|
### Other sources
|
183
183
|
All original code maintains its copyright from its original authors and licensing.
|
data/lib/packetgen/capture.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
require_relative 'pcaprub_wrapper'
|
8
9
|
|
data/lib/packetgen/config.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
require 'socket'
|
data/lib/packetgen/header/arp.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
require 'rasn1'
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -38,14 +39,14 @@ module PacketGen
|
|
38
39
|
def set(fields)
|
39
40
|
case self[:value]
|
40
41
|
when Proc
|
41
|
-
fields.send
|
42
|
+
fields.send(:"#{self[:key]}=", self[:value].call(nil))
|
42
43
|
else
|
43
44
|
attr = if self[:key].to_s.end_with?('?')
|
44
45
|
self[:key].to_s[0..-2]
|
45
46
|
else
|
46
47
|
self[:key]
|
47
48
|
end
|
48
|
-
fields.send
|
49
|
+
fields.send(:"#{attr}=", self[:value])
|
49
50
|
end
|
50
51
|
end
|
51
52
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
require_relative 'option'
|
@@ -37,7 +38,7 @@ module PacketGen
|
|
37
38
|
# @option options [String] :rdata
|
38
39
|
def initialize(dns, options={})
|
39
40
|
opts = { name: '.', rrclass: 512, type: 41 }.merge!(options)
|
40
|
-
super
|
41
|
+
super(dns, opts)
|
41
42
|
|
42
43
|
self.udp_size = options[:udp_size] if options[:udp_size]
|
43
44
|
self.ext_rcode = options[:ext_rcode] if options[:ext_rcode]
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -11,7 +12,7 @@ module PacketGen
|
|
11
12
|
# @!parse
|
12
13
|
# # DNS option is a TLV object:
|
13
14
|
# # * {#code} is a {Types::Int16},
|
14
|
-
# # * {#length
|
15
|
+
# # * {#length} is a {Types::Int16},
|
15
16
|
# # * {#data} is a {Types::String}.
|
16
17
|
# #
|
17
18
|
# # @since 1.3.0
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
data/lib/packetgen/header/dns.rb
CHANGED
@@ -2,8 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# This file is part of PacketGen
|
5
|
-
# See https://github.com/
|
5
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
6
6
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
7
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
7
8
|
# This program is published under MIT license.
|
8
9
|
|
9
10
|
module PacketGen
|
@@ -256,7 +257,7 @@ module PacketGen
|
|
256
257
|
private
|
257
258
|
|
258
259
|
def inspect_flags
|
259
|
-
flags = %i[qr aa tc rd ra].select! { |flag| send
|
260
|
+
flags = %i[qr aa tc rd ra].select! { |flag| send(:"#{flag}?") }.map(&:to_s).join(',')
|
260
261
|
str = Inspect.shift_level
|
261
262
|
str << Inspect::FMT_ATTR % ['Flags', 'flags', flags]
|
262
263
|
end
|
@@ -2,8 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# This file is part of PacketGen
|
5
|
-
# See https://github.com/
|
5
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
6
6
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
7
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
7
8
|
# This program is published under MIT license.
|
8
9
|
|
9
10
|
module PacketGen
|
@@ -2,8 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# This file is part of PacketGen
|
5
|
-
# See https://github.com/
|
5
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
6
6
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
7
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
7
8
|
# This program is published under MIT license.
|
8
9
|
|
9
10
|
module PacketGen
|
@@ -76,7 +77,7 @@ module PacketGen
|
|
76
77
|
# @return [String]
|
77
78
|
def dst=(mac)
|
78
79
|
_src_mac, dst_mac = src_dst_from_mac
|
79
|
-
self.send("#{dst_mac}=", mac)
|
80
|
+
self.send(:"#{dst_mac}=", mac)
|
80
81
|
end
|
81
82
|
|
82
83
|
# Get source MAC address
|
@@ -91,7 +92,7 @@ module PacketGen
|
|
91
92
|
# @return [String]
|
92
93
|
def src=(mac)
|
93
94
|
src_mac, = src_dst_from_mac
|
94
|
-
self.send("#{src_mac}=", mac)
|
95
|
+
self.send(:"#{src_mac}=", mac)
|
95
96
|
end
|
96
97
|
|
97
98
|
private
|
@@ -2,8 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# This file is part of PacketGen
|
5
|
-
# See https://github.com/
|
5
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
6
6
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
7
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
7
8
|
# This program is published under MIT license.
|
8
9
|
|
9
10
|
module PacketGen
|
@@ -2,8 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# This file is part of PacketGen
|
5
|
-
# See https://github.com/
|
5
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
6
6
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
7
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
7
8
|
# This program is published under MIT license.
|
8
9
|
|
9
10
|
module PacketGen
|
@@ -2,8 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# This file is part of PacketGen
|
5
|
-
# See https://github.com/
|
5
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
6
6
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
7
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
7
8
|
# This program is published under MIT license.
|
8
9
|
|
9
10
|
module PacketGen
|
@@ -2,8 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# This file is part of PacketGen
|
5
|
-
# See https://github.com/
|
5
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
6
6
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
7
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
7
8
|
# This program is published under MIT license.
|
8
9
|
|
9
10
|
require 'zlib'
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -51,7 +52,7 @@ module PacketGen
|
|
51
52
|
next unless attr == :flags
|
52
53
|
|
53
54
|
str = Inspect.shift_level
|
54
|
-
value = %i[l m s].map { |f| send("#{f}?") ? f.to_s : '.' }.join
|
55
|
+
value = %i[l m s].map { |f| send(:"#{f}?") ? f.to_s : '.' }.join
|
55
56
|
value = '%-16s (0x%02x)' % [value, self.flags]
|
56
57
|
str << Inspect::FMT_ATTR % [self[attr].class.to_s.sub(/.*::/, ''),
|
57
58
|
attr, value]
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -56,7 +57,7 @@ module PacketGen
|
|
56
57
|
|
57
58
|
shift = Inspect.shift_level
|
58
59
|
str = shift.dup
|
59
|
-
value = %i[l m s].map { |f| send("#{f}?") ? f.to_s : '.' }.join
|
60
|
+
value = %i[l m s].map { |f| send(:"#{f}?") ? f.to_s : '.' }.join
|
60
61
|
value = '%-16s (0x%02x)' % [value, self.flags]
|
61
62
|
str << Inspect::FMT_ATTR % [self[attr].class.to_s.sub(/.*::/, ''),
|
62
63
|
attr, value]
|
data/lib/packetgen/header/eap.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -131,7 +132,7 @@ module PacketGen
|
|
131
132
|
# @return [Dot11] may return a subclass object if a more specific class
|
132
133
|
# may be determined
|
133
134
|
def read(str)
|
134
|
-
super
|
135
|
+
super(str)
|
135
136
|
return self unless self.instance_of?(EAP)
|
136
137
|
return self unless type?
|
137
138
|
|
data/lib/packetgen/header/eth.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -64,7 +65,7 @@ module PacketGen
|
|
64
65
|
raise ArgumentError, 'not a MAC address' unless bytes.size == 6
|
65
66
|
|
66
67
|
6.times do |i|
|
67
|
-
self["a#{i}"
|
68
|
+
self[:"a#{i}"].read(bytes[i].to_i(16))
|
68
69
|
end
|
69
70
|
self
|
70
71
|
end
|
data/lib/packetgen/header/gre.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|
@@ -29,12 +30,12 @@ module PacketGen
|
|
29
30
|
def read(s_or_h)
|
30
31
|
case s_or_h
|
31
32
|
when String
|
32
|
-
@data = s_or_h.split("\n").
|
33
|
+
@data = s_or_h.split("\n").filter_map do |h|
|
33
34
|
next unless h.include?(':')
|
34
35
|
|
35
36
|
k, v = h.split(':', 2)
|
36
37
|
[k, v.strip]
|
37
|
-
end.
|
38
|
+
end.to_h
|
38
39
|
when Hash
|
39
40
|
@data = s_or_h
|
40
41
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is part of PacketGen
|
4
|
-
# See https://github.com/
|
4
|
+
# See https://github.com/lemontree55/packetgen for more informations
|
5
5
|
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
|
6
|
+
# Copyright (C) 2024 LemonTree55 <lenontree@proton.me>
|
6
7
|
# This program is published under MIT license.
|
7
8
|
|
8
9
|
module PacketGen
|