ruby_smb 0.0.22 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/ruby_smb/client.rb +17 -19
- data/lib/ruby_smb/client/authentication.rb +2 -2
- data/lib/ruby_smb/nbss.rb +1 -0
- data/lib/ruby_smb/nbss/netbios_name.rb +48 -0
- data/lib/ruby_smb/nbss/session_request.rb +2 -2
- data/lib/ruby_smb/smb2/dcerpc.rb +4 -2
- data/lib/ruby_smb/smb2/packet/ioctl_request.rb +1 -1
- data/lib/ruby_smb/version.rb +1 -1
- data/ruby_smb.gemspec +2 -2
- data/spec/lib/ruby_smb/client_spec.rb +34 -47
- data/spec/lib/ruby_smb/nbss/netbios_name_spec.rb +95 -0
- data/spec/lib/ruby_smb/nbss/session_request_spec.rb +2 -2
- data/spec/lib/ruby_smb/smb2/pipe_spec.rb +14 -7
- metadata +9 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59b2f5a2d37d1e42e0bd674e58841e7209e9877f
|
4
|
+
data.tar.gz: 6cad39d8512753e877e9abf458ceaa21cfb201b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbff69d36da828c531c8cf8d62ce6ad98cd0966cf9cae2b20c65cc649ca37f3ec08fac85a346b65caeaaa0f65cf0d24c9dc2218992fabe70965082df456ec58c
|
7
|
+
data.tar.gz: b0ea5ea13caeb32f0b787c280062f87f6d87c20179cd4e446f28f94290350f2710eef62b089f75c6bcdb215db07e75ae1f4d84ec3c905f20abacf3ac9f2f95af
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/ruby_smb/client.rb
CHANGED
@@ -381,16 +381,7 @@ module RubySMB
|
|
381
381
|
# @return [TrueClass] if session request is granted
|
382
382
|
# @raise [RubySMB::Error::NetBiosSessionService] if session request is refused
|
383
383
|
def session_request(name = '*SMBSERVER')
|
384
|
-
|
385
|
-
encoded_calling_name = nb_name_encode("#{''.ljust(15)}\x00")
|
386
|
-
|
387
|
-
session_request = RubySMB::Nbss::SessionRequest.new
|
388
|
-
session_request.session_header.session_packet_type = RubySMB::Nbss::SESSION_REQUEST
|
389
|
-
session_request.called_name = "\x20#{encoded_called_name}\x00"
|
390
|
-
session_request.calling_name = "\x20#{encoded_calling_name}\x00"
|
391
|
-
session_request.session_header.packet_length =
|
392
|
-
session_request.num_bytes - session_request.session_header.num_bytes
|
393
|
-
|
384
|
+
session_request = session_request_packet(name)
|
394
385
|
dispatcher.send_packet(session_request, nbss_header: false)
|
395
386
|
raw_response = dispatcher.recv_packet(full_response: true)
|
396
387
|
session_header = RubySMB::Nbss::SessionHeader.read(raw_response)
|
@@ -402,15 +393,22 @@ module RubySMB
|
|
402
393
|
return true
|
403
394
|
end
|
404
395
|
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
396
|
+
# Crafts the NetBIOS SessionRequest packet to be sent for session request operations.
|
397
|
+
#
|
398
|
+
# @param name [String] the NetBIOS name to request
|
399
|
+
# @return [RubySMB::Nbss::SessionRequest] the SessionRequest packet
|
400
|
+
def session_request_packet(name = '*SMBSERVER')
|
401
|
+
called_name = "#{name.upcase.ljust(15)}\x20"
|
402
|
+
calling_name = "#{''.ljust(15)}\x00"
|
403
|
+
|
404
|
+
session_request = RubySMB::Nbss::SessionRequest.new
|
405
|
+
session_request.session_header.session_packet_type = RubySMB::Nbss::SESSION_REQUEST
|
406
|
+
session_request.called_name = called_name
|
407
|
+
session_request.calling_name = calling_name
|
408
|
+
session_request.session_header.packet_length =
|
409
|
+
session_request.num_bytes - session_request.session_header.num_bytes
|
410
|
+
session_request
|
414
411
|
end
|
412
|
+
|
415
413
|
end
|
416
414
|
end
|
@@ -83,7 +83,7 @@ module RubySMB
|
|
83
83
|
@session_key = @ntlm_client.session_key
|
84
84
|
challenge_message = @ntlm_client.session.challenge_message
|
85
85
|
store_target_info(challenge_message.target_info) if challenge_message.has_flag?(:TARGET_INFO)
|
86
|
-
@os_version = extract_os_version(challenge_message.os_version.to_s)
|
86
|
+
@os_version = extract_os_version(challenge_message.os_version.to_s) unless challenge_message.os_version.empty?
|
87
87
|
|
88
88
|
raw = smb1_ntlmssp_authenticate(type3_message, user_id)
|
89
89
|
response = smb1_ntlmssp_final_packet(raw)
|
@@ -201,7 +201,7 @@ module RubySMB
|
|
201
201
|
@session_key = @ntlm_client.session_key
|
202
202
|
challenge_message = ntlm_client.session.challenge_message
|
203
203
|
store_target_info(challenge_message.target_info) if challenge_message.has_flag?(:TARGET_INFO)
|
204
|
-
@os_version = extract_os_version(challenge_message.os_version.to_s)
|
204
|
+
@os_version = extract_os_version(challenge_message.os_version.to_s) unless challenge_message.os_version.empty?
|
205
205
|
|
206
206
|
raw = smb2_ntlmssp_authenticate(type3_message, @session_id)
|
207
207
|
response = smb2_ntlmssp_final_packet(raw)
|
data/lib/ruby_smb/nbss.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
module RubySMB
|
2
|
+
module Nbss
|
3
|
+
# Representation of the NetBIOS Name as defined in
|
4
|
+
# [4.1. NAME FORMAT](https://tools.ietf.org/html/rfc1002#section-4.1) and
|
5
|
+
# [14. REPRESENTATION OF NETBIOS NAMES](https://tools.ietf.org/html/rfc1001#section-14) and
|
6
|
+
# [Domain name representation and compression](https://tools.ietf.org/html/rfc883#page-31)
|
7
|
+
class NetbiosName < BinData::Primitive
|
8
|
+
endian :big
|
9
|
+
|
10
|
+
bit1 :flag1, initial_value: 0
|
11
|
+
bit1 :flag2, initial_value: 0
|
12
|
+
bit6 :label_length
|
13
|
+
string :label, read_length: -> { label_length }
|
14
|
+
string :null_label, read_length: 1, value: "\x00"
|
15
|
+
|
16
|
+
def nb_name_encode(name)
|
17
|
+
encoded_name = ''
|
18
|
+
name.each_byte do |char|
|
19
|
+
first_half = (char >> 4) + 'A'.ord
|
20
|
+
second_half = (char & 0xF) + 'A'.ord
|
21
|
+
encoded_name << first_half.chr
|
22
|
+
encoded_name << second_half.chr
|
23
|
+
end
|
24
|
+
encoded_name
|
25
|
+
end
|
26
|
+
|
27
|
+
def nb_name_decode(encoded_name)
|
28
|
+
name = encoded_name.scan(/../).map do |char_pair|
|
29
|
+
first_half = char_pair[0];
|
30
|
+
second_half = char_pair[1]
|
31
|
+
char = ((first_half.ord - 'A'.ord) << 4) + (second_half.ord - 'A'.ord)
|
32
|
+
char.chr
|
33
|
+
end
|
34
|
+
name.join
|
35
|
+
end
|
36
|
+
|
37
|
+
def get
|
38
|
+
nb_name_decode(label)
|
39
|
+
end
|
40
|
+
|
41
|
+
def set(label)
|
42
|
+
self.label = nb_name_encode(label)
|
43
|
+
self.label_length = self.label.length
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -6,8 +6,8 @@ module RubySMB
|
|
6
6
|
endian :big
|
7
7
|
|
8
8
|
session_header :session_header
|
9
|
-
|
10
|
-
|
9
|
+
netbios_name :called_name, label: 'Called Name'
|
10
|
+
netbios_name :calling_name, label: 'Calling Name'
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
data/lib/ruby_smb/smb2/dcerpc.rb
CHANGED
@@ -13,9 +13,11 @@ module RubySMB
|
|
13
13
|
|
14
14
|
def bind(options={})
|
15
15
|
bind_req = RubySMB::Dcerpc::Bind.new(options)
|
16
|
-
|
16
|
+
write(data: bind_req.to_binary_s)
|
17
|
+
@size = 1024
|
18
|
+
dcerpc_raw_response = read()
|
17
19
|
begin
|
18
|
-
dcerpc_response = RubySMB::Dcerpc::BindAck.read(
|
20
|
+
dcerpc_response = RubySMB::Dcerpc::BindAck.read(dcerpc_raw_response)
|
19
21
|
rescue IOError
|
20
22
|
raise RubySMB::Dcerpc::Error::InvalidPacket, "Error reading the DCERPC response"
|
21
23
|
end
|
@@ -16,7 +16,7 @@ module RubySMB
|
|
16
16
|
uint32 :max_input_response, label: 'Max Input Response'
|
17
17
|
uint32 :output_offset, label: 'Output Offset', initial_value: -> { input_offset + output_count }
|
18
18
|
uint32 :output_count, label: 'Output Count'
|
19
|
-
uint32 :max_output_response, label: 'Max Output response', initial_value:
|
19
|
+
uint32 :max_output_response, label: 'Max Output response', initial_value: 1024
|
20
20
|
|
21
21
|
struct :flags do
|
22
22
|
bit7 :reserved1, label: 'Reserved Space'
|
data/lib/ruby_smb/version.rb
CHANGED
data/ruby_smb.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'ruby_smb/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'ruby_smb'
|
8
8
|
spec.version = RubySMB::VERSION
|
9
|
-
spec.authors = ['David Maloney', 'James Lee']
|
10
|
-
spec.email = ['DMaloney@rapid7.com', 'egypt@metasploit.com']
|
9
|
+
spec.authors = ['David Maloney', 'James Lee', 'Dev Mohanty', 'Christophe De La Fuente']
|
10
|
+
spec.email = ['DMaloney@rapid7.com', 'egypt@metasploit.com', 'dev_mohanty@rapid7.com', 'paristvinternet-github@yahoo.com']
|
11
11
|
spec.summary = 'A pure Ruby implementation of the SMB Protocol Family'
|
12
12
|
spec.description = ''
|
13
13
|
spec.homepage = 'https://github.com/rapid7/ruby_smb'
|
@@ -155,8 +155,6 @@ RSpec.describe RubySMB::Client do
|
|
155
155
|
|
156
156
|
context 'NetBIOS Session Service' do
|
157
157
|
describe '#session_request' do
|
158
|
-
let(:called_name) { '*SMBSERVER ' }
|
159
|
-
let(:calling_name) { " \x00" }
|
160
158
|
let(:session_header) { RubySMB::Nbss::SessionHeader.new }
|
161
159
|
let(:session_request) { RubySMB::Nbss::SessionRequest.new }
|
162
160
|
|
@@ -166,46 +164,10 @@ RSpec.describe RubySMB::Client do
|
|
166
164
|
allow(dispatcher).to receive(:recv_packet).and_return(session_header.to_binary_s)
|
167
165
|
end
|
168
166
|
|
169
|
-
it '
|
170
|
-
|
171
|
-
expect(client).to receive(:
|
172
|
-
client.session_request
|
173
|
-
end
|
174
|
-
|
175
|
-
it 'requests a session for the provided name and the expected calling name' do
|
176
|
-
name = 'NBNAME'
|
177
|
-
called_name = "#{name} "
|
178
|
-
|
179
|
-
expect(client).to receive(:nb_name_encode).with(called_name).once
|
180
|
-
expect(client).to receive(:nb_name_encode).with(calling_name).once
|
181
|
-
client.session_request(name)
|
182
|
-
end
|
183
|
-
|
184
|
-
it 'makes NetBIOS name uppercase' do
|
185
|
-
name = 'nbNamE'
|
186
|
-
called_name = "#{name.upcase} "
|
187
|
-
|
188
|
-
expect(client).to receive(:nb_name_encode).with(called_name).once
|
189
|
-
expect(client).to receive(:nb_name_encode).with(calling_name).once
|
190
|
-
client.session_request(name)
|
191
|
-
end
|
192
|
-
|
193
|
-
it 'creates a SessionRequest packet' do
|
194
|
-
expect(RubySMB::Nbss::SessionRequest).to receive(:new).and_return(session_request)
|
195
|
-
client.session_request
|
196
|
-
end
|
197
|
-
|
198
|
-
it 'sets the expected fields of the SessionRequest packet' do
|
199
|
-
encoded_called_name = "\x20#{client.nb_name_encode(called_name)}\x00"
|
200
|
-
encoded_calling_name = "\x20#{client.nb_name_encode(calling_name)}\x00"
|
201
|
-
allow(dispatcher).to receive(:send_packet) do |packet, _opts|
|
202
|
-
expect(packet).to be_a(RubySMB::Nbss::SessionRequest)
|
203
|
-
expect(packet.session_header.session_packet_type).to eq RubySMB::Nbss::SESSION_REQUEST
|
204
|
-
expect(packet.called_name).to eq encoded_called_name
|
205
|
-
expect(packet.calling_name).to eq encoded_calling_name
|
206
|
-
expect(packet.session_header.packet_length).to eq (encoded_called_name.size + encoded_calling_name.size)
|
207
|
-
end
|
208
|
-
client.session_request
|
167
|
+
it 'calls #session_request_packet' do
|
168
|
+
called_name = 'SPECNAME'
|
169
|
+
expect(client).to receive(:session_request_packet).with(called_name)
|
170
|
+
client.session_request(called_name)
|
209
171
|
end
|
210
172
|
|
211
173
|
it 'sends the SessionRequest packet without adding additional NetBIOS Session Header' do
|
@@ -237,11 +199,36 @@ RSpec.describe RubySMB::Client do
|
|
237
199
|
end
|
238
200
|
end
|
239
201
|
|
240
|
-
describe '#
|
241
|
-
it '
|
242
|
-
|
243
|
-
|
244
|
-
|
202
|
+
describe '#session_request_packet' do
|
203
|
+
it 'creates a SessionRequest packet' do
|
204
|
+
session_request = RubySMB::Nbss::SessionRequest.new
|
205
|
+
expect(RubySMB::Nbss::SessionRequest).to receive(:new).and_return(session_request)
|
206
|
+
client.session_request_packet
|
207
|
+
end
|
208
|
+
|
209
|
+
it 'sets the expected fields of the SessionRequest packet' do
|
210
|
+
name = 'NBNAMESPEC'
|
211
|
+
called_name = 'NBNAMESPEC '
|
212
|
+
calling_name = " \x00"
|
213
|
+
|
214
|
+
session_packet = client.session_request_packet(name)
|
215
|
+
expect(session_packet).to be_a(RubySMB::Nbss::SessionRequest)
|
216
|
+
expect(session_packet.session_header.session_packet_type).to eq RubySMB::Nbss::SESSION_REQUEST
|
217
|
+
expect(session_packet.called_name).to eq called_name
|
218
|
+
expect(session_packet.calling_name).to eq calling_name
|
219
|
+
expect(session_packet.session_header.packet_length).to eq(
|
220
|
+
session_packet.called_name.to_binary_s.size + session_packet.calling_name.to_binary_s.size
|
221
|
+
)
|
222
|
+
end
|
223
|
+
|
224
|
+
it 'converts the called name to upperase' do
|
225
|
+
name = 'myname'
|
226
|
+
session_packet = client.session_request_packet(name)
|
227
|
+
expect(session_packet.called_name).to eq("#{name.upcase.ljust(15)}\x20")
|
228
|
+
end
|
229
|
+
|
230
|
+
it 'returns a session packet with *SMBSERVER by default' do
|
231
|
+
expect(client.session_request_packet.called_name).to eq('*SMBSERVER ')
|
245
232
|
end
|
246
233
|
end
|
247
234
|
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
RSpec.describe RubySMB::Nbss::NetbiosName do
|
2
|
+
subject(:netbios_name) { described_class.new }
|
3
|
+
|
4
|
+
it { is_expected.to respond_to :flag1 }
|
5
|
+
it { is_expected.to respond_to :flag2 }
|
6
|
+
it { is_expected.to respond_to :label_length }
|
7
|
+
it { is_expected.to respond_to :label }
|
8
|
+
it { is_expected.to respond_to :null_label }
|
9
|
+
|
10
|
+
it 'is big endian' do
|
11
|
+
expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :big
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#flag1' do
|
15
|
+
it 'is a 1-bit field' do
|
16
|
+
expect(netbios_name.flag1).to be_a BinData::Bit1
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'is set to 0 by default' do
|
20
|
+
expect(netbios_name.flag1).to eq 0
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#flag2' do
|
25
|
+
it 'is a 1-bit field' do
|
26
|
+
expect(netbios_name.flag2).to be_a BinData::Bit1
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'is set to 0 by default' do
|
30
|
+
expect(netbios_name.flag2).to eq 0
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#label_length' do
|
35
|
+
it 'is a 6-bit field' do
|
36
|
+
expect(netbios_name.label_length).to be_a BinData::Bit6
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#label' do
|
41
|
+
it 'is a string' do
|
42
|
+
expect(netbios_name.label).to be_a BinData::String
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'reads #label_length bytes' do
|
46
|
+
str = 'ABCDEFGHIJ'
|
47
|
+
netbios_name.label_length = 4
|
48
|
+
expect(netbios_name.label.read(str)).to eq(str[0,4])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#null_label' do
|
53
|
+
it 'is a string' do
|
54
|
+
expect(netbios_name.null_label).to be_a BinData::String
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'is always a NULL byte' do
|
58
|
+
str = 'ABCD'
|
59
|
+
expect(netbios_name.null_label.read(str)).to eq("\x00")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#nb_name_encode' do
|
64
|
+
it 'encodes as expected' do
|
65
|
+
input = 'TESTNB '
|
66
|
+
output = 'FEEFFDFEEOECCACACACACACACACACACA'
|
67
|
+
expect(netbios_name.nb_name_encode(input)).to eq output
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#nb_name_encode' do
|
72
|
+
it 'decodes as expected' do
|
73
|
+
input = 'FEEFFDFEEOECCACACACACACACACACACA'
|
74
|
+
output = 'TESTNB '
|
75
|
+
expect(netbios_name.nb_name_decode(input)).to eq output
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '#get' do
|
80
|
+
it 'returns the expected label' do
|
81
|
+
label = 'TESTNB '
|
82
|
+
expect(netbios_name.assign(label)).to eq(label)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe '#set' do
|
87
|
+
it 'sets the expected label and the label_length fields' do
|
88
|
+
label = 'TESTNB '
|
89
|
+
netbios_name.assign(label)
|
90
|
+
expect(netbios_name.label).to eq(netbios_name.nb_name_encode(label))
|
91
|
+
expect(netbios_name.label_length).to eq(netbios_name.nb_name_encode(label).length)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
@@ -17,13 +17,13 @@ RSpec.describe RubySMB::Nbss::SessionRequest do
|
|
17
17
|
|
18
18
|
describe '#called_name' do
|
19
19
|
it 'is a string' do
|
20
|
-
expect(session_request.called_name).to be_a
|
20
|
+
expect(session_request.called_name).to be_a RubySMB::Nbss::NetbiosName
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
describe '#calling_name' do
|
25
25
|
it 'is a string' do
|
26
|
-
expect(session_request.calling_name).to be_a
|
26
|
+
expect(session_request.calling_name).to be_a RubySMB::Nbss::NetbiosName
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -43,7 +43,7 @@ RSpec.describe RubySMB::SMB2::Pipe do
|
|
43
43
|
expect(pipe.peek_available).to eq(0x40302010)
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
describe '#peek_state' do
|
48
48
|
it 'reads the correct state of the pipe' do
|
49
49
|
allow(pipe).to receive(:peek) { ioctl_response }
|
@@ -111,12 +111,12 @@ RSpec.describe RubySMB::SMB2::Pipe do
|
|
111
111
|
describe '#bind' do
|
112
112
|
let(:options) { { endpoint: RubySMB::Dcerpc::Srvsvc } }
|
113
113
|
let(:bind_packet) { RubySMB::Dcerpc::Bind.new(options) }
|
114
|
-
let(:ioctl_response) { RubySMB::SMB2::Packet::IoctlResponse.new }
|
115
114
|
let(:bind_ack_packet) { RubySMB::Dcerpc::BindAck.new }
|
116
115
|
|
117
116
|
before :example do
|
118
117
|
allow(RubySMB::Dcerpc::Bind).to receive(:new).and_return(bind_packet)
|
119
|
-
allow(pipe).to receive(:
|
118
|
+
allow(pipe).to receive(:write)
|
119
|
+
allow(pipe).to receive(:read)
|
120
120
|
bind_ack_packet.p_result_list.n_results = 1
|
121
121
|
bind_ack_packet.p_result_list.p_results[0].result = RubySMB::Dcerpc::BindAck::ACCEPTANCE
|
122
122
|
allow(RubySMB::Dcerpc::BindAck).to receive(:read).and_return(bind_ack_packet)
|
@@ -127,13 +127,20 @@ RSpec.describe RubySMB::SMB2::Pipe do
|
|
127
127
|
pipe.bind(options)
|
128
128
|
end
|
129
129
|
|
130
|
-
it '
|
131
|
-
expect(pipe).to receive(:
|
130
|
+
it 'writes to the named pipe' do
|
131
|
+
expect(pipe).to receive(:write).with(data: bind_packet.to_binary_s)
|
132
|
+
pipe.bind(options)
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'reads the socket' do
|
136
|
+
expect(pipe).to receive(:read)
|
132
137
|
pipe.bind(options)
|
133
138
|
end
|
134
139
|
|
135
140
|
it 'creates a BindAck packet from the response' do
|
136
|
-
|
141
|
+
raw_response = RubySMB::Dcerpc::BindAck.new.to_binary_s
|
142
|
+
allow(pipe).to receive(:read).and_return(raw_response)
|
143
|
+
expect(RubySMB::Dcerpc::BindAck).to receive(:read).with(raw_response).and_return(bind_ack_packet)
|
137
144
|
pipe.bind(options)
|
138
145
|
end
|
139
146
|
|
@@ -199,7 +206,7 @@ RSpec.describe RubySMB::SMB2::Pipe do
|
|
199
206
|
it 'raises the expected exception when it is not a BindAck packet' do
|
200
207
|
response = RubySMB::Dcerpc::Request.new
|
201
208
|
allow(RubySMB::Dcerpc::Response).to receive(:read).and_return(response)
|
202
|
-
expect { pipe.
|
209
|
+
expect { pipe.request(opnum, options) }.to raise_error(RubySMB::Dcerpc::Error::InvalidPacket)
|
203
210
|
end
|
204
211
|
|
205
212
|
it 'returns the expected DCERPC Response' do
|
metadata
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_smb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Maloney
|
8
8
|
- James Lee
|
9
|
+
- Dev Mohanty
|
10
|
+
- Christophe De La Fuente
|
9
11
|
autorequire:
|
10
12
|
bindir: bin
|
11
13
|
cert_chain:
|
@@ -89,7 +91,7 @@ cert_chain:
|
|
89
91
|
G+Hmcg1v810agasPdoydE0RTVZgEOOMoQ07qu7JFXVWZ9ZQpHT7qJATWL/b2csFG
|
90
92
|
8mVuTXnyJOKRJA==
|
91
93
|
-----END CERTIFICATE-----
|
92
|
-
date: 2018-03-
|
94
|
+
date: 2018-03-13 00:00:00.000000000 Z
|
93
95
|
dependencies:
|
94
96
|
- !ruby/object:Gem::Dependency
|
95
97
|
name: redcarpet
|
@@ -207,6 +209,8 @@ description: ''
|
|
207
209
|
email:
|
208
210
|
- DMaloney@rapid7.com
|
209
211
|
- egypt@metasploit.com
|
212
|
+
- dev_mohanty@rapid7.com
|
213
|
+
- paristvinternet-github@yahoo.com
|
210
214
|
executables: []
|
211
215
|
extensions: []
|
212
216
|
extra_rdoc_files: []
|
@@ -292,6 +296,7 @@ files:
|
|
292
296
|
- lib/ruby_smb/impersonation_levels.rb
|
293
297
|
- lib/ruby_smb/nbss.rb
|
294
298
|
- lib/ruby_smb/nbss/negative_session_response.rb
|
299
|
+
- lib/ruby_smb/nbss/netbios_name.rb
|
295
300
|
- lib/ruby_smb/nbss/session_header.rb
|
296
301
|
- lib/ruby_smb/nbss/session_request.rb
|
297
302
|
- lib/ruby_smb/smb1.rb
|
@@ -468,6 +473,7 @@ files:
|
|
468
473
|
- spec/lib/ruby_smb/fscc/fscc_file_attributes_spec.rb
|
469
474
|
- spec/lib/ruby_smb/generic_packet_spec.rb
|
470
475
|
- spec/lib/ruby_smb/nbss/negative_session_response_spec.rb
|
476
|
+
- spec/lib/ruby_smb/nbss/netbios_name_spec.rb
|
471
477
|
- spec/lib/ruby_smb/nbss/session_header_spec.rb
|
472
478
|
- spec/lib/ruby_smb/nbss/session_request_spec.rb
|
473
479
|
- spec/lib/ruby_smb/smb1/andx_block_spec.rb
|
@@ -646,6 +652,7 @@ test_files:
|
|
646
652
|
- spec/lib/ruby_smb/fscc/fscc_file_attributes_spec.rb
|
647
653
|
- spec/lib/ruby_smb/generic_packet_spec.rb
|
648
654
|
- spec/lib/ruby_smb/nbss/negative_session_response_spec.rb
|
655
|
+
- spec/lib/ruby_smb/nbss/netbios_name_spec.rb
|
649
656
|
- spec/lib/ruby_smb/nbss/session_header_spec.rb
|
650
657
|
- spec/lib/ruby_smb/nbss/session_request_spec.rb
|
651
658
|
- spec/lib/ruby_smb/smb1/andx_block_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|