packetgen-plugin-smb 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/specs.yml +28 -0
  3. data/.rubocop.yml +6 -0
  4. data/Gemfile +15 -0
  5. data/README.md +50 -12
  6. data/Rakefile +10 -4
  7. data/lib/packetgen-plugin-smb.rb +2 -2
  8. data/lib/packetgen/plugin/gssapi.rb +4 -2
  9. data/lib/packetgen/plugin/llmnr.rb +4 -4
  10. data/lib/packetgen/plugin/netbios.rb +2 -0
  11. data/lib/packetgen/plugin/netbios/datagram.rb +3 -3
  12. data/lib/packetgen/plugin/netbios/name.rb +4 -4
  13. data/lib/packetgen/plugin/netbios/session.rb +5 -5
  14. data/lib/packetgen/plugin/ntlm.rb +3 -3
  15. data/lib/packetgen/plugin/ntlm/authenticate.rb +2 -2
  16. data/lib/packetgen/plugin/ntlm/av_pair.rb +3 -5
  17. data/lib/packetgen/plugin/ntlm/challenge.rb +2 -2
  18. data/lib/packetgen/plugin/ntlm/negotiate.rb +2 -2
  19. data/lib/packetgen/plugin/ntlm/ntlmv2_response.rb +2 -2
  20. data/lib/packetgen/plugin/smb.rb +12 -12
  21. data/lib/packetgen/plugin/smb/blocks.rb +2 -2
  22. data/lib/packetgen/plugin/smb/browser.rb +2 -2
  23. data/lib/packetgen/plugin/smb/browser/domain_announcement.rb +2 -2
  24. data/lib/packetgen/plugin/smb/browser/host_announcement.rb +2 -2
  25. data/lib/packetgen/plugin/smb/browser/local_master_announcement.rb +2 -2
  26. data/lib/packetgen/plugin/smb/close.rb +2 -2
  27. data/lib/packetgen/plugin/smb/close/request.rb +2 -2
  28. data/lib/packetgen/plugin/smb/close/response.rb +2 -2
  29. data/lib/packetgen/plugin/smb/filetime.rb +4 -2
  30. data/lib/packetgen/plugin/smb/negotiate.rb +2 -2
  31. data/lib/packetgen/plugin/smb/negotiate/dialect.rb +7 -0
  32. data/lib/packetgen/plugin/smb/negotiate/request.rb +7 -0
  33. data/lib/packetgen/plugin/smb/negotiate/response.rb +8 -2
  34. data/lib/packetgen/plugin/smb/nt_create_and_x.rb +2 -2
  35. data/lib/packetgen/plugin/smb/ntcreateandx/request.rb +4 -4
  36. data/lib/packetgen/plugin/smb/ntcreateandx/response.rb +2 -2
  37. data/lib/packetgen/plugin/smb/string.rb +40 -28
  38. data/lib/packetgen/plugin/smb/trans.rb +2 -2
  39. data/lib/packetgen/plugin/smb/trans/request.rb +3 -3
  40. data/lib/packetgen/plugin/smb/trans/response.rb +2 -2
  41. data/lib/packetgen/plugin/smb2.rb +3 -3
  42. data/lib/packetgen/plugin/smb2/base.rb +3 -3
  43. data/lib/packetgen/plugin/smb2/error.rb +3 -4
  44. data/lib/packetgen/plugin/smb2/guid.rb +4 -3
  45. data/lib/packetgen/plugin/smb2/negotiate.rb +2 -2
  46. data/lib/packetgen/plugin/smb2/negotiate/context.rb +3 -3
  47. data/lib/packetgen/plugin/smb2/negotiate/request.rb +3 -5
  48. data/lib/packetgen/plugin/smb2/negotiate/response.rb +4 -6
  49. data/lib/packetgen/plugin/smb2/session_setup.rb +2 -2
  50. data/lib/packetgen/plugin/smb2/session_setup/request.rb +4 -4
  51. data/lib/packetgen/plugin/smb2/session_setup/response.rb +5 -5
  52. data/lib/packetgen/plugin/smb_version.rb +3 -1
  53. data/packetgen-plugin-smb.gemspec +4 -11
  54. metadata +6 -82
  55. data/.travis.yml +0 -12
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of packetgen-plugin-smb.
2
4
  # See https://github.com/sdaubert/packetgen-plugin-smb for more informations
3
5
  # Copyright (C) 2018 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 'guid'
9
9
 
10
10
  module PacketGen::Plugin
@@ -26,4 +26,4 @@ module PacketGen::Plugin
26
26
  end
27
27
  end
28
28
  end
29
- end
29
+ end
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of packetgen-plugin-smb.
2
4
  # See https://github.com/sdaubert/packetgen-plugin-smb for more informations
3
5
  # Copyright (C) 2018 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::Plugin
9
9
  class SMB2
10
10
  # SMB2 Error response structure
@@ -45,6 +45,5 @@ module PacketGen::Plugin
45
45
  end
46
46
  end
47
47
  PacketGen::Header.add_class SMB2::ErrorResponse
48
- SMB2.bind SMB2::ErrorResponse, status: ->(v) { v > 0 }
48
+ SMB2.bind SMB2::ErrorResponse, status: ->(v) { v.positive? }
49
49
  end
50
-
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of packetgen-plugin-smb.
2
4
  # See https://github.com/sdaubert/packetgen-plugin-smb for more informations
3
5
  # Copyright (C) 2018 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::Plugin
9
9
  class SMB2
10
10
  # GUID, also known as UUID, is a 16-byte structure, intended to serve
@@ -22,6 +22,8 @@ module PacketGen::Plugin
22
22
  # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
23
23
  # @author Sylvain Daubert
24
24
  class GUID < PacketGen::Types::Fields
25
+ include PacketGen::Types::Fieldable
26
+
25
27
  # @!attribute data1
26
28
  # 32-bit little-endian data1
27
29
  # @return [Integer]
@@ -66,4 +68,3 @@ module PacketGen::Plugin
66
68
  end
67
69
  end
68
70
  end
69
-
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of packetgen-plugin-smb.
2
4
  # See https://github.com/sdaubert/packetgen-plugin-smb for more informations
3
5
  # Copyright (C) 2018 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 'guid'
9
9
 
10
10
  module PacketGen::Plugin
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of packetgen-plugin-smb.
2
4
  # See https://github.com/sdaubert/packetgen-plugin-smb for more informations
3
5
  # Copyright (C) 2018 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::Plugin
9
9
  class SMB2
10
10
  module Negotiate
@@ -47,7 +47,7 @@ module PacketGen::Plugin
47
47
  # @!attribute pad
48
48
  # Padding to align next context on a 8-byte offset
49
49
  # @return [String]
50
- define_field :pad, PacketGen::Types::String, builder: ->(h, t) { t.new(length_from: -> { (8 - (h.offset_of(:data) + h.data_length) % 8) % 8 }) }
50
+ define_field :pad, PacketGen::Types::String, builder: ->(h, t) { t.new(length_from: -> { 8 - (h.offset_of(:data) + h.data_length) % 8 }) }
51
51
 
52
52
  # @private
53
53
  alias old_read read
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of packetgen-plugin-smb.
2
4
  # See https://github.com/sdaubert/packetgen-plugin-smb for more informations
3
5
  # Copyright (C) 2018 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::Plugin
9
9
  class SMB2
10
10
  module Negotiate
@@ -161,9 +161,7 @@ module PacketGen::Plugin
161
161
  self[:pad].read SMB2::MAX_PADDING
162
162
 
163
163
  self.context_offset = 0
164
- unless context_list.empty?
165
- self.context_offset = SMB2::HEADER_SIZE + offset_of(:context_list)
166
- end
164
+ self.context_offset = SMB2::HEADER_SIZE + offset_of(:context_list) unless context_list.empty?
167
165
  context_list.each { |ctx| ctx.calc_length if ctx.respond_to? :calc_length }
168
166
  end
169
167
  end
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of packetgen-plugin-smb.
2
4
  # See https://github.com/sdaubert/packetgen-plugin-smb for more informations
3
5
  # Copyright (C) 2018 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::Plugin
9
9
  class SMB2
10
10
  module Negotiate
@@ -140,7 +140,7 @@ module PacketGen::Plugin
140
140
  define_field :context_offset, PacketGen::Types::Int32le
141
141
  # @!attribute buffer
142
142
  # @return [GSSAPI]
143
- define_field :buffer, GSSAPI, token: :init, optional: ->(h) { h.buffer_offset > 0 }
143
+ define_field :buffer, GSSAPI, token: :init, optional: ->(h) { h.buffer_offset.positive? }
144
144
  # @!attribute pad
145
145
  # Optional padding between the end of the {#buffer} field and the first negotiate
146
146
  # context in {#context_list} so that the first negotiate context is 8-byte aligned
@@ -192,9 +192,7 @@ module PacketGen::Plugin
192
192
  end
193
193
 
194
194
  self.context_offset = 0
195
- unless context_list.empty?
196
- self.context_offset = SMB2::HEADER_SIZE + offset_of(:context_list)
197
- end
195
+ self.context_offset = SMB2::HEADER_SIZE + offset_of(:context_list) unless context_list.empty?
198
196
  context_list.each { |ctx| ctx.calc_length if ctx.respond_to? :calc_length }
199
197
  end
200
198
  end
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of packetgen-plugin-smb.
2
4
  # See https://github.com/sdaubert/packetgen-plugin-smb for more informations
3
5
  # Copyright (C) 2018 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 'guid'
9
9
 
10
10
  module PacketGen::Plugin
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of packetgen-plugin-smb.
2
4
  # See https://github.com/sdaubert/packetgen-plugin-smb for more informations
3
5
  # Copyright (C) 2018 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::Plugin
9
9
  class SMB2
10
10
  module SessionSetup
@@ -79,7 +79,7 @@ module PacketGen::Plugin
79
79
  define_field :prev_session_id, PacketGen::Types::Int64le
80
80
  # @!attribute buffer
81
81
  # @return [GSSAPI]
82
- define_field :buffer, GSSAPI, token: :response, optional: ->(h) { h.buffer_offset > 0 }
82
+ define_field :buffer, GSSAPI, token: :response, optional: ->(h) { h.buffer_offset.positive? }
83
83
 
84
84
  # Calculate and set {#buffer_length} and {#buffer_offset} fields.
85
85
  # @return [void]
@@ -100,4 +100,4 @@ module PacketGen::Plugin
100
100
  end
101
101
  end
102
102
  end
103
- end
103
+ end
@@ -1,10 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is part of packetgen-plugin-smb.
2
4
  # See https://github.com/sdaubert/packetgen-plugin-smb for more informations
3
5
  # Copyright (C) 2018 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::Plugin
9
9
  class SMB2
10
10
  module SessionSetup
@@ -39,7 +39,7 @@ module PacketGen::Plugin
39
39
  # @return [Boolean]
40
40
  # @!attribute flags_is_guest?
41
41
  # @return [Boolean]
42
- define_bit_fields_on :flags, :flags_rsv, 13,:flags_encrypt_data, :flags_is_null, :flags_is_guest
42
+ define_bit_fields_on :flags, :flags_rsv, 13, :flags_encrypt_data, :flags_is_null, :flags_is_guest
43
43
  # @!attribute buffer_offset
44
44
  # The offset, from the beginning of the SMB2 header of the {#buffer}.
45
45
  # @return [Integer]
@@ -50,7 +50,7 @@ module PacketGen::Plugin
50
50
  define_field :buffer_length, PacketGen::Types::Int16le
51
51
  # @!attribute buffer
52
52
  # @return [GSSAPI]
53
- define_field :buffer, GSSAPI, token: :response, optional: ->(h) { h.buffer_offset > 0 }
53
+ define_field :buffer, GSSAPI, token: :response, optional: ->(h) { h.buffer_offset.positive? }
54
54
 
55
55
  # Calculate and set {#buffer_length} and {#buffer_offset} fields.
56
56
  # @return [void]
@@ -71,4 +71,4 @@ module PacketGen::Plugin
71
71
  end
72
72
  end
73
73
  end
74
- end
74
+ end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PacketGen
2
4
  module Plugin
3
- SMB_VERSION = "0.6.1"
5
+ SMB_VERSION = '0.6.2'
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'packetgen/plugin/smb_version'
@@ -18,17 +20,8 @@ Gem::Specification.new do |spec|
18
20
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
21
  spec.require_paths = %w[lib]
20
22
 
21
- spec.required_ruby_version = '>= 2.3.0'
23
+ spec.required_ruby_version = '>= 2.4.0'
22
24
 
23
- spec.add_dependency 'packetgen', '~>3.1', '>=3.1.2'
25
+ spec.add_dependency 'packetgen', '~>3.1', '>=3.1.7'
24
26
  spec.add_dependency 'rasn1', '~>0.6', '>= 0.6.8'
25
-
26
- spec.add_development_dependency 'bundler', '>=1.17', '<3'
27
- spec.add_development_dependency 'rake', '~> 10.0'
28
- spec.add_development_dependency 'rspec', '~> 3.7'
29
- spec.add_development_dependency 'simplecov', '~> 0.16'
30
- spec.add_development_dependency 'yard', '~> 0.9'
31
-
32
- #spec.add_development_dependency 'ruby-debug-ide'
33
- #spec.add_development_dependency 'debase'
34
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packetgen-plugin-smb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
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-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: packetgen
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '3.1'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 3.1.2
22
+ version: 3.1.7
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '3.1'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 3.1.2
32
+ version: 3.1.7
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rasn1
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -50,82 +50,6 @@ dependencies:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 0.6.8
53
- - !ruby/object:Gem::Dependency
54
- name: bundler
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: '1.17'
60
- - - "<"
61
- - !ruby/object:Gem::Version
62
- version: '3'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: '1.17'
70
- - - "<"
71
- - !ruby/object:Gem::Version
72
- version: '3'
73
- - !ruby/object:Gem::Dependency
74
- name: rake
75
- requirement: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - "~>"
78
- - !ruby/object:Gem::Version
79
- version: '10.0'
80
- type: :development
81
- prerelease: false
82
- version_requirements: !ruby/object:Gem::Requirement
83
- requirements:
84
- - - "~>"
85
- - !ruby/object:Gem::Version
86
- version: '10.0'
87
- - !ruby/object:Gem::Dependency
88
- name: rspec
89
- requirement: !ruby/object:Gem::Requirement
90
- requirements:
91
- - - "~>"
92
- - !ruby/object:Gem::Version
93
- version: '3.7'
94
- type: :development
95
- prerelease: false
96
- version_requirements: !ruby/object:Gem::Requirement
97
- requirements:
98
- - - "~>"
99
- - !ruby/object:Gem::Version
100
- version: '3.7'
101
- - !ruby/object:Gem::Dependency
102
- name: simplecov
103
- requirement: !ruby/object:Gem::Requirement
104
- requirements:
105
- - - "~>"
106
- - !ruby/object:Gem::Version
107
- version: '0.16'
108
- type: :development
109
- prerelease: false
110
- version_requirements: !ruby/object:Gem::Requirement
111
- requirements:
112
- - - "~>"
113
- - !ruby/object:Gem::Version
114
- version: '0.16'
115
- - !ruby/object:Gem::Dependency
116
- name: yard
117
- requirement: !ruby/object:Gem::Requirement
118
- requirements:
119
- - - "~>"
120
- - !ruby/object:Gem::Version
121
- version: '0.9'
122
- type: :development
123
- prerelease: false
124
- version_requirements: !ruby/object:Gem::Requirement
125
- requirements:
126
- - - "~>"
127
- - !ruby/object:Gem::Version
128
- version: '0.9'
129
53
  description:
130
54
  email:
131
55
  - sylvain.daubert@laposte.net
@@ -133,9 +57,9 @@ executables: []
133
57
  extensions: []
134
58
  extra_rdoc_files: []
135
59
  files:
60
+ - ".github/workflows/specs.yml"
136
61
  - ".gitignore"
137
62
  - ".rubocop.yml"
138
- - ".travis.yml"
139
63
  - Gemfile
140
64
  - LICENSE
141
65
  - README.md
@@ -200,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
200
124
  requirements:
201
125
  - - ">="
202
126
  - !ruby/object:Gem::Version
203
- version: 2.3.0
127
+ version: 2.4.0
204
128
  required_rubygems_version: !ruby/object:Gem::Requirement
205
129
  requirements:
206
130
  - - ">="
@@ -1,12 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3
4
- - 2.4
5
- - 2.5
6
- - 2.6
7
-
8
- install:
9
- - sudo apt-get update -qq
10
- - sudo apt-get install libpcap-dev -qq
11
- - gem install bundler --version "~>1.17.3"
12
- - bundle install --path vendor/bundle --jobs=3 --retry=3