Coverage for /private/tmp/im/impacket/impacket/dcerpc/v5/dcom/vds.py : 57%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved. # # This software is provided under under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # for more information. # # Author: Alberto Solino (@agsolino) # # Description: # [MS-VDS]: Virtual Disk Service (VDS) Protocol # This was used as a way to test the DCOM runtime. Further # testing is needed to verify it is working as expected # # Best way to learn how to use these calls is to grab the protocol standard # so you understand what the call does, and then read the test case located # at https://github.com/SecureAuthCorp/impacket/tree/master/tests/SMB_RPC # # Since DCOM is like an OO RPC, instead of helper functions you will see the # classes described in the standards developed. # There are test cases for them too. #
DCERPCException.__init__(self, error_string, error_code, packet)
if self.error_code in hresult_errors.ERROR_MESSAGES: error_msg_short = hresult_errors.ERROR_MESSAGES[self.error_code][0] error_msg_verbose = hresult_errors.ERROR_MESSAGES[self.error_code][1] return 'VDS SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose) else: return 'VDS SessionError: unknown error code: 0x%x' % (self.error_code)
################################################################################ # CONSTANTS ################################################################################ # 1.9 Standards Assignments
# 2.2.1.1.3 VDS_OBJECT_ID
################################################################################ # STRUCTURES ################################################################################ # 2.2.2.1.3.1 VDS_SERVICE_PROP ('pwszVersion',LPWSTR), ('ulFlags',ULONG), )
# 2.2.2.7.1.1 VDS_PROVIDER_TYPE
# 2.2.2.7.2.1 VDS_PROVIDER_PROP ('id',VDS_OBJECT_ID), ('pwszName',LPWSTR), ('guidVersionId',GUID), ('pwszVersion',LPWSTR), ('type',VDS_PROVIDER_TYPE), ('ulFlags',ULONG), ('ulStripeSizeFlags',ULONG), ('sRebuildPriority',SHORT), )
################################################################################ # RPC CALLS ################################################################################
# 3.4.5.2.5.1 IVdsServiceInitialization::Initialize (Opnum 3) ('pwszMachineName', LPWSTR), )
('ErrorCode', error_status_t), )
# 3.4.5.2.4.1 IVdsService::IsServiceReady (Opnum 3) )
('ErrorCode', error_status_t), )
# 3.4.5.2.4.2 IVdsService::WaitForServiceReady (Opnum 4) )
('ErrorCode', error_status_t), )
# 3.4.5.2.4.3 IVdsService::GetProperties (Opnum 5) )
('pServiceProp', VDS_SERVICE_PROP), ('ErrorCode', error_status_t), )
# 3.4.5.2.4.4 IVdsService::QueryProviders (Opnum 6) ('masks', DWORD), )
('ppEnum', PMInterfacePointer), ('ErrorCode', error_status_t), )
# 3.1.1.1 IEnumVdsObject Interface # 3.4.5.2.1.1 IEnumVdsObject::Next (Opnum 3) ('celt', ULONG), )
('ppObjectArray', OBJECT_ARRAY), ('pcFetched', ULONG), ('ErrorCode', error_status_t), ) # 3.4.5.2.14.1 IVdsProvider::GetProperties (Opnum 3) )
('pProviderProp', VDS_PROVIDER_PROP), ('ErrorCode', error_status_t), )
################################################################################ # OPNUMs and their corresponding structures ################################################################################ }
################################################################################ # HELPER FUNCTIONS AND INTERFACES ################################################################################ request = IEnumVdsObject_Next() request['ORPCthis'] = self.get_cinstance().get_ORPCthis() request['ORPCthis']['flags'] = 0 request['celt'] = celt try: resp = self.request(request, uuid = self.get_iPid()) except Exception as e: resp = e.get_packet() # If it is S_FALSE(1) means less items were returned if resp['ErrorCode'] != 1: raise interfaces = list() for interface in resp['ppObjectArray']: interfaces.append(IRemUnknown2(INTERFACE(self.get_cinstance(), ''.join(interface['abData']), self.get_ipidRemUnknown(), target = self.get_target()))) return interfaces
request = IVdsProvider_GetProperties() request['ORPCthis'] = self.get_cinstance().get_ORPCthis() request['ORPCthis']['flags'] = 0 resp = self.request(request, uuid = self.get_iPid()) return resp
IRemUnknown2.__init__(self, interface)
request = IVdsServiceInitialization_Initialize() request['ORPCthis'] = self.get_cinstance().get_ORPCthis() request['ORPCthis']['flags'] = 0 request['pwszMachineName'] = '\x00' resp = self.request(request, uuid = self.get_iPid()) return resp
IRemUnknown2.__init__(self, interface)
request = IVdsService_IsServiceReady() request['ORPCthis'] = self.get_cinstance().get_ORPCthis() request['ORPCthis']['flags'] = 0 try: resp = self.request(request, uuid = self.get_iPid()) except Exception as e: resp = e.get_packet() return resp
request = IVdsService_WaitForServiceReady() request['ORPCthis'] = self.get_cinstance().get_ORPCthis() request['ORPCthis']['flags'] = 0 resp = self.request(request, uuid = self.get_iPid()) return resp
request = IVdsService_GetProperties() request['ORPCthis'] = self.get_cinstance().get_ORPCthis() request['ORPCthis']['flags'] = 0 resp = self.request(request, uuid = self.get_iPid()) return resp
request = IVdsService_QueryProviders() request['ORPCthis'] = self.get_cinstance().get_ORPCthis() request['ORPCthis']['flags'] = 0 request['masks'] = masks resp = self.request(request, uuid = self.get_iPid()) return IEnumVdsObject(INTERFACE(self.get_cinstance(), ''.join(resp['ppEnum']['abData']), self.get_ipidRemUnknown(), target = self.get_target())) |