def hNspiResolveNamesW(dce, handler, ContainerID=0, pPropTags=[], pPropTagsRaw=NULL, paStr=[]): request = NspiResolveNamesW() request['hRpc'] = handler request['pStat']['ContainerID'] = ContainerID if len(pPropTags) > 0: for aulPropTag in pPropTags: prop = DWORD() prop['Data'] = aulPropTag request['pPropTags']['aulPropTag'].append(prop) request['pPropTags']['cValues'] = len(pPropTags) request.fields['pPropTags'].fields['Data'].fields['aulPropTag'].fields[ 'MaximumCount'] = len(pPropTags) + 1 elif pPropTagsRaw == NULL: request.fields['pPropTags'] = NULL else: request['pPropTags'] = pPropTagsRaw if len(paStr) > 0: for paStrElem in paStr: value = LPWSTR() value['Data'] = checkNullString(paStrElem) request['paStr']['Strings'].append(value) request['paStr']['Count'] = len(paStr) resp = dce.request(request) return resp
def test_DRSCrackNames(self): dce, rpctransport, hDrs, DsaObjDest = self.connect() request = drsuapi.DRSCrackNames() request['hDrs'] = hDrs request['dwInVersion'] = 1 request['pmsgIn']['tag'] = 1 request['pmsgIn']['V1']['CodePage'] = 0 request['pmsgIn']['V1']['LocaleId'] = 0 request['pmsgIn']['V1']['dwFlags'] = 0 request['pmsgIn']['V1'][ 'formatOffered'] = drsuapi.DS_NT4_ACCOUNT_NAME_SANS_DOMAIN request['pmsgIn']['V1'][ 'formatDesired'] = drsuapi.DS_USER_PRINCIPAL_NAME_FOR_LOGON request['pmsgIn']['V1']['cNames'] = 1 name = LPWSTR() #name['Data'] = 'FREEFLY-DC\x00' #name['Data'] = 'CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=FREEFLY,DC=NET\x00' #name['Data'] = 'CN=FREEFLY-DC,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=FREEFLY,DC=NET\x00' name['Data'] = 'Administrator\x00' request['pmsgIn']['V1']['rpNames'].append(name) resp = dce.request(request) resp.dump()
def hSchRpcRun(dce, path, pArgs=(), flags=0, sessionId=0, user=NULL): schRpcRun = SchRpcRun() schRpcRun['path'] = checkNullString(path) schRpcRun['cArgs'] = len(pArgs) for arg in pArgs: argn = LPWSTR() argn['Data'] = checkNullString(arg) schRpcRun['pArgs'].append(argn) schRpcRun['flags'] = flags schRpcRun['sessionId'] = sessionId schRpcRun['user'] = user return dce.request(schRpcRun)
def hRStartServiceW(dce, hService, argc=0, argv=NULL): startService = RStartServiceW() startService['hService'] = hService startService['argc'] = argc if argc == 0: startService['argv'] = NULL else: for item in argv: itemn = LPWSTR() itemn['Data'] = checkNullString(item) startService['argv'].append(itemn) return dce.request(startService)
def hDRSCrackNames(dce, hDrs, flags, formatOffered, formatDesired, rpNames = ()): request = DRSCrackNames() request['hDrs'] = hDrs request['dwInVersion'] = 1 request['pmsgIn']['tag'] = 1 request['pmsgIn']['V1']['CodePage'] = 0 request['pmsgIn']['V1']['LocaleId'] = 0 request['pmsgIn']['V1']['dwFlags'] = flags request['pmsgIn']['V1']['formatOffered'] = formatOffered request['pmsgIn']['V1']['formatDesired'] = formatDesired request['pmsgIn']['V1']['cNames'] = len(rpNames) for name in rpNames: record = LPWSTR() record['Data'] = checkNullString(name) request['pmsgIn']['V1']['rpNames'].append(record) return dce.request(request)