From c1f63c715fabcf89271534441803fd04d09d9c59 Mon Sep 17 00:00:00 2001 From: iadgovuser29 <33426478+iadgovuser29@users.noreply.github.com> Date: Fri, 12 Apr 2024 15:34:28 -0400 Subject: [PATCH] Refactor interface name --- ...HardwareManifest.cs => HardwareManifestPlugin.cs} | 2 +- ...ardwareManifest.cs => IHardwareManifestPlugin.cs} | 2 +- .../src/HardwareManifestPluginManagerUtils.cs | 12 ++++++------ .../HardwareManifestPluginTests.cs | 9 ++++----- 4 files changed, 12 insertions(+), 13 deletions(-) rename dotnet/HardwareManifestPlugin/HardwareManifestPlugin/src/{HardwareManifest.cs => HardwareManifestPlugin.cs} (91%) rename dotnet/HardwareManifestPlugin/HardwareManifestPlugin/src/{IHardwareManifest.cs => IHardwareManifestPlugin.cs} (97%) diff --git a/dotnet/HardwareManifestPlugin/HardwareManifestPlugin/src/HardwareManifest.cs b/dotnet/HardwareManifestPlugin/HardwareManifestPlugin/src/HardwareManifestPlugin.cs similarity index 91% rename from dotnet/HardwareManifestPlugin/HardwareManifestPlugin/src/HardwareManifest.cs rename to dotnet/HardwareManifestPlugin/HardwareManifestPlugin/src/HardwareManifestPlugin.cs index 7cef540..88b96d0 100644 --- a/dotnet/HardwareManifestPlugin/HardwareManifestPlugin/src/HardwareManifest.cs +++ b/dotnet/HardwareManifestPlugin/HardwareManifestPlugin/src/HardwareManifestPlugin.cs @@ -1,7 +1,7 @@ using HardwareManifestProto; namespace HardwareManifestPlugin { - public abstract class HardwareManifest : IHardwareManifest { + public abstract class HardwareManifestPlugin : IHardwareManifestPlugin { public string Name { get; protected set; diff --git a/dotnet/HardwareManifestPlugin/HardwareManifestPlugin/src/IHardwareManifest.cs b/dotnet/HardwareManifestPlugin/HardwareManifestPlugin/src/IHardwareManifestPlugin.cs similarity index 97% rename from dotnet/HardwareManifestPlugin/HardwareManifestPlugin/src/IHardwareManifest.cs rename to dotnet/HardwareManifestPlugin/HardwareManifestPlugin/src/IHardwareManifestPlugin.cs index 3ec99c8..82f8db1 100644 --- a/dotnet/HardwareManifestPlugin/HardwareManifestPlugin/src/IHardwareManifest.cs +++ b/dotnet/HardwareManifestPlugin/HardwareManifestPlugin/src/IHardwareManifestPlugin.cs @@ -1,7 +1,7 @@ using HardwareManifestProto; namespace HardwareManifestPlugin { - public interface IHardwareManifest { + public interface IHardwareManifestPlugin { string Name { get; } diff --git a/dotnet/HardwareManifestPlugin/HardwareManifestPluginManager/src/HardwareManifestPluginManagerUtils.cs b/dotnet/HardwareManifestPlugin/HardwareManifestPluginManager/src/HardwareManifestPluginManagerUtils.cs index 5991bd9..705a530 100644 --- a/dotnet/HardwareManifestPlugin/HardwareManifestPluginManager/src/HardwareManifestPluginManagerUtils.cs +++ b/dotnet/HardwareManifestPlugin/HardwareManifestPluginManager/src/HardwareManifestPluginManagerUtils.cs @@ -12,13 +12,13 @@ public class HardwareManifestPluginManagerUtils { public static readonly string TrustPath = Path.Combine(Path.GetDirectoryName(Environment.ProcessPath), "trust"); #pragma warning restore CS8604 // Possible null reference argument. - public static List LoadPlugins(List names, bool sbomExpected) { + public static List LoadPlugins(List names, bool sbomExpected) { string[] pluginDlls = System.IO.Directory.GetFiles(PluginsPath, "*.dll"); - List manifests = new(); + List manifests = new(); List> namesWithArgs = new(); foreach(string dllPath in pluginDlls) { Assembly pluginAssembly = LoadAssemblyFromDll(dllPath); - IHardwareManifest? manifest = GatherManifestIfNameSelected(pluginAssembly, names); + IHardwareManifestPlugin? manifest = GatherManifestIfNameSelected(pluginAssembly, names); if (manifest != null) { bool trustManifest = !sbomExpected; if (sbomExpected) { @@ -44,10 +44,10 @@ private static Assembly LoadAssemblyFromDll(string relativePath) { return loadContext.LoadFromAssemblyName(new AssemblyName(Path.GetFileNameWithoutExtension(fullPath))); } - private static IHardwareManifest? GatherManifestIfNameSelected(Assembly assembly, List names) { + private static IHardwareManifestPlugin? GatherManifestIfNameSelected(Assembly assembly, List names) { foreach (Type type in assembly.GetTypes()) { - if (typeof(IHardwareManifest).IsAssignableFrom(type)) { - if (Activator.CreateInstance(type) is IHardwareManifest result && names.Remove(result.Name)) { + if (typeof(IHardwareManifestPlugin).IsAssignableFrom(type)) { + if (Activator.CreateInstance(type) is IHardwareManifestPlugin result && names.Remove(result.Name)) { Log.Debug("Found " + result.Name + "."); return result; } diff --git a/dotnet/HardwareManifestPlugin/HardwareManifestPluginTests/HardwareManifestPluginTests.cs b/dotnet/HardwareManifestPlugin/HardwareManifestPluginTests/HardwareManifestPluginTests.cs index d070642..2147d3e 100644 --- a/dotnet/HardwareManifestPlugin/HardwareManifestPluginTests/HardwareManifestPluginTests.cs +++ b/dotnet/HardwareManifestPlugin/HardwareManifestPluginTests/HardwareManifestPluginTests.cs @@ -3,10 +3,10 @@ namespace HardwareManifestPluginTests { public class HardwareManifestPluginTests { - public static readonly string TEST_STUFF_V2 = + public static readonly string V2ManifestJsonStr = "{\n \n \"PLATFORM\": {\n \"PLATFORMMANUFACTURERSTR\": \"Computer Manufacturer M0\",\"PLATFORMMODEL\": \"Computer Model ABC123Z\",\"PLATFORMVERSION\": \"1.0\",\"PLATFORMSERIAL\": \"Serial N839\"\n },\n \"COMPONENTS\": [\n {\n \"COMPONENTCLASS\": {\n \"COMPONENTCLASSREGISTRY\": \"2.23.133.18.3.1\",\n \"COMPONENTCLASSVALUE\": \"00020001\"\n },\"MANUFACTURER\": \"Computer Manufacturer M0\",\"MODEL\": \"31\",\"SERIAL\": \"Serial N839\",\"REVISION\": \"1.0\"\n },\n {\n \"COMPONENTCLASS\": {\n \"COMPONENTCLASSREGISTRY\": \"2.23.133.18.3.1\",\n \"COMPONENTCLASSVALUE\": \"00030003\"\n },\"MANUFACTURER\": \"Computer Manufacturer M0\",\"MODEL\": \"UP6502ZA\",\"FIELDREPLACEABLE\": \"true\",\"SERIAL\": \"Serial N7M0\",\"REVISION\": \"1.0\"\n },\n {\n \"COMPONENTCLASS\": {\n \"COMPONENTCLASSREGISTRY\": \"2.23.133.18.3.1\",\n \"COMPONENTCLASSVALUE\": \"00130003\"\n },\"MANUFACTURER\": \"Computer Manufacturer AM32\",\"MODEL\": \"Not Specified\",\"REVISION\": \"Rev 2Z.8\"\n },\n {\n \"COMPONENTCLASS\": {\n \"COMPONENTCLASSREGISTRY\": \"2.23.133.18.3.1\",\n \"COMPONENTCLASSVALUE\": \"00010002\"\n },\"MANUFACTURER\": \"Intel(R) Corporation\",\"MODEL\": \"198\",\"FIELDREPLACEABLE\": \"true\",\"SERIAL\": \"To Be Filled By O.E.M.\",\"REVISION\": \"12th Gen Intel(R) Core(TM) i7-12700H\"\n },\n {\n \"COMPONENTCLASS\": {\n \"COMPONENTCLASSREGISTRY\": \"2.23.133.18.3.1\",\n \"COMPONENTCLASSVALUE\": \"00060001\"\n },\"MANUFACTURER\": \"Computer Manufacturer WE2\",\"MODEL\": \"Computer Model K027\",\"FIELDREPLACEABLE\": \"true\",\"SERIAL\": \"00000000\",\"REVISION\": \"9876543210\"\n },\n {\n \"COMPONENTCLASS\": {\n \"COMPONENTCLASSREGISTRY\": \"2.23.133.18.3.1\",\n \"COMPONENTCLASSVALUE\": \"00060001\"\n },\"MANUFACTURER\": \"Computer Manufacturer WE2\",\"MODEL\": \"Computer Model K027\",\"FIELDREPLACEABLE\": \"true\",\"SERIAL\": \"00000000\",\"REVISION\": \"9876543210\"\n },\n {\n \"COMPONENTCLASS\": {\n \"COMPONENTCLASSREGISTRY\": \"2.23.133.18.3.1\",\n \"COMPONENTCLASSVALUE\": \"00060001\"\n },\"MANUFACTURER\": \"Computer Manufacturer WE2\",\"MODEL\": \"Computer Model K027\",\"FIELDREPLACEABLE\": \"true\",\"SERIAL\": \"00000000\",\"REVISION\": \"9876543210\"\n },\n {\n \"COMPONENTCLASS\": {\n \"COMPONENTCLASSREGISTRY\": \"2.23.133.18.3.1\",\n \"COMPONENTCLASSVALUE\": \"00060001\"\n },\"MANUFACTURER\": \"Computer Manufacturer WE2\",\"MODEL\": \"Computer Model K027\",\"FIELDREPLACEABLE\": \"true\",\"SERIAL\": \"00000000\",\"REVISION\": \"9876543210\"\n },\n {\n \"COMPONENTCLASS\": {\n \"COMPONENTCLASSREGISTRY\": \"2.23.133.18.3.1\",\n \"COMPONENTCLASSVALUE\": \"00060001\"\n },\"MANUFACTURER\": \"Computer Manufacturer WE2\",\"MODEL\": \"Computer Model K027\",\"FIELDREPLACEABLE\": \"true\",\"SERIAL\": \"00000000\",\"REVISION\": \"9876543210\"\n },\n {\n \"COMPONENTCLASS\": {\n \"COMPONENTCLASSREGISTRY\": \"2.23.133.18.3.1\",\n \"COMPONENTCLASSVALUE\": \"00060001\"\n },\"MANUFACTURER\": \"Computer Manufacturer WE2\",\"MODEL\": \"Computer Model K027\",\"FIELDREPLACEABLE\": \"true\",\"SERIAL\": \"00000000\",\"REVISION\": \"9876543210\"\n },\n {\n \"COMPONENTCLASS\": {\n \"COMPONENTCLASSREGISTRY\": \"2.23.133.18.3.1\",\n \"COMPONENTCLASSVALUE\": \"00060001\"\n },\"MANUFACTURER\": \"Computer Manufacturer WE2\",\"MODEL\": \"Computer Model K027\",\"FIELDREPLACEABLE\": \"true\",\"SERIAL\": \"00000000\",\"REVISION\": \"9876543210\"\n },\n {\n \"COMPONENTCLASS\": {\n \"COMPONENTCLASSREGISTRY\": \"2.23.133.18.3.1\",\n \"COMPONENTCLASSVALUE\": \"00060001\"\n },\"MANUFACTURER\": \"Computer Manufacturer WE2\",\"MODEL\": \"Computer Model K027\",\"FIELDREPLACEABLE\": \"true\",\"SERIAL\": \"00000000\",\"REVISION\": \"9876543210\"\n },\n {\n \"COMPONENTCLASS\": {\n \"COMPONENTCLASSREGISTRY\": \"2.23.133.18.3.1\",\n \"COMPONENTCLASSVALUE\": \"00090002\"\n },\"MANUFACTURER\": \"8086\",\"MODEL\": \"51F0\",\"FIELDREPLACEABLE\": \"true\",\"SERIAL\": \"Serial 27347E\",\"REVISION\": \"01\", \"ADDRESSES\": [{\n \"WLANMAC\": \"Serial 27347E\" }]\n },\n {\n \"COMPONENTCLASS\": {\n \"COMPONENTCLASSREGISTRY\": \"2.23.133.18.3.1\",\n \"COMPONENTCLASSVALUE\": \"00070002\"\n },\"MANUFACTURER\": \"Not Specified\",\"MODEL\": \"retrieving Valu\",\"FIELDREPLACEABLE\": \"true\"\n },\n {\n \"COMPONENTCLASS\": {\n \"COMPONENTCLASSREGISTRY\": \"2.23.133.18.3.1\",\n \"COMPONENTCLASSVALUE\": \"00050002\"\n },\"MANUFACTURER\": \"8086\",\"MODEL\": \"46A6\",\"FIELDREPLACEABLE\": \"true\",\"REVISION\": \"0C\"\n }\n ],\n \"PROPERTIES\": [\n {\n \"PROPERTYNAME\": \"caption\",\n \"PROPERTYVALUE\": \"Microsoft Windows 11 Pro\"\n }\n,\n {\n \"PROPERTYNAME\": \"caption\",\n \"PROPERTYVALUE\": \"Microsoft Windows 11 Pro\"\n }\n\n ]\n}"; - public static readonly string TEST_STUFF_V3 = + public static readonly string V3ManifestJsonStr = "{ \"platformIdentifier\": { \"typeId\": { \"oid\": \"2.23.133.5.1.8\" }, \"value\": { \"platformManufacturer\": { \"utf8\": { \"traitId\": { \"oid\": \"2.23.133.19.1.18\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.1\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"string\": \"Computer Manufacturer M0\" } } }, \"platformModel\": { \"utf8\": { \"traitId\": { \"oid\": \"2.23.133.19.1.18\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.2\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"string\": \"Computer Model ABC123Z\" } } }, \"platformVersion\": { \"utf8\": { \"traitId\": { \"oid\": \"2.23.133.19.1.18\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.3\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"string\": \"1.0\" } } }, \"platformSerial\": { \"utf8\": { \"traitId\": { \"oid\": \"2.23.133.19.1.18\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.4\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"string\": \"Serial N839\" } } } } }, \"platformConfiguration\": { \"platformComponents\": [ { \"componentIdentifierV11\": { \"traitId\": { \"oid\": \"2.23.133.19.1.5\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.26\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"componentClass\": { \"componentClassRegistry\": { \"oid\": \"2.23.133.18.3.1\" }, \"componentClassValue\": { \"base64\": \"AAIAAQ==\" } }, \"componentManufacturer\": { \"string\": \"Computer Manufacturer M0\" }, \"componentModel\": { \"string\": \"31\" }, \"componentSerial\": { \"string\": \"Serial N839\" }, \"componentRevision\": { \"string\": \"1.0\" } } } }, { \"componentIdentifierV11\": { \"traitId\": { \"oid\": \"2.23.133.19.1.5\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.26\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"componentClass\": { \"componentClassRegistry\": { \"oid\": \"2.23.133.18.3.1\" }, \"componentClassValue\": { \"base64\": \"AAMAAw==\" } }, \"componentManufacturer\": { \"string\": \"Computer Manufacturer M0\" }, \"componentModel\": { \"string\": \"UP6502ZA\" }, \"componentSerial\": { \"string\": \"Serial N7M0\" }, \"componentRevision\": { \"string\": \"1.0\" }, \"fieldReplaceable\": { \"bool\": true } } } }, { \"componentIdentifierV11\": { \"traitId\": { \"oid\": \"2.23.133.19.1.5\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.26\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"componentClass\": { \"componentClassRegistry\": { \"oid\": \"2.23.133.18.3.1\" }, \"componentClassValue\": { \"base64\": \"ABMAAw==\" } }, \"componentManufacturer\": { \"string\": \"Computer Manufacturer AM32\" }, \"componentModel\": { \"string\": \"Not Specified\" }, \"componentRevision\": { \"string\": \"Rev 2Z.8\" } } } }, { \"componentIdentifierV11\": { \"traitId\": { \"oid\": \"2.23.133.19.1.5\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.26\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"componentClass\": { \"componentClassRegistry\": { \"oid\": \"2.23.133.18.3.1\" }, \"componentClassValue\": { \"base64\": \"AAEAAg==\" } }, \"componentManufacturer\": { \"string\": \"Intel(R) Corporation\" }, \"componentModel\": { \"string\": \"198\" }, \"componentSerial\": { \"string\": \"To Be Filled By O.E.M.\" }, \"componentRevision\": { \"string\": \"12th Gen Intel(R) Core(TM) i7-12700H\" }, \"fieldReplaceable\": { \"bool\": true } } } }, { \"componentIdentifierV11\": { \"traitId\": { \"oid\": \"2.23.133.19.1.5\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.26\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"componentClass\": { \"componentClassRegistry\": { \"oid\": \"2.23.133.18.3.1\" }, \"componentClassValue\": { \"base64\": \"AAYAAQ==\" } }, \"componentManufacturer\": { \"string\": \"Computer Manufacturer WE2\" }, \"componentModel\": { \"string\": \"Computer Model K027\" }, \"componentSerial\": { \"string\": \"00000000\" }, \"componentRevision\": { \"string\": \"9876543210\" }, \"fieldReplaceable\": { \"bool\": true } } } }, { \"componentIdentifierV11\": { \"traitId\": { \"oid\": \"2.23.133.19.1.5\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.26\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"componentClass\": { \"componentClassRegistry\": { \"oid\": \"2.23.133.18.3.1\" }, \"componentClassValue\": { \"base64\": \"AAYAAQ==\" } }, \"componentManufacturer\": { \"string\": \"Computer Manufacturer WE2\" }, \"componentModel\": { \"string\": \"Computer Model K027\" }, \"componentSerial\": { \"string\": \"00000000\" }, \"componentRevision\": { \"string\": \"9876543210\" }, \"fieldReplaceable\": { \"bool\": true } } } }, { \"componentIdentifierV11\": { \"traitId\": { \"oid\": \"2.23.133.19.1.5\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.26\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"componentClass\": { \"componentClassRegistry\": { \"oid\": \"2.23.133.18.3.1\" }, \"componentClassValue\": { \"base64\": \"AAYAAQ==\" } }, \"componentManufacturer\": { \"string\": \"Computer Manufacturer WE2\" }, \"componentModel\": { \"string\": \"Computer Model K027\" }, \"componentSerial\": { \"string\": \"00000000\" }, \"componentRevision\": { \"string\": \"9876543210\" }, \"fieldReplaceable\": { \"bool\": true } } } }, { \"componentIdentifierV11\": { \"traitId\": { \"oid\": \"2.23.133.19.1.5\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.26\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"componentClass\": { \"componentClassRegistry\": { \"oid\": \"2.23.133.18.3.1\" }, \"componentClassValue\": { \"base64\": \"AAYAAQ==\" } }, \"componentManufacturer\": { \"string\": \"Computer Manufacturer WE2\" }, \"componentModel\": { \"string\": \"Computer Model K027\" }, \"componentSerial\": { \"string\": \"00000000\" }, \"componentRevision\": { \"string\": \"9876543210\" }, \"fieldReplaceable\": { \"bool\": true } } } }, { \"componentIdentifierV11\": { \"traitId\": { \"oid\": \"2.23.133.19.1.5\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.26\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"componentClass\": { \"componentClassRegistry\": { \"oid\": \"2.23.133.18.3.1\" }, \"componentClassValue\": { \"base64\": \"AAYAAQ==\" } }, \"componentManufacturer\": { \"string\": \"Computer Manufacturer WE2\" }, \"componentModel\": { \"string\": \"Computer Model K027\" }, \"componentSerial\": { \"string\": \"00000000\" }, \"componentRevision\": { \"string\": \"9876543210\" }, \"fieldReplaceable\": { \"bool\": true } } } }, { \"componentIdentifierV11\": { \"traitId\": { \"oid\": \"2.23.133.19.1.5\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.26\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"componentClass\": { \"componentClassRegistry\": { \"oid\": \"2.23.133.18.3.1\" }, \"componentClassValue\": { \"base64\": \"AAYAAQ==\" } }, \"componentManufacturer\": { \"string\": \"Computer Manufacturer WE2\" }, \"componentModel\": { \"string\": \"Computer Model K027\" }, \"componentSerial\": { \"string\": \"00000000\" }, \"componentRevision\": { \"string\": \"9876543210\" }, \"fieldReplaceable\": { \"bool\": true } } } }, { \"componentIdentifierV11\": { \"traitId\": { \"oid\": \"2.23.133.19.1.5\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.26\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"componentClass\": { \"componentClassRegistry\": { \"oid\": \"2.23.133.18.3.1\" }, \"componentClassValue\": { \"base64\": \"AAYAAQ==\" } }, \"componentManufacturer\": { \"string\": \"Computer Manufacturer WE2\" }, \"componentModel\": { \"string\": \"Computer Model K027\" }, \"componentSerial\": { \"string\": \"00000000\" }, \"componentRevision\": { \"string\": \"9876543210\" }, \"fieldReplaceable\": { \"bool\": true } } } }, { \"componentIdentifierV11\": { \"traitId\": { \"oid\": \"2.23.133.19.1.5\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.26\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"componentClass\": { \"componentClassRegistry\": { \"oid\": \"2.23.133.18.3.1\" }, \"componentClassValue\": { \"base64\": \"AAYAAQ==\" } }, \"componentManufacturer\": { \"string\": \"Computer Manufacturer WE2\" }, \"componentModel\": { \"string\": \"Computer Model K027\" }, \"componentSerial\": { \"string\": \"00000000\" }, \"componentRevision\": { \"string\": \"9876543210\" }, \"fieldReplaceable\": { \"bool\": true } } } }, { \"componentIdentifierV11\": { \"traitId\": { \"oid\": \"2.23.133.19.1.5\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.26\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"componentClass\": { \"componentClassRegistry\": { \"oid\": \"2.23.133.18.3.1\" }, \"componentClassValue\": { \"base64\": \"AAkAAg==\" } }, \"componentManufacturer\": { \"string\": \"8086\" }, \"componentModel\": { \"string\": \"51F0\" }, \"componentSerial\": { \"string\": \"Serial 27347E\" }, \"componentRevision\": { \"string\": \"01\" }, \"fieldReplaceable\": { \"bool\": true }, \"componentAddresses\": [ { \"addressType\": { \"oid\": \"2.23.133.17.2\" }, \"addressValue\": { \"string\": \"Serial 27347E\" } } ] } } }, { \"componentIdentifierV11\": { \"traitId\": { \"oid\": \"2.23.133.19.1.5\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.26\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"componentClass\": { \"componentClassRegistry\": { \"oid\": \"2.23.133.18.3.1\" }, \"componentClassValue\": { \"base64\": \"AAcAAg==\" } }, \"componentManufacturer\": { \"string\": \"Not Specified\" }, \"componentModel\": { \"string\": \"retrieving Valu\" }, \"fieldReplaceable\": { \"bool\": true } } } }, { \"componentIdentifierV11\": { \"traitId\": { \"oid\": \"2.23.133.19.1.5\" }, \"traitCategory\": { \"oid\": \"2.23.133.19.2.26\" }, \"traitRegistry\": { \"oid\": \"2.23.133.19.3.1\" }, \"description\": { \"string\": \"paccor component gathering scripts\" }, \"descriptionURI\": { \"string\": \"https://github.com/nsacyber/paccor/scripts\" }, \"traitValue\": { \"componentClass\": { \"componentClassRegistry\": { \"oid\": \"2.23.133.18.3.1\" }, \"componentClassValue\": { \"base64\": \"AAUAAg==\" } }, \"componentManufacturer\": { \"string\": \"8086\" }, \"componentModel\": { \"string\": \"46A6\" }, \"componentRevision\": { \"string\": \"0C\" }, \"fieldReplaceable\": { \"bool\": true } } } } ], \"platformProperties\": [ { \"propertyName\": { \"string\": \"caption\" }, \"propertyValue\": { \"string\": \"Microsoft Windows 11 Pro\" } }, { \"propertyName\": { \"string\": \"caption\" }, \"propertyValue\": { \"string\": \"Microsoft Windows 11 Pro\" } } ] } }"; [Test] @@ -14,10 +14,9 @@ public void TestConvertFromManifestV2() { const string traitDescription = "paccor component gathering scripts"; const string traitDescriptionUri = "https://github.com/nsacyber/paccor/scripts"; var settings = Google.Protobuf.JsonParser.Settings.Default.WithIgnoreUnknownFields(true); - ManifestV2 v2 = new Google.Protobuf.JsonParser(settings).Parse(TEST_STUFF_V2); + ManifestV2 v2 = new Google.Protobuf.JsonParser(settings).Parse(V2ManifestJsonStr); ManifestV3 v3 = HardwareManifestPlugin.Convert.FromManifestV2(v2, traitDescription, traitDescriptionUri); - Assert.That(TEST_STUFF_V3, Is.EqualTo(v3.ToString())); - Console.WriteLine(v3); + Assert.That(V3ManifestJsonStr, Is.EqualTo(v3.ToString())); } } } \ No newline at end of file