Example #1
0
 public IEnumerable<CollectedItem> CreateCollectedItemsWithOneErrorItem(
     ItemType itemType, IEnumerable<ProbeLogItem> logItems, string errorMessage)
 {
     itemType.message = MessageType.FromErrorString(errorMessage);
     itemType.status = StatusEnumeration.error;
     return CreateCollectedItems(itemType, logItems);
 }
Example #2
0
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            if (systemItem.status.Equals(StatusEnumeration.notcollected))
            {
                var userToBeCollected = ((user_item)systemItem).user.Value;
                try
                {
                    var collectedUser = this.WindowsAccountProvider.GetUserByName(userToBeCollected);
                    systemItem = new user_item()
                    {
                        status = StatusEnumeration.exists,
                        user = OvalHelper.CreateItemEntityWithStringValue(collectedUser.Name),
                        enabled = OvalHelper.CreateBooleanEntityItemFromBoolValue((bool)collectedUser.Enabled),
                    };

                    var userGroups = this.WindowsAccountProvider.GetUserGroups(userToBeCollected, AccountSearchReturnType.Name);
                    if (userGroups.Count() > 0)
                        ((user_item)systemItem).group = userGroups.Select(grp => new EntityItemStringType() { Value = grp }).ToArray();
                    else
                        ((user_item)systemItem).group = new EntityItemStringType[] { new EntityItemStringType() { status = StatusEnumeration.doesnotexist } };
                }
                catch (WindowsUserNotFound)
                {
                    systemItem.status = StatusEnumeration.doesnotexist;
                    ((user_item)systemItem).user.status = systemItem.status;
                }
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
Example #3
0
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            this.CreateSMFCollectorInstance();

            var smfItem = (smf_item)systemItem;

            try
            {
                var collectedSmf = this.TryToCollectSMF(smfItem.fmri.Value);
                smfItem.service_name = OvalHelper.CreateItemEntityWithStringValue(collectedSmf.ServiceName);
                smfItem.service_state = new EntityItemSmfServiceStateType() { Value = collectedSmf.ServiceState };
                smfItem.protocol = new EntityItemSmfProtocolType() { Value = collectedSmf.Protocol };
                smfItem.server_executable = OvalHelper.CreateItemEntityWithStringValue(collectedSmf.ServerExecutable);
                smfItem.server_arguements = OvalHelper.CreateItemEntityWithStringValue(collectedSmf.ServerArgs);
                smfItem.exec_as_user = OvalHelper.CreateItemEntityWithStringValue(collectedSmf.ExecAsUser);
            }
            catch (NoSMFDataException)
            {
                ExecutionLogBuilder.AddInfo("An error occurred while trying to collect smf_object");
                smfItem.status = StatusEnumeration.error;
                smfItem.message = MessageType.FromErrorString("The fmri format is invalid.");
                smfItem.fmri.status = StatusEnumeration.error;
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(smfItem, BuildExecutionLog());
        }
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            var filePath = string.Empty;
            try
            {
                var fileContentItem = (textfilecontent_item)systemItem;
                filePath = Path.Combine(fileContentItem.path.Value, fileContentItem.filename.Value);
                var interimList = WinNetUtils.getWinTextFileContent(hostUNC, filePath, fileContentItem.line.Value);

                var collectedItems = new List<CollectedItem>();
                foreach (FileContentItemSystemData srcItem in interimList)
                {
                    var destItem = new textfilecontent_item();
                    this.BuilderFileContentItem(destItem, srcItem, fileContentItem);
                    var newCollectedItem = new CollectedItem() { ItemType = destItem, ExecutionLog = BuildExecutionLog() };
                    collectedItems.Add(newCollectedItem);
                }

                return collectedItems;
            }
            catch (FileNotFoundException)
            {
                base.SetDoesNotExistStatusForItemType(systemItem, filePath);
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            var registryItem = (registry_item)systemItem;
            var fullKeyPath = Path.Combine(registryItem.hive.Value, registryItem.key.Value, registryItem.name.Value);
            var itemBuilder = new RegistryItemTypeBuilder(registryItem);
            
            try
            {
                base.ExecutionLogBuilder.CollectingDataFrom(fullKeyPath);
                if (this.IsAllEntitiesIsSet(systemItem))
                {
                    var collectedSystemData = this.collectSystemDataForRegistryItem(registryItem);
                    itemBuilder.FillItemTypeWithData(collectedSystemData);
                }
            }
            catch (RegistryKeyNotFoundException)
            {
                base.ExecutionLogBuilder.Warning(string.Format("The registry key {0} is not found ", registryItem.key.Value));
                itemBuilder.SetRegistryKeyStatus(StatusEnumeration.doesnotexist);
                itemBuilder.SetItemTypeStatus(StatusEnumeration.doesnotexist, null);
                itemBuilder.ClearRegistryName();
            }
            catch (RegistryNameNotFoundException)
            {
                base.ExecutionLogBuilder.Warning(string.Format("The registry name {0} is not found ", registryItem.name.Value));
                itemBuilder.SetRegistryNameStatus(StatusEnumeration.doesnotexist);
                itemBuilder.SetItemTypeStatus(StatusEnumeration.doesnotexist, null);
            }

            itemBuilder.BuildItemType();
            itemBuilder.ClearEntitiesWithEmptyValueIfStatusDoesNotExists();
            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(itemBuilder.BuiltItemType, BuildExecutionLog());
        }
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            if (systemItem.status.Equals(StatusEnumeration.notcollected))
            {
                var userSIDItem = ((user_sid_item)systemItem);
                try
                {
                    var allUsers = this.WindowsAccountProvider.GetAllGroupByUsers();
                    var userSidValue = userSIDItem.user_sid.Value;
                    
                    var collectedUserItem = allUsers.Where(user => user.AccountSID.Equals(userSidValue)).FirstOrDefault();
                    if (collectedUserItem == null)
                        throw new UserSIDNotFoundException(userSidValue);

                    systemItem.status = StatusEnumeration.exists;
                    userSIDItem.enabled = OvalHelper.CreateBooleanEntityItemFromBoolValue((bool)collectedUserItem.Enabled);
                    userSIDItem.group_sid = new EntityItemStringType[] { new EntityItemStringType() { status = StatusEnumeration.doesnotexist } };
                    if ((collectedUserItem.Members != null) && (collectedUserItem.Members.Count() > 0))
                        userSIDItem.group_sid =
                            collectedUserItem.Members.Select(grp => OvalHelper.CreateItemEntityWithStringValue(grp.AccountSID)).ToArray();
                }
                catch (UserSIDNotFoundException)
                {
                    SetDoesNotExistStatusForItemType(systemItem, userSIDItem.user_sid.Value);
                    ((user_sid_item)systemItem).user_sid.status = StatusEnumeration.doesnotexist;
                }
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
 protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
 {
     var xmlFilepath = string.Empty;
     var xmlFileContentItem = (xmlfilecontent_item)systemItem;
     
     try
     {
         xmlFilepath = this.GetCompleteFilepath(xmlFileContentItem);
         if (string.IsNullOrWhiteSpace(xmlFilepath))
             throw new XPathNoResultException();
         var xPathResult = this.XPathOperator.Apply(xmlFilepath, xmlFileContentItem.xpath.Value);
         this.ConfigureXmlFileContentItem(xmlFileContentItem, xPathResult);
     }
     catch (FileNotFoundException)
     {
         var completeFilepath = this.GetCompleteFilepath((xmlfilecontent_item)xmlFileContentItem);
         base.SetDoesNotExistStatusForItemType(systemItem, completeFilepath);
     }
     catch (XPathNoResultException)
     {
         var xpath = string.Format("xpath: '{0}'", xmlFileContentItem.xpath.Value);
         base.SetDoesNotExistStatusForItemType(systemItem, xpath);
     }
     
     return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
 }
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            var filepath   = string.Empty;
            var trusteeSID = string.Empty;

            try
            {
                filepath = ((fileauditedpermissions_item)systemItem).filepath.Value;
                trusteeSID = ((fileauditedpermissions_item)systemItem).trustee_sid.Value;
                base.ExecutionLogBuilder.AddInfo(string.Format(TRYING_TO_COLLECT_AUDITED_PERMISSIONS_LOG, trusteeSID, filepath));

                CreateFileAuditedPermissions53ItemType((fileauditedpermissions_item)systemItem, filepath, trusteeSID);
                var SACLs = this.CollectSecurityDescriptorForFileAndUser(filepath, trusteeSID);
                MapSACLsToFileAuditedPermissionsItem((fileauditedpermissions_item)systemItem, SACLs);
            }
            catch (InvalidInvokeMethodException)
            {
                base.SetDoesNotExistStatusForItemType(systemItem, filepath);
                this.SetAllAuditEntitiesItemToNULL((fileauditedpermissions_item)systemItem);
            }
            catch (ACLNotFoundException)
            {
                base.SetDoesNotExistStatusForItemType(systemItem, trusteeSID);
            }
            catch (Exception ex)
            {
                this.SetAllAuditEntitiesItemToEMPTY((fileauditedpermissions_item)systemItem);
                throw ex;
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
Example #9
0
 public RunLevelProberTests()
 {
     FakeItemToCollect1 = CreateFakeRunlevelItem("ssh", "2", null, null);
     FakeItemToCollect2 = CreateFakeRunlevelItem("cups", "3", null, null);
     FakeCollectedItem1 = ProbeHelper.CreateFakeCollectedItem(CreateFakeRunlevelItem("ssh", "2", "0", "1"));
     FakeCollectedItem2 = ProbeHelper.CreateFakeCollectedItem(CreateFakeRunlevelItem("cups", "3", "1", "0"));
 }
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            var metabaseItem = (metabase_item)systemItem;

            try
            {
                if (string.IsNullOrWhiteSpace(MetabaseFileContent) || string.IsNullOrWhiteSpace(MetabaseSchemaContent))
                    throw new Exception(METABASE_CONTENT_NOT_FOUND_MSG);
                
                var metabaseSession = GetMetabaseProperty(metabaseItem.key.Value, metabaseItem.id1.Value);
                metabaseItem.data = CreateMetabaseEntityItemFromMetabaseDataProperty(metabaseSession.Value);
                
                if ((metabaseItem.data.Length == 1) && (metabaseItem.data[0].status == StatusEnumeration.doesnotexist))
                {
                    metabaseItem.status = StatusEnumeration.doesnotexist;
                    metabaseItem.id1.status = StatusEnumeration.doesnotexist;
                    metabaseItem.name = null;
                    metabaseItem.data_type = null;
                    metabaseItem.user_type = null;
                }
                else
                {
                    metabaseItem.name = CreateMetabaseEntityFromMetabaseProperty(metabaseSession.Name);
                    metabaseItem.data_type = CreateMetabaseEntityFromMetabaseProperty(metabaseSession.Type);
                    metabaseItem.user_type = CreateMetabaseEntityFromMetabaseProperty(metabaseSession.UserType);
                }
            }
            catch (MetabaseItemNotFoundException)
            {
                metabaseItem.status = StatusEnumeration.doesnotexist;
                metabaseItem.key.status = metabaseItem.status;
            }   
         
            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            base.ExecutionLogBuilder.CollectingDataFrom(TargetHostName);
            var collectedPasswordPolicies = PasswordPolicyHelper.getUserModalsInfo0(TargetHostName);
            this.MapPasswrodPolicyToPasswordPolicyItemType((passwordpolicy_item)systemItem, collectedPasswordPolicies);

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, base.BuildExecutionLog());
        }
Example #12
0
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            this.CreateWmiDataProviderFromWmiItem((wmi_item)systemItem);
            var wmiResult = this.WmiDataProvider.ExecuteWQL(((wmi_item)systemItem).wql.Value);
            ((wmi_item)systemItem).result = this.ConvertWmiResultToEntityItemList(wmiResult);

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
Example #13
0
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            base.ExecutionLogBuilder.CollectingDataFrom("Family Object");

            var collectedFamily = this.FamilyCollector.GetOperatingSystemFamily();
            ((family_item)systemItem).family = new EntityItemFamilyType() { Value = collectedFamily };

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            var commandOutput = UnameCollector.RunUnameCommand();

            UnixTerminalParser
                .MapUnameCommandOutputToUnameItem((uname_item)systemItem, commandOutput);

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
Example #15
0
 public static void AssertItemTypeWithErrorStatus(ItemType itemToAssert, string expectedChunkOfMessageTypeValue)
 {
     Assert.AreEqual(StatusEnumeration.error, itemToAssert.status, "Unexpected item status was found.");
     if (!string.IsNullOrEmpty(expectedChunkOfMessageTypeValue))
     {
         Assert.IsNotNull(itemToAssert.message, "The message type was not created.");
         Assert.IsTrue(itemToAssert.message.First().Value.Contains(expectedChunkOfMessageTypeValue));
     }
 }
Example #16
0
 public static void AssertItemsWithExistsStatus(ItemType[] itemsToAssert, int expectedItemCount, Type expectedTypeInstanceOfItems)
 {
     Assert.AreEqual(expectedItemCount, itemsToAssert.Count(), "Unexpected system data items count was found.");
     foreach (var itemType in itemsToAssert) 
     {
         Assert.IsInstanceOfType(itemType, expectedTypeInstanceOfItems, "An item with unexpected instance type was found.");
         Assert.AreEqual(StatusEnumeration.exists, itemType.status, "An item with unexpected status was found.");
     }
 }
Example #17
0
        public RpmInfoProberTests()
        {
            FakeItemToCollect1 = CreateFakeRpmInfoItem("vbox", null, null, null, null, null);
            FakeItemToCollect2 = CreateFakeRpmInfoItem("firefox", null, null, null, null, null);

            var fakeCollectedItem1 = CreateFakeRpmInfoItem("vbox", "x86", "2010", "1020", "12345678", "1");
            FakeCollectedItem1 = ProbeHelper.CreateFakeCollectedItem(fakeCollectedItem1);
            var fakeCollectedItem2 = CreateFakeRpmInfoItem("firefox", "x86", "2010", "1020", "12345678", "1");
            FakeCollectedItem2 = ProbeHelper.CreateFakeCollectedItem(fakeCollectedItem2);
        }
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            base.ExecutionLogBuilder.CollectingDataFrom(TargetHostName);
            var securityPrincipleEntity = ((accesstoken_item)systemItem).security_principle;
            
            var collectedAccessToken = this.AccessTokenProvider.GetAccessTokens(this.TargetHostName, securityPrincipleEntity.Value);
            new AccessTokenItemTypeBuilder().FillItemTypeWithData((accesstoken_item)systemItem, collectedAccessToken);

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
Example #19
0
        protected void SetDoesNotExistStatusForItemType(ItemType systemItem, string itemIdentifier)
        {
            systemItem.status = StatusEnumeration.doesnotexist;

            if (!string.IsNullOrEmpty(itemIdentifier))
            {
                var messageToLog = string.Format(ITEM_NOT_FOUND_LOG_MESSAGE, ObjectCollectorName, itemIdentifier);
                this.ExecutionLogBuilder.AddInfo(messageToLog);
            }
        }
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            CreateAuditEventPolicyHelper();
            var itemTypeBuilder = new AuditEventPolicyItemTypeBuilder(systemItem);

            var auditEventPolicies = this.AuditEventPolicyHelper.GetAuditEventPolicies(this.TargetInfo);
            itemTypeBuilder.FillItemTypeWithData(auditEventPolicies);
            itemTypeBuilder.SetItemTypeStatus(StatusEnumeration.exists, null);

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(itemTypeBuilder.BuiltItemType, BuildExecutionLog());
        }
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            if (this.AuditEventPolicyHelper == null)
                this.AuditEventPolicyHelper = new AuditEventPolicyHelper(this.TargetInfo);

            var auditEventPolicySubcategories = this.AuditEventPolicyHelper.GetAuditEventSubcategoriesPolicy(this.TargetInfo);

            this.MapAuditEventSubcategoriesDictionaryToItemType(auditEventPolicySubcategories, (auditeventpolicysubcategories_item)systemItem);

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
Example #22
0
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            try
            {
                string trusteeSID = ((sid_sid_item)systemItem).trustee_sid.Value;
                base.ExecutionLogBuilder.CollectingDataFrom(trusteeSID);
                this.collectSidItemSystemData((sid_sid_item)systemItem);
            }
            catch (KeyNotFoundException)
            {
                SetTrusteeSIDEntityStatus((sid_sid_item)systemItem, StatusEnumeration.doesnotexist);
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
Example #23
0
        public void Should_be_possible_to_collect_file_object_for_unix_systems()
        {
            var fakeFileItemsToReturn = new ItemType[] { new unix.file_item() { filepath = OvalHelper.CreateItemEntityWithStringValue("/home/usr/readme") } };
            var fakeCollectedItemsToReturn = new CollectedItem[] { ProbeHelper.CreateFakeCollectedItem(CreateFileItem()) };
            var unixFileProber = new FileProber();
            ProberBehaviorCreator
                .CreateBehaviorForNormalFlowExecution(
                    unixFileProber,
                    fakeFileItemsToReturn,
                    fakeCollectedItemsToReturn);

            var result = unixFileProber.Execute(FakeContext, FakeTargetInfo, GetFakeCollectInfo("oval:modulo:obj:2", "definitions_all_unix"));

            DoAssertForSingleCollectedObject(result, typeof(unix.file_item));
        }
Example #24
0
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            var lineSubCommand = ((line_item)systemItem).show_subcommand.Value;
            try
            {
                var commandOutput = TelnetConnection.CiscoCommand(lineSubCommand);
                ((line_item)systemItem).config_line = OvalHelper.CreateItemEntityWithStringValue(commandOutput);
            }
            catch (NoCommandOutputException)
            {
                systemItem.status = StatusEnumeration.doesnotexist;
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
Example #25
0
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            var wmiItemType = ((wmi57_item)systemItem);
            var wmiDataProvider = this.GetWmiDataProvider([email protected]);
            var wmiResult = wmiDataProvider.ExecuteWQL(wmiItemType.wql.Value);

            if (wmiResult.Count() == 0)
            {
                wmiItemType.status = StatusEnumeration.doesnotexist;
                wmiItemType.result = new[] { new EntityItemRecordType() { status = StatusEnumeration.doesnotexist } };
            }
            else
                this.ConfigureWmiItemResult(wmiItemType, wmiResult);

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(wmiItemType, BuildExecutionLog());
        }
Example #26
0
 public virtual IEnumerable<CollectedItem> CollectDataForSystemItem(ItemType systemItem)
 {
     try
     {
         if (systemItem.status.Equals(StatusEnumeration.exists) || systemItem.status.Equals(StatusEnumeration.notcollected))
             return this.collectDataForSystemItem(systemItem);
         else
             return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
     }
     catch (Exception ex)
     {
         AddAWarningMessageInExecutionLog(ex.Message);
         ConfigureItemTypeAsErrorItem(systemItem, ex.Message);
         return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
     }
 }
Example #27
0
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            string trusteeName = string.Empty;
            try
            {
                trusteeName = ((sid_item)systemItem).trustee_name.Value;
                base.ExecutionLogBuilder.CollectingDataFrom(trusteeName);
                this.CollectSidItemSystemData((sid_item)systemItem);
            }
            catch (KeyNotFoundException)
            {
                base.SetDoesNotExistStatusForItemType(systemItem, trusteeName);
                this.SetTrusteeNameEntityStatus((sid_item)systemItem, StatusEnumeration.doesnotexist);
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            this.CreateEnvironmentVariablesCollectorInstance();

            var environmentVariableItem = (environmentvariable_item)systemItem;
            try
            {
                var collectedVariableValue = this.TryToCollectEnvironmentVariable(environmentVariableItem.name.Value);
                environmentVariableItem.value = OvalHelper.CreateEntityItemAnyTypeWithValue(collectedVariableValue);
            }
            catch (EnvironmentVariableNotExistsException)
            {
                base.SetDoesNotExistStatusForItemType(systemItem, environmentVariableItem.name.Value);
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
Example #29
0
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            var groupItem = (group_item)systemItem;
            var groupName = groupItem.group.Value;
            
            try
            {
                base.ExecutionLogBuilder.CollectingDataFrom(groupName);
                this.CollectGroupItemSystemData(groupItem);
            }
            catch (KeyNotFoundException)
            {
                base.SetDoesNotExistStatusForItemType(groupItem, groupName);
                this.SetGroupEntityStatus(groupItem.group, StatusEnumeration.doesnotexist);
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(groupItem, BuildExecutionLog());
        }
        protected override IEnumerable<CollectedItem> collectDataForSystemItem(ItemType systemItem)
        {
            this.CheckGroupProviderInstance();
            var groupSIDToCollect = string.Empty;
            try
            {
                groupSIDToCollect = ((group_sid_item)systemItem).group_sid.Value;
                var windowsGroupAccount = this.WindowsGroupProvider.CollectWindowsGroupAccountInfoBySID(groupSIDToCollect);

                this.FillItemTypeWithData((group_sid_item)systemItem, windowsGroupAccount);
            }
            catch (GroupSIDNotFoundException)
            {
                SetDoesNotExistStatusForItemType(systemItem, groupSIDToCollect);
            }

            return new ItemTypeHelper().CreateCollectedItemsWithOneItem(systemItem, BuildExecutionLog());
        }
Example #31
0
 private void assertCollectedItemStatus(SystemCharacteristics.ReferenceType objectReference, SystemCharacteristics.ItemType collectedItem)
 {
     Assert.IsInstanceOfType(collectedItem, typeof(fileeffectiverights_item), "The generated ItemType must be a instance of fileeffectiverights_item class.");
     Assert.AreEqual(objectReference.item_ref, collectedItem.id, "The generated ItemType ID must be equal to collected object ID.");
     Assert.AreEqual(StatusEnumeration.exists, collectedItem.status, "A generated ItemType with unexpected OVAL Status was found.");
 }
Example #32
0
        private void assertFileEffectiveRightsInitialEntities(Definitions.ObjectType sourceObject, SystemCharacteristics.ItemType collectedItem)
        {
            fileeffectiverights_item collectedFileEffectiveRightsItem = (fileeffectiverights_item)collectedItem;

            var allExpectedEntities = OvalHelper.GetFileEffectiveRightsFromObjectType((fileeffectiverights_object)sourceObject);

            string expectedPath        = allExpectedEntities[fileeffectiverights_object_ItemsChoices.path.ToString()].Value;
            string expectedFileName    = allExpectedEntities[fileeffectiverights_object_ItemsChoices.filename.ToString()].Value;
            string expectedTrusteeName = allExpectedEntities[fileeffectiverights_object_ItemsChoices.trustee_name.ToString()].Value;

            Assert.AreEqual(expectedPath, collectedFileEffectiveRightsItem.path.Value, string.Format(MSG_UNEXPECTED_COLLECTED_ITEM_VALUE, "path"));
            Assert.AreEqual(expectedFileName, collectedFileEffectiveRightsItem.filename.Value, string.Format(MSG_UNEXPECTED_COLLECTED_ITEM_VALUE, "filename"));
            Assert.AreEqual(expectedTrusteeName, collectedFileEffectiveRightsItem.trustee_name.Value, string.Format(MSG_UNEXPECTED_COLLECTED_ITEM_VALUE, "trustee_name"));
        }