ruby_smb 3.3.5 → 3.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b89cb4c288acaa9a8a0b92a92051e3d441f8a0221d4fd07d8e450a100e60c9f3
4
- data.tar.gz: '08ea52772ee67282ccc7bc1fd488e6ef7eb486960086c69aa8bff8945c67fe2f'
3
+ metadata.gz: 69dcf2cf8fa1b0bfe541d6c8fca903fedeb202a779a57ea8f7603122f0ffdd4a
4
+ data.tar.gz: ea05a9a1c3a6c4120e56b9cd2656b70ffb7aa3f0b857596ae00104236271154c
5
5
  SHA512:
6
- metadata.gz: 3051889e91d780f88b08bfca39078bd25b00b9e8ef0eabd61e9e22a1636a2d760add5fc6e57b3316a500072ff0029f4c4f0485f3a3c52db80b9626c0458d5e6e
7
- data.tar.gz: 7f212f644989208c3d2d319e90be6bba3796abac64f458d41edcb56423afccf7cca307a88ef2d0eb55ddcd074b9c69d8c1bca2800965644ef01a160ab069c22f
6
+ metadata.gz: 3567cb640cb9221e3bd79adfbb26b9e8a6b2f0baa7b474b61d9fb02e283c72f53148542b5a271263e1c8ea77c9e5c84935123fec5e72c6f2146c8bee563b354f
7
+ data.tar.gz: 8fe76d29d6d96a63bad52c316909263e6e335819fc0bfcc04e2f5d0783c7c526ebb1b89c2c2b53798eebdcdec66954264d10b99cfdb8cccd5c4c488fba6473ad
checksums.yaml.gz.sig CHANGED
Binary file
@@ -66,12 +66,16 @@ module RubySMB::Dcerpc::Ndr
66
66
  end
67
67
 
68
68
  # [Integers](https://pubs.opengroup.org/onlinepubs/9629399/chap14.htm#tagcjh_19_02_05)
69
- # This will define the four size Integers accepted by the NDR protocol:
69
+ # This will define the eight Integers accepted by the NDR protocol:
70
+ # - NdrInt8
70
71
  # - NdrUint8
72
+ # - NdrInt16
71
73
  # - NdrUint16
74
+ # - NdrInt32
72
75
  # - NdrUint32
76
+ # - NdrInt64
73
77
  # - NdrUint64
74
- {Uint8: 1, Uint16le: 2, Uint32le: 4, Uint64le: 8}.each do |klass, nb_bytes|
78
+ {Int8: 1, Uint8: 1, Int16le: 2, Uint16le: 2, Int32le: 4, Uint32le: 4, Int64le: 8, Uint64le: 8}.each do |klass, nb_bytes|
75
79
  new_klass_name = "Ndr#{klass.to_s.chomp('le')}"
76
80
  unless self.const_defined?(new_klass_name)
77
81
  new_klass = Class.new(BinData.const_get(klass)) do
@@ -74,6 +74,7 @@ module RubySMB
74
74
  samr_create_user2_in_domain_request Samr::SAMR_CREATE_USER2_IN_DOMAIN
75
75
  samr_set_information_user2_request Samr::SAMR_SET_INFORMATION_USER2
76
76
  samr_delete_user_request Samr::SAMR_DELETE_USER
77
+ samr_query_information_domain_request Samr::SAMR_QUERY_INFORMATION_DOMAIN
77
78
  string :default
78
79
  end
79
80
  choice 'Wkssvc', selection: -> { opnum } do
@@ -0,0 +1,151 @@
1
+ module RubySMB
2
+ module Dcerpc
3
+ module Samr
4
+ # [2.2.3.5 DOMAIN_PASSWORD_INFORMATION](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/0ae356d8-c220-4706-846e-ebbdc6fabdcb)
5
+ class SamprDomainPasswordInformation < Ndr::NdrStruct
6
+ default_parameters byte_align: 4
7
+ endian :little
8
+
9
+ ndr_uint16 :min_password_length
10
+ ndr_uint16 :password_history_length
11
+ ndr_uint32 :password_properties
12
+ ndr_int64 :max_password_age
13
+ ndr_int64 :min_password_age
14
+ end
15
+
16
+ # [2.2.3.12 SAMPR_DOMAIN_OEM_INFORMATION](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/7cbb7ff0-e593-440d-8341-a3435195cdf1)
17
+ class SamprDomainOemInformation < Ndr::NdrStruct
18
+ default_parameters byte_align: 4
19
+ endian :little
20
+
21
+ rpc_unicode_string :oem_information
22
+ end
23
+
24
+ # [2.2.3.7 DOMAIN_SERVER_ROLE_INFORMATION](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/cb0e586a-29c8-49b2-8ced-c273a7476c22)
25
+ class SamprDomainServerRoleInformation < Ndr::NdrStruct
26
+ default_parameters byte_align: 4
27
+ endian :little
28
+
29
+ ndr_uint16 :domain_server_role
30
+ end
31
+
32
+ # [2.2.3.15 SAMPR_DOMAIN_LOCKOUT_INFORMATION](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/c9d789ed-c54a-4450-be56-251e627e1f52)
33
+ class SamprDomainLockoutInformation < Ndr::NdrStruct
34
+ default_parameters byte_align: 4
35
+ endian :little
36
+
37
+ ndr_uint64 :lockout_duration
38
+ ndr_uint64 :lockout_observation_window
39
+ ndr_uint16 :lockout_threshold
40
+ end
41
+
42
+ # [2.2.3.10 SAMPR_DOMAIN_GENERAL_INFORMATION](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/85973e1c-96f2-4c80-8135-b24d74ad7794)
43
+ class SamprDomainGeneralInformation < Ndr::NdrStruct
44
+ default_parameters byte_align: 4
45
+ endian :little
46
+
47
+ ndr_int64 :force_logoff
48
+ rpc_unicode_string :oem_information
49
+ rpc_unicode_string :domain_name
50
+ rpc_unicode_string :replica_source_node_name
51
+ ndr_int64 :domain_modified_count
52
+ ndr_uint32 :domain_server_state
53
+ ndr_uint32 :domain_server_role
54
+ ndr_uint8 :uas_compatibility_required
55
+ ndr_uint32 :user_count
56
+ ndr_uint32 :group_count
57
+ ndr_uint32 :alias_count
58
+ end
59
+
60
+ # [2.2.3.6 DOMAIN_LOGOFF_INFORMATION](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/6fb0bbea-888c-4353-b5f8-75e7862344be)
61
+ class SamprDomainLogoffInformation < Ndr::NdrStruct
62
+ default_parameters byte_align: 4
63
+ endian :little
64
+
65
+ ndr_int64 :force_logoff
66
+ end
67
+
68
+ # [2.2.3.13 SAMPR_DOMAIN_NAME_INFORMATION](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/5131d2c0-04c7-4c1b-8fd5-0b0b6cfa6c24)
69
+ class SamprDomainNameInformation < Ndr::NdrStruct
70
+ default_parameters byte_align: 4
71
+ endian :little
72
+
73
+ rpc_unicode_string :domain_name
74
+ end
75
+
76
+ # [2.2.3.8 DOMAIN_MODIFIED_INFORMATION](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/e1da9680-8968-423b-98c0-fbdcf1535ef9)
77
+ class SamprDomainModifiedInformation < Ndr::NdrStruct
78
+ default_parameters byte_align: 4
79
+ endian :little
80
+
81
+ ndr_int64 :domain_modified_count
82
+ ndr_int64 :creation_time
83
+ end
84
+
85
+ # [2.2.3.9 DOMAIN_MODIFIED_INFORMATION2](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/47eea81b-5fee-4925-b5c1-fc594dcc8dff)
86
+ class SamprDomainModifiedInformation2 < Ndr::NdrStruct
87
+ default_parameters byte_align: 4
88
+ endian :little
89
+
90
+ ndr_int64 :domain_modified_count
91
+ ndr_int64 :creation_time
92
+ ndr_int64 :modified_count_at_last_promotion
93
+ end
94
+
95
+ # [2.2.3.3 DOMAIN_STATE_INFORMATION](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/f224edcf-8d4e-4294-b0c3-b0eda384c402)
96
+ class SamprDomainStateInformation < Ndr::NdrStruct
97
+ default_parameters byte_align: 4
98
+ endian :little
99
+
100
+ ndr_uint16 :domain_server_state
101
+ end
102
+
103
+ # [2.2.3.11 SAMPR_DOMAIN_GENERAL_INFORMATION2](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/9a663cf2-0923-4959-b2c5-2e25c19735ff)
104
+ class SamprDomainGeneralInformation2 < Ndr::NdrStruct
105
+ default_parameters byte_align: 4
106
+ endian :little
107
+
108
+ sampr_domain_general_information :i1
109
+ ndr_uint64 :lockout_duration
110
+ ndr_uint64 :lockout_observation_window
111
+ ndr_uint16 :lockout_threshold
112
+ end
113
+
114
+ # [2.2.3.14 SAMPR_DOMAIN_REPLICATION_INFORMATION](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/c9293797-e11d-4098-be12-bf9e1de91f20)
115
+ class SamprDomainReplicationInformation < Ndr::NdrStruct
116
+ default_parameters byte_align: 4
117
+ endian :little
118
+
119
+ rpc_unicode_string :replica_node_name
120
+ end
121
+
122
+ # [2.2.3.17 SAMPR_DOMAIN_INFO_BUFFER](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/1adc2142-dbb8-4554-aa24-010c713698bf)
123
+ class SamprDomainInfoBuffer < BinData::Record
124
+ default_parameters byte_align: 4
125
+ endian :little
126
+
127
+ uint16 :info_class
128
+ skip length: 2
129
+
130
+ choice :buffer, selection: :info_class do
131
+ sampr_domain_password_information DOMAIN_PASSWORD_INFORMATION
132
+ sampr_domain_oem_information DOMAIN_OEM_INFORMATION
133
+ sampr_domain_server_role_information DOMAIN_SERVER_ROLE_INFORMATION
134
+ sampr_domain_lockout_information DOMAIN_LOCKOUT_INFORMATION
135
+ sampr_domain_logoff_information DOMAIN_LOGOFF_INFORMATION
136
+ sampr_domain_general_information DOMAIN_GENERAL_INFORMATION
137
+ sampr_domain_name_information DOMAIN_NAME_INFORMATION
138
+ sampr_domain_modified_information DOMAIN_MODIFIED_INFORMATION
139
+ sampr_domain_modified_information2 DOMAIN_MODIFIED_INFORMATION2
140
+ sampr_domain_state_information DOMAIN_STATE_INFORMATION
141
+ sampr_domain_general_information2 DOMAIN_GENERAL_INFORMATION2
142
+ sampr_domain_replication_information DOMAIN_REPLICATION_INFORMATION
143
+ end
144
+ end
145
+
146
+ class PsamprDomainInfoBuffer < SamprDomainInfoBuffer
147
+ extend Ndr::PointerClassPlugin
148
+ end
149
+ end
150
+ end
151
+ end
@@ -0,0 +1,22 @@
1
+ module RubySMB
2
+ module Dcerpc
3
+ module Samr
4
+
5
+ # [3.1.5.5.2 SamrQueryInformationDomain (Opnum 8)](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/5d6a2817-caa9-41ca-a269-fd13ecbb4fa8)
6
+ class SamrQueryInformationDomainRequest < BinData::Record
7
+ attr_reader :opnum
8
+
9
+ endian :little
10
+
11
+ sampr_handle :domain_handle
12
+ ndr_uint16 :domain_information_class
13
+
14
+ def initialize_instance
15
+ super
16
+ @opnum = SAMR_QUERY_INFORMATION_DOMAIN
17
+ end
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,23 @@
1
+ module RubySMB
2
+ module Dcerpc
3
+ module Samr
4
+
5
+ # [3.1.5.5.2 SamrQueryInformationDomain (Opnum 8)](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/5d6a2817-caa9-41ca-a269-fd13ecbb4fa8)
6
+ class SamrQueryInformationDomainResponse < BinData::Record
7
+ attr_reader :opnum
8
+
9
+ endian :little
10
+
11
+ psampr_domain_info_buffer :buffer
12
+ ndr_uint32 :error_status
13
+
14
+ def initialize_instance
15
+ super
16
+ @opnum = SAMR_QUERY_INFORMATION_DOMAIN
17
+ end
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+
@@ -16,6 +16,7 @@ module RubySMB
16
16
  SAMR_LOOKUP_DOMAIN_IN_SAM_SERVER = 0x0005
17
17
  SAMR_ENUMERATE_DOMAINS_IN_SAM_SERVER = 0x0006
18
18
  SAMR_OPEN_DOMAIN = 0x0007
19
+ SAMR_QUERY_INFORMATION_DOMAIN = 0x0008
19
20
  SAMR_ENUMERATE_USERS_IN_DOMAIN = 0x000D
20
21
  SAMR_GET_ALIAS_MEMBERSHIP = 0x0010
21
22
  SAMR_LOOKUP_NAMES_IN_DOMAIN = 0x0011
@@ -139,6 +140,20 @@ module RubySMB
139
140
  USER_ALL_SECURITYDESCRIPTOR = 0x10000000
140
141
  USER_ALL_UNDEFINED_MASK = 0xC0000000
141
142
 
143
+ # [2.2.3.16 DOMAIN_INFORMATION_CLASS Values](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/6b0dff90-5ac0-429a-93aa-150334adabf6)
144
+ DOMAIN_PASSWORD_INFORMATION = 1
145
+ DOMAIN_GENERAL_INFORMATION = 2
146
+ DOMAIN_LOGOFF_INFORMATION = 3
147
+ DOMAIN_OEM_INFORMATION = 4
148
+ DOMAIN_NAME_INFORMATION = 5
149
+ DOMAIN_REPLICATION_INFORMATION = 6
150
+ DOMAIN_SERVER_ROLE_INFORMATION = 7
151
+ DOMAIN_MODIFIED_INFORMATION = 8
152
+ DOMAIN_STATE_INFORMATION = 9
153
+ DOMAIN_GENERAL_INFORMATION2 = 11
154
+ DOMAIN_LOCKOUT_INFORMATION = 12
155
+ DOMAIN_MODIFIED_INFORMATION2 = 13
156
+
142
157
  # [2.2.6.28 USER_INFORMATION_CLASS Values](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/6b0dff90-5ac0-429a-93aa-150334adabf6)
143
158
  USER_GENERAL_INFORMATION = 1
144
159
  USER_PREFERENCES_INFORMATION = 2
@@ -474,6 +489,7 @@ module RubySMB
474
489
  end
475
490
 
476
491
  require 'ruby_smb/dcerpc/samr/rpc_sid'
492
+ require 'ruby_smb/dcerpc/samr/sampr_domain_info_buffer'
477
493
 
478
494
  require 'ruby_smb/dcerpc/samr/samr_connect_request'
479
495
  require 'ruby_smb/dcerpc/samr/samr_connect_response'
@@ -503,6 +519,8 @@ module RubySMB
503
519
  require 'ruby_smb/dcerpc/samr/samr_set_information_user2_response'
504
520
  require 'ruby_smb/dcerpc/samr/samr_delete_user_request'
505
521
  require 'ruby_smb/dcerpc/samr/samr_delete_user_response'
522
+ require 'ruby_smb/dcerpc/samr/samr_query_information_domain_request'
523
+ require 'ruby_smb/dcerpc/samr/samr_query_information_domain_response'
506
524
 
507
525
  # Returns a handle to a server object.
508
526
  #
@@ -979,7 +997,30 @@ module RubySMB
979
997
  samr_get_groups_for_user_reponse.groups.groups.to_ary
980
998
  end
981
999
 
1000
+ # Returns domain information.
1001
+ #
1002
+ # @param domain_handle [RubySMB::Dcerpc::Samr::SamprHandle] An RPC context
1003
+ # representing a domain object
1004
+ # @param info_class [Integer] The class of information to retrieve
1005
+ # @return [BinData::Choice] The requested information.
1006
+ def samr_query_information_domain(domain_handle:, info_class:)
1007
+ samr_request = SamrQueryInformationDomainRequest.new(
1008
+ domain_handle: domain_handle,
1009
+ domain_information_class: info_class
1010
+ )
1011
+ response = dcerpc_request(samr_request)
1012
+ begin
1013
+ samr_response = SamrQueryInformationDomainResponse.read(response)
1014
+ rescue IOError
1015
+ raise RubySMB::Dcerpc::Error::InvalidPacket, 'Error reading SamrQueryInformationDomainResponse'
1016
+ end
1017
+ unless samr_response.error_status == WindowsError::NTStatus::STATUS_SUCCESS
1018
+ raise RubySMB::Dcerpc::Error::SamrError,
1019
+ "Error returned while querying domain information: "\
1020
+ "#{WindowsError::NTStatus.find_by_retval(samr_response.error_status.value).join(',')}"
1021
+ end
1022
+ samr_response.buffer.buffer
1023
+ end
982
1024
  end
983
1025
  end
984
1026
  end
985
-
@@ -1,3 +1,3 @@
1
1
  module RubySMB
2
- VERSION = '3.3.5'.freeze
2
+ VERSION = '3.3.6'.freeze
3
3
  end
data.tar.gz.sig CHANGED
Binary file
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: 3.3.5
4
+ version: 3.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
@@ -38,7 +38,7 @@ cert_chain:
38
38
  DgscAao7wB3xW2BWEp1KnaDWkf1x9ttgoBEYyuYwU7uatB67kBQG1PKvLt79wHvz
39
39
  Dxs+KOjGbBRfMnPgVGYkORKVrZIwlaboHbDKxcVW5xv+oZc7KYXWGg==
40
40
  -----END CERTIFICATE-----
41
- date: 2024-04-12 00:00:00.000000000 Z
41
+ date: 2024-04-25 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: redcarpet
@@ -309,6 +309,7 @@ files:
309
309
  - lib/ruby_smb/dcerpc/rrp_rpc_unicode_string.rb
310
310
  - lib/ruby_smb/dcerpc/samr.rb
311
311
  - lib/ruby_smb/dcerpc/samr/rpc_sid.rb
312
+ - lib/ruby_smb/dcerpc/samr/sampr_domain_info_buffer.rb
312
313
  - lib/ruby_smb/dcerpc/samr/samr_close_handle_request.rb
313
314
  - lib/ruby_smb/dcerpc/samr/samr_close_handle_response.rb
314
315
  - lib/ruby_smb/dcerpc/samr/samr_connect_request.rb
@@ -333,6 +334,8 @@ files:
333
334
  - lib/ruby_smb/dcerpc/samr/samr_open_domain_response.rb
334
335
  - lib/ruby_smb/dcerpc/samr/samr_open_user_request.rb
335
336
  - lib/ruby_smb/dcerpc/samr/samr_open_user_response.rb
337
+ - lib/ruby_smb/dcerpc/samr/samr_query_information_domain_request.rb
338
+ - lib/ruby_smb/dcerpc/samr/samr_query_information_domain_response.rb
336
339
  - lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_request.rb
337
340
  - lib/ruby_smb/dcerpc/samr/samr_rid_to_sid_response.rb
338
341
  - lib/ruby_smb/dcerpc/samr/samr_set_information_user2_request.rb
@@ -956,7 +959,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
956
959
  - !ruby/object:Gem::Version
957
960
  version: '0'
958
961
  requirements: []
959
- rubygems_version: 3.1.4
962
+ rubygems_version: 3.4.18
960
963
  signing_key:
961
964
  specification_version: 4
962
965
  summary: A pure Ruby implementation of the SMB Protocol Family
metadata.gz.sig CHANGED
Binary file