def test_LsarSetInformationPolicy(self): dce, rpctransport, policyHandle = self.connect() request = lsad.LsarQueryInformationPolicy() request['PolicyHandle'] = policyHandle request[ 'InformationClass'] = lsad.POLICY_INFORMATION_CLASS.PolicyAuditEventsInformation resp = dce.request(request) resp.dump() oldValue = resp['PolicyInformation']['PolicyAuditEventsInfo'][ 'AuditingMode'] req = lsad.LsarSetInformationPolicy() req['PolicyHandle'] = policyHandle req['InformationClass'] = request['InformationClass'] req['PolicyInformation'] = resp['PolicyInformation'] req['PolicyInformation']['PolicyAuditEventsInfo']['AuditingMode'] = 0 resp2 = dce.request(req) resp2.dump() resp = dce.request(request) resp.dump() req['PolicyInformation']['PolicyAuditEventsInfo'][ 'AuditingMode'] = oldValue resp2 = dce.request(req) resp2.dump()
def test_LsarQueryInformationPolicy(self): dce, rpctransport = self.connect() policyHandle = self.open_policy(dce) request = lsad.LsarQueryInformationPolicy() request['PolicyHandle'] = policyHandle request[ 'InformationClass'] = lsad.POLICY_INFORMATION_CLASS.PolicyAuditLogInformation resp = dce.request(request) resp.dump() request[ 'InformationClass'] = lsad.POLICY_INFORMATION_CLASS.PolicyAuditEventsInformation resp = dce.request(request) resp.dump() request[ 'InformationClass'] = lsad.POLICY_INFORMATION_CLASS.PolicyPrimaryDomainInformation resp = dce.request(request) resp.dump() request[ 'InformationClass'] = lsad.POLICY_INFORMATION_CLASS.PolicyPdAccountInformation resp = dce.request(request) resp.dump() request[ 'InformationClass'] = lsad.POLICY_INFORMATION_CLASS.PolicyAccountDomainInformation resp = dce.request(request) resp.dump() request[ 'InformationClass'] = lsad.POLICY_INFORMATION_CLASS.PolicyLsaServerRoleInformation resp = dce.request(request) resp.dump() request[ 'InformationClass'] = lsad.POLICY_INFORMATION_CLASS.PolicyReplicaSourceInformation resp = dce.request(request) resp.dump() request[ 'InformationClass'] = lsad.POLICY_INFORMATION_CLASS.PolicyDnsDomainInformation resp = dce.request(request) resp.dump() request[ 'InformationClass'] = lsad.POLICY_INFORMATION_CLASS.PolicyDnsDomainInformationInt resp = dce.request(request) resp.dump() request[ 'InformationClass'] = lsad.POLICY_INFORMATION_CLASS.PolicyLocalAccountDomainInformation resp = dce.request(request) resp.dump()
def test_LsarSetInformationPolicy(self): dce, rpctransport, policyHandle = self.connect() request = lsad.LsarQueryInformationPolicy() request['PolicyHandle'] = policyHandle request[ 'InformationClass'] = lsad.POLICY_INFORMATION_CLASS.PolicyAuditEventsInformation resp = dce.request(request) resp.dump() oldValue = resp['PolicyInformation']['PolicyAuditEventsInfo'][ 'AuditingMode'] req = lsad.LsarSetInformationPolicy() req['PolicyHandle'] = policyHandle req['InformationClass'] = request['InformationClass'] req['PolicyInformation'] = resp['PolicyInformation'] req['PolicyInformation']['PolicyAuditEventsInfo']['AuditingMode'] = 0 resp2 = dce.request(req) resp2.dump() resp = dce.request(request) resp.dump() req['PolicyInformation']['PolicyAuditEventsInfo'][ 'AuditingMode'] = oldValue resp2 = dce.request(req) resp2.dump() ################################################################################ request[ 'InformationClass'] = lsad.POLICY_INFORMATION_CLASS.PolicyPrimaryDomainInformation resp = dce.request(request) resp.dump() oldValue = resp['PolicyInformation']['PolicyPrimaryDomainInfo']['Name'] req = lsad.LsarSetInformationPolicy() req['PolicyHandle'] = policyHandle req['InformationClass'] = request['InformationClass'] req['PolicyInformation'] = resp['PolicyInformation'] req['PolicyInformation']['PolicyPrimaryDomainInfo']['Name'] = 'BETUS' resp2 = dce.request(req) resp2.dump() resp = dce.request(request) resp.dump() self.assertTrue('BETUS' == resp['PolicyInformation'] ['PolicyPrimaryDomainInfo']['Name']) req['PolicyInformation']['PolicyPrimaryDomainInfo']['Name'] = oldValue resp2 = dce.request(req) resp2.dump() ################################################################################ request[ 'InformationClass'] = lsad.POLICY_INFORMATION_CLASS.PolicyAccountDomainInformation resp = dce.request(request) resp.dump() oldValue = resp['PolicyInformation']['PolicyAccountDomainInfo'][ 'DomainName'] req = lsad.LsarSetInformationPolicy() req['PolicyHandle'] = policyHandle req['InformationClass'] = request['InformationClass'] req['PolicyInformation'] = resp['PolicyInformation'] req['PolicyInformation']['PolicyAccountDomainInfo'][ 'DomainName'] = 'BETUS' resp2 = dce.request(req) resp2.dump() resp = dce.request(request) resp.dump() self.assertTrue('BETUS' == resp['PolicyInformation'] ['PolicyAccountDomainInfo']['DomainName']) req['PolicyInformation']['PolicyAccountDomainInfo'][ 'DomainName'] = oldValue resp2 = dce.request(req) resp2.dump()