示例#1
0
        /// <summary>
        /// Gets the ie history.
        /// </summary>
        /// <returns>get list of ie histroy</returns>
        public static List <BrowserHistory_Node> OnGetIEHistory()
        {
            List <BrowserHistory_Node> URLs = new List <BrowserHistory_Node>();

            UrlHistoryWrapperClass.STATURLEnumerator enumerator;
            UrlHistoryWrapperClass urlHistory;

            urlHistory = new UrlHistoryWrapperClass();
            enumerator = urlHistory.GetEnumerator();


            while (enumerator.MoveNext())
            {
                BrowserHistory_Node HistoryNode = new BrowserHistory_Node();
                if (enumerator.Current.URL != null)
                {
                    HistoryNode.url = enumerator.Current.URL.ToString();
                }
                if (enumerator.Current.Title != null)
                {
                    HistoryNode.title = enumerator.Current.Title.ToString();
                }
                HistoryNode.create    = FILETIMEToLong(enumerator.Current.ftLastUpdated);
                HistoryNode.lastvisit = FILETIMEToLong(enumerator.Current.ftLastVisited);
                URLs.Add(HistoryNode);
            }
            enumerator.Reset();


            return(URLs);
        }
示例#2
0
        /// <summary>
        /// Gets the opera history.
        /// </summary>
        /// <returns>get list of opera histroy</returns>
        public static List <BrowserHistory_Node> OnGetOperaHistory()
        {
            List <BrowserHistory_Node> URLs = new List <BrowserHistory_Node>();
            string HistoryPath = GetOperaProfilePaths();

            HistoryPath += "\\History";
            SQLiteConnection conn = new SQLiteConnection(@"Data Source=" + HistoryPath);

            conn.Open();
            SQLiteCommand cmd = new SQLiteCommand();

            cmd.Connection  = conn;
            cmd.CommandText = "Select * From urls";
            SQLiteDataReader row = cmd.ExecuteReader();

            while (row.Read())
            {
                BrowserHistory_Node historynode = new BrowserHistory_Node();
                string last_visit_time          = row["last_visit_time"].ToString();

                historynode.lastvisit = BrowserHistory_Node.FromUnixTime(long.Parse(last_visit_time));

                // Obtain URL and Title strings


                historynode.url   = row["Url"].ToString();
                historynode.title = row["title"].ToString();
                URLs.Add(historynode);
            }

            return(URLs);
        }
示例#3
0
        /// <summary>
        /// Gets the firefox bookmarks.
        /// </summary>
        /// <returns>get the list of firefox bookmark</returns>
        public static List <BrowserHistory_Node> OnGetFirefoxBookmarks()
        {
            List <BrowserHistory_Node> URLs = new List <BrowserHistory_Node>();
            List <string> Profiles          = GetFirefoxProfilePaths();

            foreach (string profile in Profiles)
            {
                SQLiteConnection sqlite_connection = new SQLiteConnection("Data Source=" + profile + "\\places.sqlite" + ";Version=3;");

                SQLiteCommand sqlite_command = sqlite_connection.CreateCommand();

                sqlite_connection.Open();

                sqlite_command.CommandText = "SELECT moz_bookmarks.id,moz_bookmarks.dateAdded,moz_bookmarks.lastModified ,moz_bookmarks.title,moz_places.url FROM moz_bookmarks LEFT JOIN moz_places WHERE moz_bookmarks.fk = moz_places.id AND moz_bookmarks.title != 'null'";

                SQLiteDataReader sqlite_datareader = sqlite_command.ExecuteReader();

                while (sqlite_datareader.Read())
                {
                    BrowserHistory_Node bookmarknode = new BrowserHistory_Node();
                    DateTime            dateAdded    = BrowserHistory_Node.FromUnixTime(long.Parse(sqlite_datareader["dateAdded"].ToString()));
                    DateTime            lastModified = BrowserHistory_Node.FromUnixTime(long.Parse(sqlite_datareader["lastModified"].ToString()));
                    string title = sqlite_datareader["title"].ToString();
                    string url   = sqlite_datareader["Url"].ToString();
                    bookmarknode.create    = dateAdded;
                    bookmarknode.lastvisit = lastModified;
                    bookmarknode.title     = title;
                    bookmarknode.url       = url;
                    URLs.Add(bookmarknode);
                }
                sqlite_connection.Close();
            }
            return(URLs);
        }
示例#4
0
        /// <summary>
        /// Gets the firefox cookies.
        /// </summary>
        /// <returns>get the list of firefox cookies</returns>
        public static List <BrowserCookie_Node> OnGetFirefoxCookies()
        {
            List <string>             Profiles = GetFirefoxProfilePaths();
            List <BrowserCookie_Node> Cookies  = new List <BrowserCookie_Node>();

            foreach (string profile in Profiles)
            {
                string strPath, strTemp, strDb;
                strTemp = string.Empty;

                // Check to see if FireFox Installed
                strPath = profile + "\\cookies.sqlite";
                if (string.Empty == strPath) // Nope, perhaps another browser
                {
                    return(Cookies);
                }
                // First copy the cookie jar so that we can read the cookies
                // from unlocked copy while
                // FireFox is running
                strTemp = strPath + ".temp";
                strDb   = "Data Source=" + strTemp + ";pooling=false";

                File.Copy(strPath, strTemp, true);

                // Now open the temporary cookie jar and extract Value from the cookie if
                // we find it.
                using (SQLiteConnection conn = new SQLiteConnection(strDb))
                {
                    using (SQLiteCommand cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "SELECT * FROM moz_cookies";

                        conn.Open();
                        using (SQLiteDataReader sqlite_datareader = cmd.ExecuteReader())
                        {
                            while (sqlite_datareader.Read())
                            {
                                BrowserCookie_Node cookienode = new BrowserCookie_Node();
                                cookienode.baseDomain   = sqlite_datareader["baseDomain"].ToString();
                                cookienode.name         = sqlite_datareader["name"].ToString();
                                cookienode.value        = sqlite_datareader["value"].ToString();
                                cookienode.expiry       = BrowserHistory_Node.FromUnixTime(long.Parse(sqlite_datareader["expiry"].ToString()));
                                cookienode.creationTime = BrowserHistory_Node.FromUnixTime(long.Parse(sqlite_datareader["creationTime"].ToString()));
                                cookienode.lastAccessed = BrowserHistory_Node.FromUnixTime(long.Parse(sqlite_datareader["lastAccessed"].ToString()));
                                Cookies.Add(cookienode);
                            }
                        }
                        conn.Close();
                    }
                }

                // All done clean up
                if (string.Empty != strTemp)
                {
                    File.Delete(strTemp);
                }
            }
            return(Cookies);
        }
示例#5
0
        /// <summary>
        /// Gets the firefox history.
        /// </summary>
        /// <returns>get list of firefox histroy</returns>
        public static List <BrowserHistory_Node> OnGetFirefoxHistory()
        {
            List <BrowserHistory_Node> URLs = new List <BrowserHistory_Node>();
            List <string> Profiles          = GetFirefoxProfilePaths();

            foreach (string profile in Profiles)
            {
                DataTable historyDT = ExtractFromTable("moz_places", profile);

                // Get visit Time/Data info
                DataTable visitsDT = ExtractFromTable("moz_historyvisits",
                                                      profile);
                int i = 0;
                // Loop each history entry
                foreach (DataRow row in historyDT.Rows)
                {
                    i++;
                    string ss = row["id"].ToString();

                    BrowserHistory_Node historynode = new BrowserHistory_Node();

                    DataRow[] DTRow = visitsDT.Select("place_id=" + row["id"].ToString());
                    // Select entry Date from visits
                    //var entryDate = (from dates in visitsDT.AsEnumerable()
                    //                 where dates["place_id"].ToString() == row["id"].ToString()
                    //                 select dates).LastOrDefault();

                    if (DTRow.Length > 0)
                    {
                        DateTime dt = BrowserHistory_Node.FromUnixTime(long.Parse(DTRow[0].ItemArray[3].ToString()));
                        historynode.create = dt;
                    }
                    string last_visit_date = row["last_visit_date"].ToString();
                    if (last_visit_date != "")
                    {
                        historynode.lastvisit = BrowserHistory_Node.FromUnixTime(long.Parse(row["last_visit_date"].ToString()));
                    }

                    // Obtain URL and Title strings


                    historynode.url   = row["Url"].ToString();
                    historynode.title = row["title"].ToString();
                    // Create new Entry


                    // Add entry to list
                    URLs.Add(historynode);
                }
            }
            return(URLs);
        }
示例#6
0
        /// <summary>
        /// Gets the ie bookmarks.
        /// </summary>
        /// <returns>get the list of ie bookmark</returns>
        public static List <BrowserHistory_Node> OnGetIEBookmarks()
        {
            List <BrowserHistory_Node> URLs = new List <BrowserHistory_Node>();

            string _favouritesPath = string.Empty;

            string _currentDirectory = string.Empty;
            string _fileName         = string.Empty;

            _favouritesPath = Environment.GetFolderPath(Environment.SpecialFolder.Favorites);
            if (!string.IsNullOrEmpty(_favouritesPath))
            {
                DirectoryInfo di = new DirectoryInfo(_favouritesPath);
                _currentDirectory = Environment.CurrentDirectory;
                if (di != null)
                {
                    FileInfo[] _files = di.GetFiles("*.url", SearchOption.AllDirectories);
                    if (_files != null && _files.Length > 0)
                    {
                        foreach (FileInfo _file in _files)
                        {
                            if (_file.Exists)
                            {
                                _fileName = _file.Name.Split('.').FirstOrDefault().ToString();
                                StreamReader _reader      = _file.OpenText();
                                string       _allContents = _reader.ReadToEnd();
                                string[]     _splits      = _allContents.Split(new char[] { '=', '[' }, StringSplitOptions.RemoveEmptyEntries);
                                if (_splits.Length > 0 && !string.IsNullOrEmpty(_splits[1]))
                                {
                                    BrowserHistory_Node bookmarknode = new BrowserHistory_Node();
                                    for (int i = 0; i < _splits.Length; i++)
                                    {
                                        if (_splits[i] == "\r\nURL")
                                        {
                                            bookmarknode.url       = _splits[i + 1];
                                            bookmarknode.title     = _fileName;
                                            bookmarknode.lastvisit = _file.LastAccessTime;
                                            bookmarknode.create    = _file.CreationTime;
                                            URLs.Add(bookmarknode);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(URLs);
        }
示例#7
0
        /// <summary>
        /// Gets the opera bookmarks.
        /// </summary>
        /// <returns>get the list of opera bookmark</returns>
        public static List <BrowserHistory_Node> OnGetOperaBookmarks()
        {
            List <BrowserHistory_Node> URLs = new List <BrowserHistory_Node>();
            string BookmarksPath            = GetOperaProfilePaths();

            BookmarksPath += "\\Bookmarks";
            if (File.Exists(BookmarksPath))
            {
                using (StreamReader file = File.OpenText(BookmarksPath))
                {
                    JsonSerializer serializer    = new JsonSerializer();
                    JToken         BookmarksFile = (JToken)serializer.Deserialize(file, typeof(JToken));
                    List <JToken>  Bookmarks     = BookmarksFile.FindTokens("children");
                    foreach (JToken Bookmark in Bookmarks)
                    {
                        if (Bookmark.Type == JTokenType.Array)
                        {
                            foreach (JToken child in Bookmark.Children())
                            {
                                foreach (JToken token in child.SelectTokens("$.url"))
                                {
                                    BrowserHistory_Node bookmarnode = new BrowserHistory_Node();
                                    string name       = child["name"].ToString();
                                    string url        = child["url"].ToString();
                                    string date_added = child["date_added"].ToString();
                                    bookmarnode.title  = name;
                                    bookmarnode.url    = url;
                                    bookmarnode.create = BrowserHistory_Node.FromUnixTime(long.Parse(date_added));
                                    URLs.Add(bookmarnode);
                                }
                            }
                        }
                    }
                }
            }
            return(URLs);
        }
示例#8
0
        /// <summary>
        /// Gets the chrome cookies.
        /// </summary>
        /// <returns>get the list of opera cookies</returns>
        public static List <BrowserCookie_Node> OnGetOperaCookies()
        {
            List <BrowserCookie_Node> Cookies = new List <BrowserCookie_Node>();
            string CookiesPath = GetOperaProfilePaths();

            CookiesPath += "\\Cookies";
            string strDb = "Data Source=" + CookiesPath + ";pooling=false";

            using (SQLiteConnection conn = new SQLiteConnection(strDb))
            {
                using (SQLiteCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = "SELECT * FROM cookies";
                    conn.Open();
                    using (SQLiteDataReader sqlite_datareader = cmd.ExecuteReader())
                    {
                        while (sqlite_datareader.Read())
                        {
                            BrowserCookie_Node cookienode = new BrowserCookie_Node();
                            cookienode.baseDomain = sqlite_datareader["host_key"].ToString();
                            cookienode.name       = sqlite_datareader["name"].ToString();
                            byte[] encrypted_value = (byte[])sqlite_datareader["encrypted_value"];
                            string decoded_value   = Encoding.ASCII.GetString(ProtectedData.Unprotect(encrypted_value, null, System.Security.Cryptography.DataProtectionScope.LocalMachine));
                            cookienode.value        = decoded_value;
                            cookienode.expiry       = BrowserHistory_Node.FromUnixTime(long.Parse(sqlite_datareader["expires_utc"].ToString()));
                            cookienode.lastAccessed = BrowserHistory_Node.FromUnixTime(long.Parse(sqlite_datareader["last_access_utc"].ToString()));
                            cookienode.creationTime = BrowserHistory_Node.FromUnixTime(long.Parse(sqlite_datareader["creation_utc"].ToString()));

                            Cookies.Add(cookienode);
                        }
                    }
                    conn.Close();
                }
            }
            return(Cookies);
        }