예제 #1
0
        // Token: 0x0600006A RID: 106 RVA: 0x000033B0 File Offset: 0x000015B0
        public static ICollection <SecurityProduct> GetSecurityProducts(SecurityProductType productType)
        {
            List <SecurityProduct> list  = new List <SecurityProduct>();
            ManagementScope        scope = new ManagementScope(SecurityGatherer.SecurityScope);

            string[] properties = new string[]
            {
                "displayName",
                "pathToSignedProductExe"
            };
            WmiClassCollection wmiClassCollection;

            switch (productType)
            {
            case SecurityProductType.AntiVirus:
                wmiClassCollection = Wmi.Query("AntivirusProduct", properties, scope);
                break;

            case SecurityProductType.AntiSpyware:
                wmiClassCollection = Wmi.Query("AntiSpyWareProduct", properties, scope);
                break;

            case SecurityProductType.Firewall:
                wmiClassCollection = Wmi.Query("FirewallProduct", properties, scope);
                break;

            default:
                wmiClassCollection = null;
                break;
            }
            bool flag = wmiClassCollection == null;
            ICollection <SecurityProduct> result;

            if (flag)
            {
                result = list;
            }
            else
            {
                foreach (WmiClass wmiClass in wmiClassCollection)
                {
                    SecurityProduct item = new SecurityProduct((string)wmiClass["displayName"].Value, (string)wmiClass["pathToSignedProductExe"].Value);
                    list.Add(item);
                }
                result = list;
            }
            return(result);
        }
예제 #2
0
        public static ICollection <SecurityProduct> GetSecurityProducts(SecurityProductType productType)
        {
            List <SecurityProduct> productList = new List <SecurityProduct>();
            ManagementScope        scope       = new ManagementScope(SecurityScope);

            string[] requiredProperties = new string[]
            {
                "displayName",
                "pathToSignedProductExe"
            };

            WmiClassCollection classCollection;

            switch (productType)
            {
            case SecurityProductType.AntiVirus:
                classCollection = Wmi.Query(Wmi.ANTIVIRUS_CLASSNAME, requiredProperties, scope);
                break;

            case SecurityProductType.AntiSpyware:
                classCollection = Wmi.Query(Wmi.ANTISPYWARE_CLASSNAME, requiredProperties, scope);
                break;

            case SecurityProductType.Firewall:
                classCollection = Wmi.Query(Wmi.FIREWALL_CLASSNAME, requiredProperties, scope);
                break;

            default:
                classCollection = null;
                break;
            }

            if (classCollection == null)
            {
                return(productList);
            }

            foreach (WmiClass wmiClass in classCollection)
            {
                SecurityProduct product = new SecurityProduct(
                    (string)wmiClass["displayName"].Value,
                    (string)wmiClass["pathToSignedProductExe"].Value);

                productList.Add(product);
            }

            return(productList);
        }
        public static ICollection <SecurityProduct> GetSecurityProducts(SecurityProductType productType)
        {
            List <SecurityProduct> list  = new List <SecurityProduct>();
            ManagementScope        scope = new ManagementScope(SecurityScope);

            string[] properties = new string[2]
            {
                "displayName",
                "pathToSignedProductExe"
            };
            WmiInstanceClassCollection wmiInstanceClassCollection;

            switch (productType)
            {
            case SecurityProductType.AntiVirus:
                wmiInstanceClassCollection = WmiInstance.Query("AntivirusProduct", properties, scope);
                break;

            case SecurityProductType.AntiSpyware:
                wmiInstanceClassCollection = WmiInstance.Query("AntiSpyWareProduct", properties, scope);
                break;

            case SecurityProductType.Firewall:
                wmiInstanceClassCollection = WmiInstance.Query("FirewallProduct", properties, scope);
                break;

            default:
                wmiInstanceClassCollection = null;
                break;
            }
            if (wmiInstanceClassCollection == null)
            {
                return(list);
            }
            foreach (WmiInstanceClass item2 in wmiInstanceClassCollection)
            {
                SecurityProduct item = new SecurityProduct((string)item2["displayName"].Value, (string)item2["pathToSignedProductExe"].Value);
                list.Add(item);
            }
            return(list);
        }