private RegistryObject GetRegistryObject() { registry_object ovalRegistryObject = (registry_object)ProbeHelper.GetOvalComponentByOvalID(definitions, "oval:org.mitre.oval:obj:3000"); RegistryObject registry = RegistryObjectFactory.CreateRegistryObject(ovalRegistryObject); return(registry); }
public void Should_be_access_variable_information_from_the_registry_object_by_the_registry_wrapper() { oval_definitions definitions = ProbeHelper.GetFakeOvalDefinitions("definitionsWithConstantVariable.xml"); registry_object ovalRegistryObject = (registry_object)ProbeHelper.GetOvalComponentByOvalID(definitions, "oval:org.mitre.oval:obj:3000"); Assert.IsNotNull(ovalRegistryObject, "the oval registry object is not exists in the fakeDefinitions"); RegistryObject registry = RegistryObjectFactory.CreateRegistryObject(ovalRegistryObject); Assert.AreEqual(registry.Hive, "HKEY_LOCAL_MACHINE", "the hive value is not expected"); Assert.AreEqual(registry.Key, "", "the key value is not expected"); Assert.AreEqual(registry.Name, "CurrentVersion", "the hive value is not expected"); Assert.AreEqual("oval:org.mitre.oval:var:3000", registry.GetVariableId(registry_object_ItemsChoices.key.ToString()), "the variableId from key is not expected"); Assert.AreEqual("", registry.GetVariableId(registry_object_ItemsChoices.name.ToString()), "the variableId from from name is not expected"); }
public void Should_be_access_information_from_the_registry_object_by_the_registry_wrapper() { oval_definitions definitions = ProbeHelper.GetFakeOvalDefinitions("definitionsSimple.xml"); registry_object ovalRegistryObject = (registry_object)ProbeHelper.GetOvalComponentByOvalID(definitions, "oval:org.mitre.oval:obj:4000"); Assert.IsNotNull(ovalRegistryObject, "the oval registry object is not exists in the fakeDefinitions"); RegistryObject registry = RegistryObjectFactory.CreateRegistryObject(ovalRegistryObject); Assert.AreEqual(registry.Hive, "HKEY_LOCAL_MACHINE", "the hive value is not expected"); Assert.AreEqual(registry.Key, @"Software\Microsoft\Windows NT\CSDBuild", "the key value is not expected"); Assert.AreEqual(registry.Name, "^D.*", "the hive value is not expected"); Assert.AreEqual(OperationEnumeration.patternmatch, registry.GetNameOperation(), "the operation from from name is not expected"); Assert.AreEqual(OperationEnumeration.equals, registry.GetKeyOperation(), "the operation from from key is not expected"); }
/// <summary> /// Evaluates all the variables for registry object. /// One registry_object can create multiples RegistryObjects. /// This happen because the variable is defined in the RegistryEntity, and a variable can be have multiples values. /// </summary> /// <param name="registryObject">The registry object.</param> /// <returns></returns> public IEnumerable <RegistryObject> ProcessVariableForRegistryObject(registry_object registryObject) { var registry = RegistryObjectFactory.CreateRegistryObject(registryObject); return(new List <RegistryObject>(this.ProcessVariables(registry))); }