Module: RubySMB::Dcerpc::Wkssvc

Defined in:
lib/ruby_smb/dcerpc/wkssvc.rb,
lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_request.rb,
lib/ruby_smb/dcerpc/wkssvc/netr_wksta_get_info_response.rb,
lib/ruby_smb/dcerpc/wkssvc/netr_wksta_user_enum_request.rb,
lib/ruby_smb/dcerpc/wkssvc/netr_wksta_user_enum_response.rb

Defined Under Namespace

Classes: LpwkstaInfo, NetrWkstaGetInfoRequest, NetrWkstaGetInfoResponse, NetrWkstaUserEnumRequest, NetrWkstaUserEnumResponse, PwkstaInfo100, PwkstaInfo101, PwkstaInfo102, PwkstaUserInfo0Container, PwkstaUserInfo1Container, WkssvcIdentifyHandle, WkstaInfo100, WkstaInfo101, WkstaInfo102, WkstaUserEnumStructure, WkstaUserInfo0, WkstaUserInfo0ArrayPtr, WkstaUserInfo0Container, WkstaUserInfo1, WkstaUserInfo1ArrayPtr, WkstaUserInfo1Container

Constant Summary collapse

UUID =
'6BFFD098-A112-3610-9833-46C3F87E345A'
VER_MAJOR =
1
VER_MINOR =
0
NETR_WKSTA_GET_INFO =

Operation numbers

0x0000
NETR_WKSTA_USER_ENUM =
0x0002
PLATFORM_ID =
{
  0x0000012C => "DOS",
  0x00000190 => "OS2",
  0x000001F4 => "Win",
  0x00000258 => "OSF",
  0x000002BC => "VMS"
}
WKSTA_INFO_100 =

Information Level

0x00000064
WKSTA_INFO_101 =
0x00000065
WKSTA_INFO_102 =
0x00000066
WKSTA_USER_INFO_0 =

User Enum Information Level

0x00000000
WKSTA_USER_INFO_1 =
0x00000001

Instance Method Summary collapse

Instance Method Details

#netr_wksta_get_info(server_name: '', level: WKSTA_INFO_100) ⇒ RubySMB::Dcerpc::Wkssvc::WkstaInfo100, ...

Returns details about a computer environment, including platform-specific information, the names of the domain and local computer, and the operating system version.

Parameters:

  • server_name (optional, String) (defaults to: '')

    String that identifies the server (optional since it is ignored by the server)

  • level (optional, Integer) (defaults to: WKSTA_INFO_100)

    The information level of the data (default: WKSTA_INFO_100)

Returns:

Raises:



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/ruby_smb/dcerpc/wkssvc.rb', line 120

def netr_wksta_get_info(server_name: '', level: WKSTA_INFO_100)
  wkst_netr_wksta_get_info_request = NetrWkstaGetInfoRequest.new(
    server_name: server_name,
    level: level
  )
  response = dcerpc_request(wkst_netr_wksta_get_info_request)
  begin
    wkst_netr_wksta_get_info_response = NetrWkstaGetInfoResponse.read(response)
  rescue IOError
    raise RubySMB::Dcerpc::Error::InvalidPacket, 'Error reading WkstNetrWkstaGetInfoResponse'
  end
  unless wkst_netr_wksta_get_info_response.error_status == WindowsError::NTStatus::STATUS_SUCCESS
    raise RubySMB::Dcerpc::Error::WkssvcError,
      "Error returned with netr_wksta_get_info: "\
      "#{WindowsError::NTStatus.find_by_retval(wkst_netr_wksta_get_info_response.error_status.value).join(',')}"
  end
  wkst_netr_wksta_get_info_response.wksta_info.info
end

#netr_wksta_user_enum(server_name: '', level: WKSTA_USER_INFO_0) ⇒ RubySMB::Dcerpc::Wkssvc::WkstaUserInfo0, RubySMB::Dcerpc::Wkssvc::WkstaUserInfo1

Returns details about users who are currently active on a remote computer.

The structure containing the requested information

Parameters:

  • server_name (optional, String) (defaults to: '')

    String that identifies the server (optional since it is ignored by the server)

  • level (optional, Integer) (defaults to: WKSTA_USER_INFO_0)

    The information level of the data (default: WKSTA_USER_INFO_0)

Returns:

Raises:



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/ruby_smb/dcerpc/wkssvc.rb', line 150

def netr_wksta_user_enum(server_name: '', level: WKSTA_USER_INFO_0)
  wkst_netr_wksta_enum_user_request = NetrWkstaUserEnumRequest.new(
    server_name: server_name,
    user_info: {
      level: level,
      tag: level,
      info: {
        wkui0_entries_read: 0,
      },
    },
    preferred_max_length: 0xFFFFFFFF,
    result_handle: 0
  )
  response = dcerpc_request(wkst_netr_wksta_enum_user_request)
  begin
    wkst_netr_wksta_enum_user_response = NetrWkstaUserEnumResponse.read(response)
  rescue IOError
    raise RubySMB::Dcerpc::Error::InvalidPacket, 'Error reading WkstNetrWkstaUserEnumResponse'
  end
  unless wkst_netr_wksta_enum_user_response.error_status == WindowsError::NTStatus::STATUS_SUCCESS
    raise RubySMB::Dcerpc::Error::WkssvcError,
      "Error returned with netr_wksta_enum_user: #{wkst_netr_wksta_enum_user_response.error_status.value} - "\
      "#{WindowsError::NTStatus.find_by_retval(wkst_netr_wksta_enum_user_response.error_status.value).join(',')}"
  end
  wkst_netr_wksta_enum_user_response..info
end