packetgen 3.1.3 → 3.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/lib/packetgen.rb +24 -2
  3. data/lib/packetgen/capture.rb +30 -24
  4. data/lib/packetgen/config.rb +2 -2
  5. data/lib/packetgen/deprecation.rb +33 -7
  6. data/lib/packetgen/header.rb +2 -9
  7. data/lib/packetgen/header/arp.rb +2 -2
  8. data/lib/packetgen/header/asn1_base.rb +2 -2
  9. data/lib/packetgen/header/base.rb +2 -4
  10. data/lib/packetgen/header/bootp.rb +3 -3
  11. data/lib/packetgen/header/dhcp.rb +2 -2
  12. data/lib/packetgen/header/dhcp/option.rb +2 -2
  13. data/lib/packetgen/header/dhcp/options.rb +2 -2
  14. data/lib/packetgen/header/dhcpv6.rb +12 -12
  15. data/lib/packetgen/header/dhcpv6/duid.rb +8 -4
  16. data/lib/packetgen/header/dhcpv6/option.rb +4 -4
  17. data/lib/packetgen/header/dhcpv6/options.rb +2 -2
  18. data/lib/packetgen/header/dhcpv6/relay.rb +2 -2
  19. data/lib/packetgen/header/dns.rb +9 -9
  20. data/lib/packetgen/header/dns/name.rb +2 -2
  21. data/lib/packetgen/header/dns/opt.rb +2 -2
  22. data/lib/packetgen/header/dns/option.rb +2 -2
  23. data/lib/packetgen/header/dns/qdsection.rb +2 -2
  24. data/lib/packetgen/header/dns/question.rb +35 -35
  25. data/lib/packetgen/header/dns/rr.rb +3 -3
  26. data/lib/packetgen/header/dns/rrsection.rb +2 -2
  27. data/lib/packetgen/header/dot11.rb +5 -13
  28. data/lib/packetgen/header/dot11/control.rb +5 -5
  29. data/lib/packetgen/header/dot11/data.rb +2 -2
  30. data/lib/packetgen/header/dot11/element.rb +16 -16
  31. data/lib/packetgen/header/dot11/management.rb +2 -2
  32. data/lib/packetgen/header/dot11/sub_mngt.rb +2 -12
  33. data/lib/packetgen/header/dot1q.rb +2 -2
  34. data/lib/packetgen/header/dot1x.rb +6 -6
  35. data/lib/packetgen/header/eap.rb +16 -16
  36. data/lib/packetgen/header/eap/fast.rb +2 -2
  37. data/lib/packetgen/header/eap/md5.rb +2 -2
  38. data/lib/packetgen/header/eap/tls.rb +2 -2
  39. data/lib/packetgen/header/eap/ttls.rb +2 -2
  40. data/lib/packetgen/header/eth.rb +8 -5
  41. data/lib/packetgen/header/gre.rb +2 -2
  42. data/lib/packetgen/header/http.rb +2 -0
  43. data/lib/packetgen/header/http/headers.rb +2 -2
  44. data/lib/packetgen/header/http/request.rb +5 -5
  45. data/lib/packetgen/header/http/response.rb +6 -6
  46. data/lib/packetgen/header/http/verbs.rb +2 -2
  47. data/lib/packetgen/header/icmp.rb +2 -2
  48. data/lib/packetgen/header/icmpv6.rb +2 -2
  49. data/lib/packetgen/header/igmp.rb +4 -4
  50. data/lib/packetgen/header/igmpv3.rb +3 -3
  51. data/lib/packetgen/header/igmpv3/group_record.rb +6 -6
  52. data/lib/packetgen/header/igmpv3/mq.rb +2 -2
  53. data/lib/packetgen/header/igmpv3/mr.rb +2 -2
  54. data/lib/packetgen/header/ip.rb +3 -5
  55. data/lib/packetgen/header/ip/addr.rb +7 -2
  56. data/lib/packetgen/header/ip/option.rb +4 -6
  57. data/lib/packetgen/header/ip/options.rb +3 -5
  58. data/lib/packetgen/header/ipv6.rb +2 -2
  59. data/lib/packetgen/header/ipv6/addr.rb +7 -2
  60. data/lib/packetgen/header/ipv6/extension.rb +2 -2
  61. data/lib/packetgen/header/ipv6/hop_by_hop.rb +3 -3
  62. data/lib/packetgen/header/llc.rb +2 -2
  63. data/lib/packetgen/header/mdns.rb +2 -2
  64. data/lib/packetgen/header/mld.rb +2 -2
  65. data/lib/packetgen/header/mldv2.rb +2 -2
  66. data/lib/packetgen/header/mldv2/mcast_address_record.rb +2 -2
  67. data/lib/packetgen/header/mldv2/mlq.rb +2 -2
  68. data/lib/packetgen/header/mldv2/mlr.rb +2 -2
  69. data/lib/packetgen/header/ospfv2.rb +9 -9
  70. data/lib/packetgen/header/ospfv2/db_description.rb +2 -2
  71. data/lib/packetgen/header/ospfv2/hello.rb +2 -2
  72. data/lib/packetgen/header/ospfv2/ls_ack.rb +2 -2
  73. data/lib/packetgen/header/ospfv2/ls_request.rb +2 -2
  74. data/lib/packetgen/header/ospfv2/ls_update.rb +2 -2
  75. data/lib/packetgen/header/ospfv2/lsa.rb +3 -5
  76. data/lib/packetgen/header/ospfv2/lsa_header.rb +6 -6
  77. data/lib/packetgen/header/ospfv3.rb +2 -2
  78. data/lib/packetgen/header/ospfv3/db_description.rb +2 -2
  79. data/lib/packetgen/header/ospfv3/hello.rb +2 -2
  80. data/lib/packetgen/header/ospfv3/ipv6_prefix.rb +2 -2
  81. data/lib/packetgen/header/ospfv3/ls_ack.rb +2 -2
  82. data/lib/packetgen/header/ospfv3/ls_request.rb +2 -2
  83. data/lib/packetgen/header/ospfv3/ls_update.rb +2 -2
  84. data/lib/packetgen/header/ospfv3/lsa.rb +3 -5
  85. data/lib/packetgen/header/ospfv3/lsa_header.rb +7 -7
  86. data/lib/packetgen/header/snmp.rb +31 -28
  87. data/lib/packetgen/header/tcp.rb +3 -3
  88. data/lib/packetgen/header/tcp/option.rb +3 -5
  89. data/lib/packetgen/header/tcp/options.rb +2 -2
  90. data/lib/packetgen/header/tftp.rb +6 -6
  91. data/lib/packetgen/header/udp.rb +3 -3
  92. data/lib/packetgen/headerable.rb +5 -4
  93. data/lib/packetgen/inject.rb +23 -0
  94. data/lib/packetgen/inspect.rb +24 -5
  95. data/lib/packetgen/packet.rb +76 -51
  96. data/lib/packetgen/pcap.rb +29 -0
  97. data/lib/packetgen/pcapng.rb +2 -2
  98. data/lib/packetgen/pcapng/block.rb +12 -12
  99. data/lib/packetgen/pcapng/epb.rb +3 -7
  100. data/lib/packetgen/pcapng/file.rb +134 -95
  101. data/lib/packetgen/pcapng/idb.rb +30 -30
  102. data/lib/packetgen/pcapng/shb.rb +25 -34
  103. data/lib/packetgen/pcapng/spb.rb +4 -8
  104. data/lib/packetgen/pcapng/unknown_block.rb +2 -2
  105. data/lib/packetgen/pcaprub_wrapper.rb +67 -0
  106. data/lib/packetgen/proto.rb +2 -2
  107. data/lib/packetgen/types.rb +2 -0
  108. data/lib/packetgen/types/abstract_tlv.rb +24 -6
  109. data/lib/packetgen/types/array.rb +5 -5
  110. data/lib/packetgen/types/cstring.rb +2 -2
  111. data/lib/packetgen/types/enum.rb +3 -2
  112. data/lib/packetgen/types/fields.rb +5 -7
  113. data/lib/packetgen/types/int.rb +3 -5
  114. data/lib/packetgen/types/int_string.rb +2 -2
  115. data/lib/packetgen/types/length_from.rb +3 -3
  116. data/lib/packetgen/types/oui.rb +2 -2
  117. data/lib/packetgen/types/string.rb +2 -2
  118. data/lib/packetgen/types/tlv.rb +2 -2
  119. data/lib/packetgen/utils.rb +2 -2
  120. data/lib/packetgen/utils/arp_spoofer.rb +2 -2
  121. data/lib/packetgen/version.rb +3 -3
  122. metadata +26 -50
  123. data/.gitignore +0 -13
  124. data/.rubocop.yml +0 -30
  125. data/.travis.yml +0 -19
  126. data/Gemfile +0 -4
  127. data/Rakefile +0 -21
  128. data/packetgen.gemspec +0 -36
@@ -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
  module Types
11
11
  # Provides a class for creating strings preceeded by their length as a {Int}.
@@ -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
  module Types
11
11
  # This module is a mixin adding +length_from+ capacity to a type.
@@ -37,7 +37,7 @@ module PacketGen
37
37
  else
38
38
  s.size
39
39
  end
40
- str_end = 0 if str_end < 0
40
+ str_end = 0 if str_end.negative?
41
41
  s[0, str_end]
42
42
  end
43
43
  end
@@ -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
  module Types
11
11
  # OUI type, defined as a set of 3 bytes
@@ -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
  module Types
11
11
  # This class is just like regular String. It only adds {#read}, {#sz},
@@ -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
  module Types
11
11
  # Class to handle Type-Length-Value attributes
@@ -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_relative 'config'
9
9
  require_relative 'utils/arp_spoofer'
10
10
 
@@ -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 Utils
10
10
  # @note This class is provided for test purpose.
@@ -1,14 +1,14 @@
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
  # PacketGen is a network packet generator and analyzor.
9
9
  #
10
10
  # @author Sylvain Daubert
11
11
  module PacketGen
12
12
  # PacketGen version
13
- VERSION = '3.1.3'
13
+ VERSION = '3.1.4'
14
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packetgen
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.3
4
+ version: 3.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Daubert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-19 00:00:00.000000000 Z
11
+ date: 2020-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: interfacez
@@ -44,40 +44,20 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.5'
47
+ version: '0.7'
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: 0.6.6
50
+ version: 0.7.1
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - "~>"
56
56
  - !ruby/object:Gem::Version
57
- version: '0.5'
57
+ version: '0.7'
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: 0.6.6
61
- - !ruby/object:Gem::Dependency
62
- name: bundler
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: '1.7'
68
- - - "<"
69
- - !ruby/object:Gem::Version
70
- version: '3'
71
- type: :development
72
- prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: '1.7'
78
- - - "<"
79
- - !ruby/object:Gem::Version
80
- version: '3'
60
+ version: 0.7.1
81
61
  - !ruby/object:Gem::Dependency
82
62
  name: rake
83
63
  requirement: !ruby/object:Gem::Requirement
@@ -106,20 +86,6 @@ dependencies:
106
86
  - - "~>"
107
87
  - !ruby/object:Gem::Version
108
88
  version: '3.7'
109
- - !ruby/object:Gem::Dependency
110
- name: simplecov
111
- requirement: !ruby/object:Gem::Requirement
112
- requirements:
113
- - - "~>"
114
- - !ruby/object:Gem::Version
115
- version: '0.16'
116
- type: :development
117
- prerelease: false
118
- version_requirements: !ruby/object:Gem::Requirement
119
- requirements:
120
- - - "~>"
121
- - !ruby/object:Gem::Version
122
- version: '0.16'
123
89
  - !ruby/object:Gem::Dependency
124
90
  name: yard
125
91
  requirement: !ruby/object:Gem::Requirement
@@ -134,21 +100,20 @@ dependencies:
134
100
  - - "~>"
135
101
  - !ruby/object:Gem::Version
136
102
  version: '0.9'
137
- description:
103
+ description: |
104
+ PacketGen is a network packet manipulation library. It allows reading, parsing
105
+ and sending network packets with fun.
138
106
  email:
139
107
  - sylvain.daubert@laposte.net
140
108
  executables:
141
109
  - pgconsole
142
110
  extensions: []
143
- extra_rdoc_files: []
111
+ extra_rdoc_files:
112
+ - README.md
113
+ - LICENSE
144
114
  files:
145
- - ".gitignore"
146
- - ".rubocop.yml"
147
- - ".travis.yml"
148
- - Gemfile
149
115
  - LICENSE
150
116
  - README.md
151
- - Rakefile
152
117
  - bin/pgconsole
153
118
  - lib/packetgen.rb
154
119
  - lib/packetgen/capture.rb
@@ -241,8 +206,10 @@ files:
241
206
  - lib/packetgen/header/tftp.rb
242
207
  - lib/packetgen/header/udp.rb
243
208
  - lib/packetgen/headerable.rb
209
+ - lib/packetgen/inject.rb
244
210
  - lib/packetgen/inspect.rb
245
211
  - lib/packetgen/packet.rb
212
+ - lib/packetgen/pcap.rb
246
213
  - lib/packetgen/pcapng.rb
247
214
  - lib/packetgen/pcapng/block.rb
248
215
  - lib/packetgen/pcapng/epb.rb
@@ -251,6 +218,7 @@ files:
251
218
  - lib/packetgen/pcapng/shb.rb
252
219
  - lib/packetgen/pcapng/spb.rb
253
220
  - lib/packetgen/pcapng/unknown_block.rb
221
+ - lib/packetgen/pcaprub_wrapper.rb
254
222
  - lib/packetgen/proto.rb
255
223
  - lib/packetgen/types.rb
256
224
  - lib/packetgen/types/abstract_tlv.rb
@@ -267,13 +235,21 @@ files:
267
235
  - lib/packetgen/utils.rb
268
236
  - lib/packetgen/utils/arp_spoofer.rb
269
237
  - lib/packetgen/version.rb
270
- - packetgen.gemspec
271
238
  homepage: https://github.com/sdaubert/packetgen
272
239
  licenses:
273
240
  - MIT
274
- metadata: {}
241
+ metadata:
242
+ bug_tracker_uri: https://github.com/sdaubert/packetgen/issues
243
+ documentation_uri: https://www.rubydoc.info/gems/packetgen
244
+ source_code_uri: https://github.com/sdaubert/packetgen
275
245
  post_install_message:
276
- rdoc_options: []
246
+ rdoc_options:
247
+ - "--title"
248
+ - PacketGen - network packet dissector
249
+ - "--main"
250
+ - README.md
251
+ - "--inline-source"
252
+ - "--quiet"
277
253
  require_paths:
278
254
  - lib
279
255
  required_ruby_version: !ruby/object:Gem::Requirement
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- /vendor/
11
- /.vscode/
12
- *~
13
- tags
@@ -1,30 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: '2.3'
3
- Layout/SpaceAroundEqualsInParameterDefault:
4
- EnforcedStyle: no_space
5
- Lint/EmptyWhen:
6
- Enabled: false
7
- Lint/Void:
8
- Enabled: false
9
- Metrics:
10
- Enabled: false
11
- Style/AsciiComments:
12
- Enabled: false
13
- Style/Encoding:
14
- Enabled: false
15
- Style/EvalWithLocation:
16
- Enabled: false
17
- Style/FormatString:
18
- EnforcedStyle: percent
19
- Style/FormatStringToken:
20
- EnforcedStyle: unannotated
21
- Style/PerlBackrefs:
22
- Enabled: false
23
- Style/RedundantSelf:
24
- Enabled: false
25
- Style/StructInheritance:
26
- Enabled: false
27
- Style/TrailingCommaInArrayLiteral:
28
- Enabled: false
29
- Style/TrailingCommaInHashLiteral:
30
- Enabled: false
@@ -1,19 +0,0 @@
1
- language: ruby
2
- sudo: required
3
- rvm:
4
- - 2.3
5
- - 2.4
6
- - 2.5
7
- - 2.6
8
-
9
- install:
10
- - sudo apt-get update -qq
11
- - sudo apt-get install libpcap-dev -qq
12
- - gem install bundler --version "~>1.17.3"
13
- - bundle install --path vendor/bundle --jobs=3 --retry=3
14
- before_script:
15
- - openssl version
16
- - ruby -ropenssl -e 'puts OpenSSL::VERSION'
17
- script:
18
- - bundle exec rake
19
- - rvmsudo bundle exec rake spec:sudo
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in packetgen.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,21 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
- require 'yard'
4
-
5
- task default: :spec
6
-
7
- RSpec::Core::RakeTask.new do |t|
8
- t.rspec_opts = '-t ~sudo'
9
- end
10
- RSpec::Core::RakeTask.new('spec:sudo') do |t|
11
- t.rspec_opts = if ENV['TRAVIS']
12
- '-t sudo -t ~notravis'
13
- else
14
- '-t sudo'
15
- end
16
- end
17
-
18
- YARD::Rake::YardocTask.new do |t|
19
- t.options = ['--no-private']
20
- t.files = ['lib/**/*.rb', '-', 'LICENSE']
21
- end
@@ -1,36 +0,0 @@
1
- # coding: utf-8
2
-
3
- lib = File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'packetgen/version'
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = 'packetgen'
9
- spec.version = PacketGen::VERSION
10
- spec.license = 'MIT'
11
- spec.authors = ['Sylvain Daubert']
12
- spec.email = ['sylvain.daubert@laposte.net']
13
-
14
- spec.summary = 'Network packet generator and dissector'
15
- # spec.description = %q{TODO: Write a longer description or delete this line.}
16
- spec.homepage = 'https://github.com/sdaubert/packetgen'
17
-
18
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
- f.match(%r{^(test|spec|features)/})
20
- end
21
- spec.bindir = 'bin'
22
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
- spec.require_paths = ['lib']
24
-
25
- spec.required_ruby_version = '>= 2.3.0'
26
-
27
- spec.add_dependency 'interfacez', '~>1.0'
28
- spec.add_dependency 'pcaprub', '~>0.12.4'
29
- spec.add_dependency 'rasn1', '~>0.5', '>= 0.6.6'
30
-
31
- spec.add_development_dependency 'bundler', '>=1.7', '<3'
32
- spec.add_development_dependency 'rake', '~> 12.3'
33
- spec.add_development_dependency 'rspec', '~> 3.7'
34
- spec.add_development_dependency 'simplecov', '~> 0.16'
35
- spec.add_development_dependency 'yard', '~> 0.9'
36
- end