示例#1
0
    def test_DRSVerifyNames(self):
        dce, rpctransport, hDrs, DsaObjDest = self.connect()
        request = drsuapi.DRSVerifyNames()

        request['hDrs'] = hDrs
        request['dwInVersion'] = 1

        request['pmsgIn']['tag'] = 1
        request['pmsgIn']['V1']['dwFlags'] = drsuapi.DRS_VERIFY_DSNAMES
        request['pmsgIn']['V1']['cNames'] = 1
        request['pmsgIn']['V1']['PrefixTable']['pPrefixEntry'] = NULL

        dsName = drsuapi.PDSNAME()
        dsName['SidLen'] = 0
        dsName['Guid'] = drsuapi.NULLGUID
        dsName['Sid'] = ''
        name = 'DC=%s,DC=%s' % (self.domain.split('.')[0],
                                self.domain.split('.')[1])

        dsName['NameLen'] = len(name)
        dsName['StringName'] = (name + '\x00')
        dsName['structLen'] = len(dsName.getDataReferent()) - 4

        request['pmsgIn']['V1']['rpNames'].append(dsName)

        resp = dce.request(request)
        resp.dump()
示例#2
0
    def aaaa_DRSVerifyNames(self):
        # Not Yet working
        dce, rpctransport, hDrs = self.connect()

        name = 'CN=Administrator,CN=Users,DC=FREEFLY,DC=NET'
        formatOffered = drsuapi.DS_NT4_ACCOUNT_NAME_SANS_DOMAIN_EX
        formatDesired = drsuapi.DS_USER_PRINCIPAL_NAME_FOR_LOGON
        resp = drsuapi.hDRSCrackNames(dce, hDrs, 0, formatOffered, formatDesired, (name,))
        resp.dump()

        request = drsuapi.DRSVerifyNames()
        request['hDrs'] = hDrs
        request['dwInVersion'] = 1

        request['pmsgIn']['tag'] = 1
        request['pmsgIn']['V1']['dwFlags'] = drsuapi.DRS_VERIFY_SAM_ACCOUNT_NAMES
        request['pmsgIn']['V1']['cNames'] = 1
        #pDsName = drsuapi.PDSNAME()
        dsName = drsuapi.DSNAME()
        dsName['SidLen'] = 0
        dsName['Guid'] = drsuapi.NULLGUID
        dsName['Sid'] = ''
        dsName['NameLen'] = len(name)
        dsName['StringName'] = name + '\x00'
        dsName['structLen'] = len(dsName.getData())
        request['pmsgIn']['V1']['rpNames'].append(dsName)
        request['pmsgIn']['V1']['RequiredAttrs']['pAttr'] = NULL
        #request['pmsgIn']['V1']['RequiredAttrs']['attrCount'] = 3

        #attr = drsuapi.ATTR()
        #attr[''] =
        #attr[''] =
        #attr[''] =
        #request['pmsgIn']['V1']['RequiredAttrs']['pAttr'].append(attr)

        request['pmsgIn']['V1']['PrefixTable']['pPrefixEntry'] = NULL

        request.dump()
        resp = dce.request(request)
        resp.dump()