ruby_smb 2.0.4 → 2.0.9
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/.github/workflows/verify.yml +56 -0
- data/README.md +0 -1
- data/examples/delete_file.rb +0 -0
- data/examples/net_share_enum_all.rb +0 -0
- data/examples/pipes.rb +0 -0
- data/examples/rename_file.rb +0 -0
- data/lib/ruby_smb.rb +3 -2
- data/lib/ruby_smb/client.rb +25 -21
- data/lib/ruby_smb/client/negotiation.rb +10 -12
- data/lib/ruby_smb/compression.rb +7 -0
- data/lib/ruby_smb/compression/lznt1.rb +164 -0
- data/lib/ruby_smb/dcerpc.rb +3 -1
- data/lib/ruby_smb/dcerpc/ndr.rb +97 -0
- data/lib/ruby_smb/dcerpc/netlogon.rb +101 -0
- data/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_request.rb +37 -0
- data/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_response.rb +26 -0
- data/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_request.rb +37 -0
- data/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_response.rb +23 -0
- data/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_request.rb +32 -0
- data/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_response.rb +24 -0
- data/lib/ruby_smb/dcerpc/request.rb +6 -0
- data/lib/ruby_smb/dispatcher/socket.rb +1 -1
- data/lib/ruby_smb/smb1/file.rb +1 -1
- data/lib/ruby_smb/smb1/packet/trans2/find_first2_response.rb +0 -1
- data/lib/ruby_smb/smb1/packet/trans2/find_next2_response.rb +0 -1
- data/lib/ruby_smb/smb1/packet/trans2/open2_response.rb +1 -2
- data/lib/ruby_smb/smb1/packet/trans2/set_file_information_response.rb +1 -13
- data/lib/ruby_smb/smb1/pipe.rb +4 -2
- data/lib/ruby_smb/smb2/packet/compression_transform_header.rb +4 -0
- data/lib/ruby_smb/smb2/pipe.rb +6 -4
- data/lib/ruby_smb/version.rb +1 -1
- data/spec/lib/ruby_smb/client_spec.rb +17 -7
- data/spec/lib/ruby_smb/compression/lznt1_spec.rb +32 -0
- data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_request_spec.rb +69 -0
- data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_response_spec.rb +53 -0
- data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_request_spec.rb +69 -0
- data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_response_spec.rb +37 -0
- data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_request_spec.rb +45 -0
- data/spec/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_response_spec.rb +37 -0
- data/spec/lib/ruby_smb/smb1/file_spec.rb +1 -1
- data/spec/lib/ruby_smb/smb1/packet/trans2/find_first2_response_spec.rb +0 -1
- data/spec/lib/ruby_smb/smb1/packet/trans2/find_next2_response_spec.rb +0 -1
- data/spec/lib/ruby_smb/smb1/packet/trans2/open2_response_spec.rb +0 -5
- data/spec/lib/ruby_smb/smb1/packet/trans2/set_file_information_response_spec.rb +0 -6
- data/spec/spec_helper.rb +1 -1
- metadata +42 -19
- metadata.gz.sig +0 -0
- data/.travis.yml +0 -6
@@ -0,0 +1,37 @@
|
|
1
|
+
RSpec.describe RubySMB::Dcerpc::Netlogon::NetrServerReqChallengeResponse do
|
2
|
+
subject(:packet) { described_class.new }
|
3
|
+
|
4
|
+
it { is_expected.to respond_to :server_challenge }
|
5
|
+
it { is_expected.to respond_to :error_status }
|
6
|
+
|
7
|
+
it 'is little endian' do
|
8
|
+
expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#server_challenge' do
|
12
|
+
it 'is a NetlogonCredential structure' do
|
13
|
+
expect(packet.server_challenge).to be_a RubySMB::Dcerpc::Netlogon::NetlogonCredential
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#error_status' do
|
18
|
+
it 'is a 32-bit unsigned integer' do
|
19
|
+
expect(packet.error_status).to be_a BinData::Uint32le
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#initialize_instance' do
|
24
|
+
it 'sets #opnum to NETR_SERVER_REQ_CHALLENGE constant' do
|
25
|
+
expect(packet.opnum).to eq(RubySMB::Dcerpc::Netlogon::NETR_SERVER_REQ_CHALLENGE)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'reads its own binary representation and outputs the same packet' do
|
30
|
+
packet = described_class.new(
|
31
|
+
server_challenge: "\x00" * 8,
|
32
|
+
error_status: rand(0xffffffff)
|
33
|
+
)
|
34
|
+
binary = packet.to_binary_s
|
35
|
+
expect(described_class.read(binary)).to eq(packet)
|
36
|
+
end
|
37
|
+
end
|
@@ -473,7 +473,7 @@ RSpec.describe RubySMB::SMB1::File do
|
|
473
473
|
end
|
474
474
|
|
475
475
|
it 'sets the File Information #rename_pending field of the packet' do
|
476
|
-
expect(file.rename_packet(filename).data_block.trans2_data.info_level_struct.file_name).to eq filename
|
476
|
+
expect(file.rename_packet(filename).data_block.trans2_data.info_level_struct.file_name).to eq filename
|
477
477
|
end
|
478
478
|
|
479
479
|
it 'sets the Trans2 ParameterBlock fields' do
|
@@ -32,7 +32,6 @@ RSpec.describe RubySMB::SMB1::Packet::Trans2::FindFirst2Response do
|
|
32
32
|
describe '#data_block' do
|
33
33
|
subject(:data_block) { packet.data_block }
|
34
34
|
|
35
|
-
it { is_expected.to respond_to :name }
|
36
35
|
it { is_expected.to respond_to :trans2_parameters }
|
37
36
|
it { is_expected.to respond_to :trans2_data }
|
38
37
|
|
@@ -32,7 +32,6 @@ RSpec.describe RubySMB::SMB1::Packet::Trans2::FindNext2Response do
|
|
32
32
|
describe '#data_block' do
|
33
33
|
subject(:data_block) { packet.data_block }
|
34
34
|
|
35
|
-
it { is_expected.to respond_to :name }
|
36
35
|
it { is_expected.to respond_to :trans2_parameters }
|
37
36
|
it { is_expected.to respond_to :trans2_data }
|
38
37
|
|
@@ -35,16 +35,11 @@ RSpec.describe RubySMB::SMB1::Packet::Trans2::Open2Response do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it { is_expected.to respond_to :trans2_parameters }
|
38
|
-
it { is_expected.to respond_to :trans2_data }
|
39
38
|
|
40
39
|
it 'should keep #trans2_parameters 4-byte aligned' do
|
41
40
|
expect(data_block.trans2_parameters.abs_offset % 4).to eq 0
|
42
41
|
end
|
43
42
|
|
44
|
-
it 'should keep #trans2_data 4-byte aligned' do
|
45
|
-
expect(data_block.trans2_data.abs_offset % 4).to eq 0
|
46
|
-
end
|
47
|
-
|
48
43
|
describe '#trans2_parameters' do
|
49
44
|
subject(:parameters) { data_block.trans2_parameters }
|
50
45
|
|
@@ -28,18 +28,12 @@ RSpec.describe RubySMB::SMB1::Packet::Trans2::SetFileInformationResponse do
|
|
28
28
|
describe '#data_block' do
|
29
29
|
subject(:data_block) { packet.data_block }
|
30
30
|
|
31
|
-
it { is_expected.to respond_to :name }
|
32
31
|
it { is_expected.to respond_to :trans2_parameters }
|
33
|
-
it { is_expected.to respond_to :trans2_data }
|
34
32
|
|
35
33
|
it 'should keep #trans2_parameters 4-byte aligned' do
|
36
34
|
expect(data_block.trans2_parameters.abs_offset % 4).to eq 0
|
37
35
|
end
|
38
36
|
|
39
|
-
it 'should keep #trans2_data 4-byte aligned' do
|
40
|
-
expect(data_block.trans2_data.abs_offset % 4).to eq 0
|
41
|
-
end
|
42
|
-
|
43
37
|
describe '#trans2_parameters' do
|
44
38
|
subject(:parameters) { data_block.trans2_parameters }
|
45
39
|
|
data/spec/spec_helper.rb
CHANGED
@@ -7,7 +7,7 @@ end
|
|
7
7
|
require 'coveralls'
|
8
8
|
require 'ruby_smb'
|
9
9
|
|
10
|
-
if ENV['
|
10
|
+
if ENV['CI'] == 'true'
|
11
11
|
# don't generate local report as it is inaccessible on travis-ci, which is
|
12
12
|
# why coveralls is being used.
|
13
13
|
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_smb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Metasploit Hackers
|
@@ -68,20 +68,20 @@ cert_chain:
|
|
68
68
|
-----END CERTIFICATE-----
|
69
69
|
- |
|
70
70
|
-----BEGIN CERTIFICATE-----
|
71
|
-
|
71
|
+
MIIFIzCCBAugAwIBAgIQCMePMbkSxvnPeJhYXIfaxzANBgkqhkiG9w0BAQsFADBy
|
72
72
|
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
|
73
73
|
d3cuZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQg
|
74
|
-
|
74
|
+
SUQgQ29kZSBTaWduaW5nIENBMB4XDTIwMTAwNzAwMDAwMFoXDTIzMTEwNjEyMDAw
|
75
75
|
MFowYDELMAkGA1UEBhMCVVMxFjAUBgNVBAgTDU1hc3NhY2h1c2V0dHMxDzANBgNV
|
76
76
|
BAcTBkJvc3RvbjETMBEGA1UEChMKUmFwaWQ3IExMQzETMBEGA1UEAxMKUmFwaWQ3
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
77
|
+
IExMQzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALNTz4zvAy7h/vQp
|
78
|
+
4dr1txXHlABAagkwYYwTMCtHs5PXsJITx/5SAjx5swuaLfze5kPBNF2YImvFlOXY
|
79
|
+
WaB+0PsOnXnaARsDZU683xFlj8izU6IN6VrAHzDLKFBzruJENrOJD/ikbEtbjO/q
|
80
|
+
gFbmS9J9v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XUc+bDiNNwcZ7yc5o78UNRvp9Jxghya17Q76c9Ov9wvnv
|
96
|
+
dxxQKWGOQy0m4fBrkyjAyH9Djjn81RbQrqYgPuhd5nD0HjN3VUQLhQbIJrk9TVs0
|
97
|
+
EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
|
98
|
+
9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
|
99
99
|
-----END CERTIFICATE-----
|
100
|
-
date:
|
100
|
+
date: 2021-05-17 00:00:00.000000000 Z
|
101
101
|
dependencies:
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: redcarpet
|
@@ -246,10 +246,10 @@ executables: []
|
|
246
246
|
extensions: []
|
247
247
|
extra_rdoc_files: []
|
248
248
|
files:
|
249
|
+
- ".github/workflows/verify.yml"
|
249
250
|
- ".gitignore"
|
250
251
|
- ".rspec"
|
251
252
|
- ".simplecov"
|
252
|
-
- ".travis.yml"
|
253
253
|
- ".yardopts"
|
254
254
|
- CONTRIBUTING.md
|
255
255
|
- Gemfile
|
@@ -284,12 +284,21 @@ files:
|
|
284
284
|
- lib/ruby_smb/client/tree_connect.rb
|
285
285
|
- lib/ruby_smb/client/utils.rb
|
286
286
|
- lib/ruby_smb/client/winreg.rb
|
287
|
+
- lib/ruby_smb/compression.rb
|
288
|
+
- lib/ruby_smb/compression/lznt1.rb
|
287
289
|
- lib/ruby_smb/crypto.rb
|
288
290
|
- lib/ruby_smb/dcerpc.rb
|
289
291
|
- lib/ruby_smb/dcerpc/bind.rb
|
290
292
|
- lib/ruby_smb/dcerpc/bind_ack.rb
|
291
293
|
- lib/ruby_smb/dcerpc/error.rb
|
292
294
|
- lib/ruby_smb/dcerpc/ndr.rb
|
295
|
+
- lib/ruby_smb/dcerpc/netlogon.rb
|
296
|
+
- lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_request.rb
|
297
|
+
- lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_response.rb
|
298
|
+
- lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_request.rb
|
299
|
+
- lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_response.rb
|
300
|
+
- lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_request.rb
|
301
|
+
- lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_response.rb
|
293
302
|
- lib/ruby_smb/dcerpc/p_syntax_id_t.rb
|
294
303
|
- lib/ruby_smb/dcerpc/pdu_header.rb
|
295
304
|
- lib/ruby_smb/dcerpc/ptypes.rb
|
@@ -519,10 +528,17 @@ files:
|
|
519
528
|
- lib/ruby_smb/version.rb
|
520
529
|
- ruby_smb.gemspec
|
521
530
|
- spec/lib/ruby_smb/client_spec.rb
|
531
|
+
- spec/lib/ruby_smb/compression/lznt1_spec.rb
|
522
532
|
- spec/lib/ruby_smb/crypto_spec.rb
|
523
533
|
- spec/lib/ruby_smb/dcerpc/bind_ack_spec.rb
|
524
534
|
- spec/lib/ruby_smb/dcerpc/bind_spec.rb
|
525
535
|
- spec/lib/ruby_smb/dcerpc/ndr_spec.rb
|
536
|
+
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_request_spec.rb
|
537
|
+
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_response_spec.rb
|
538
|
+
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_request_spec.rb
|
539
|
+
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_response_spec.rb
|
540
|
+
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_request_spec.rb
|
541
|
+
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_response_spec.rb
|
526
542
|
- spec/lib/ruby_smb/dcerpc/p_syntax_id_t_spec.rb
|
527
543
|
- spec/lib/ruby_smb/dcerpc/pdu_header_spec.rb
|
528
544
|
- spec/lib/ruby_smb/dcerpc/request_spec.rb
|
@@ -747,10 +763,17 @@ specification_version: 4
|
|
747
763
|
summary: A pure Ruby implementation of the SMB Protocol Family
|
748
764
|
test_files:
|
749
765
|
- spec/lib/ruby_smb/client_spec.rb
|
766
|
+
- spec/lib/ruby_smb/compression/lznt1_spec.rb
|
750
767
|
- spec/lib/ruby_smb/crypto_spec.rb
|
751
768
|
- spec/lib/ruby_smb/dcerpc/bind_ack_spec.rb
|
752
769
|
- spec/lib/ruby_smb/dcerpc/bind_spec.rb
|
753
770
|
- spec/lib/ruby_smb/dcerpc/ndr_spec.rb
|
771
|
+
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_request_spec.rb
|
772
|
+
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_authenticate3_response_spec.rb
|
773
|
+
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_request_spec.rb
|
774
|
+
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_password_set2_response_spec.rb
|
775
|
+
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_request_spec.rb
|
776
|
+
- spec/lib/ruby_smb/dcerpc/netlogon/netr_server_req_challenge_response_spec.rb
|
754
777
|
- spec/lib/ruby_smb/dcerpc/p_syntax_id_t_spec.rb
|
755
778
|
- spec/lib/ruby_smb/dcerpc/pdu_header_spec.rb
|
756
779
|
- spec/lib/ruby_smb/dcerpc/request_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|