Esempio n. 1
0
        public static List <BrowserExtension> GetIEPlugins()
        {
            List <BrowserExtension> extensions = new List <BrowserExtension>();

            string      machineLevelAddOns = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects";
            RegistryKey key  = Registry.LocalMachine.OpenSubKey(machineLevelAddOns);
            var         list = key.GetSubKeyNames();

            foreach (string keyValue in list)
            {
                RegistryKey      childKey  = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Classes\\CLSID\\" + keyValue + "\\InprocServer32");
                var              path      = childKey.GetValue("");
                BrowserExtension extension = new BrowserExtension();

                extension.FilePath = path.ToString();
                extension.Key      = "Helper";



                string publisher = string.Empty;
                ///////////////////////////////////////////////////
                string      registryKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
                RegistryKey programKey  = Registry.LocalMachine.OpenSubKey(registryKey);
                if (key != null)
                {
                    foreach (RegistryKey subkey in programKey.GetSubKeyNames().Select(keyName => programKey.OpenSubKey(keyName)))
                    {
                        if (subkey.GetValue("DisplayName") as string == keyValue)
                        {
                            publisher = subkey.GetValue("Publisher") as string;
                        }
                    }
                    childKey.Close();
                }

                programKey.Close();

                extensions.Add(extension);

                ///////////////////////////////////////////////////
            }
            key.Close();
            return(extensions);
        }
Esempio n. 2
0
        public static List <BrowserExtension> GetChromePlugins()
        {
            List <BrowserExtension> list = new List <BrowserExtension>();
            string extensionsPath        = string.Empty;

            var path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            path += @"\Google\Chrome\User Data\Default\Extensions\";

            var dirs = Directory.GetDirectories(path, "*.*", SearchOption.TopDirectoryOnly);

            foreach (string dir in dirs)
            {
                BrowserExtension extension = new BrowserExtension();
                DirectoryInfo    dirInfo   = new DirectoryInfo(dir);
                var versionDirectory       = dirInfo.GetDirectories().ToList().ElementAt(0);

                var jsonFilePath = versionDirectory.FullName + "\\_locales\\en_US\\messages.json";

                if (new FileInfo(jsonFilePath).Exists)
                {
                    var file = File.ReadAllText(jsonFilePath);

                    dynamic parsed = JsonConvert.DeserializeObject <dynamic>(file);

                    try
                    {
                        string appName = ((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)((Newtonsoft.Json.Linq.JContainer)parsed.appName).Last).Value).Value.ToString();

                        extension.Program  = appName;
                        extension.FilePath = versionDirectory.FullName;
                        extension.Key      = "Extension";
                        list.Add(extension);
                    }
                    catch (Exception ex)
                    {
                        ;
                    }
                }
            }

            return(list);
        }
Esempio n. 3
0
        public static List <BrowserExtension> GetFirefoxExtensions()
        {
            List <BrowserExtension> list = new List <BrowserExtension>();
            string extensionsPath        = string.Empty;

            var path = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);

            path += @"\Mozilla Firefox\browser\features\";

            var files = Directory.GetFiles(path, "*.xpi", SearchOption.TopDirectoryOnly);

            BrowserExtension extension = new BrowserExtension();

            foreach (string file in files.ToList())
            {
                if (new FileInfo(file).Exists)
                {
                    var fileContent = File.ReadAllText(file);



                    try
                    {
                        //dynamic parsed = JsonConvert.DeserializeObject<dynamic>(fileContent);
                        //string appName = ((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)((Newtonsoft.Json.Linq.JContainer)parsed.appName).Last).Value).Value.ToString();

                        extension.Program  = Path.GetFileName(file);
                        extension.FilePath = file;
                        extension.Key      = "Extension";
                        list.Add(extension);
                    }
                    catch (Exception ex)
                    {
                        ;
                    }
                }
            }

            return(list);
        }