Beispiel #1
0
        private void GetLocation(AccountItem account, string html)
        {
            GameServer gameServer = this.DetectionParamsItem.CurrentGameServer;
            string     addrUrl    = HtmlParser.GetPropertyFromHtml("id=\"addressLink\"", "</a>", "href=", html);

            if (!string.IsNullOrEmpty(addrUrl))
            {
                addrUrl = CreateAbUrlByRel(gameServer.DomainUrl, addrUrl);
                string addrHtml = ReadFromUrl(addrUrl);
                if (!string.IsNullOrEmpty(addrHtml))
                {
                    string addrDetail = HtmlParser.GetSubString(addrHtml, "<div class=\"address-info\">", "</div>");
                    if (!string.IsNullOrEmpty(addrDetail))
                    {
                        IList <string> addrList = HtmlParser.GetInnerTextListFromHtml("<span>", "</span>", addrDetail);
                        string         location = string.Empty;
                        foreach (string item in addrList)
                        {
                            location += item + "- ";
                        }
                        account.Location = location;
                    }
                }
            }
        }
Beispiel #2
0
        protected StreamWriter GetStreamWriter(AccountItem userItem)
        {
            switch (userItem.State)
            {
            case LoginState.LoginSucceed:
            case LoginState.RegistrationInvalid:
            case LoginState.EnterGame:
            case LoginState.LoginSucceedAndVerified:
                OutputMgt.Instance.SucceedCount++;
                return(this.GetStream(Succeed));

            case LoginState.Locked:
            case LoginState.Unactive:
            case LoginState.VerifyMail:
                OutputMgt.Instance.SucceedCount++;
                return(this.GetStream(InvalidRegister));

            case LoginState.LoginFalied:
                OutputMgt.Instance.FailedCount++;
                return(this.GetStream(Failed));

            case LoginState.Unknown:
                OutputMgt.Instance.UnknownCount++;
                return(this.GetStream(Unknown));

            default:
                OutputMgt.Instance.FailedCount++;
                return(this.GetStream(Failed));
            }
        }
Beispiel #3
0
        private bool GetDetail(AccountItem account)
        {
            GameServer gameServer = this.DetectionParamsItem.CurrentGameServer;

            if (null == account || string.IsNullOrEmpty(gameServer.AccountDetailUrl))
            {
                return(false);
            }

            string accountSummaryUrl = "https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/accountSummary";
            string html = this.ReadFromUrl(accountSummaryUrl);


            string metricsUrl = "http://metrics.apple.com/b/ss/applesuperglobal/1/G.6--NS?pageName=BrowserRedirect&pccr=true&ch=BrowserRedirect&h5=appleitmsna%2Cappleitmsus";

            html = this.ReadFromUrl(metricsUrl);
            //string initUrl = "http://ax.init.itunes.apple.com./bag.xml?ix=4";
            //html = this.ReadFromUrl(initUrl);
            //html = this.ReadFromUrl(initUrl);
            isMultiPart = true;
            string buyUrl = "https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/accountSummary?ign-mscache=1";

            html = this.ReadFromUrl(buyUrl, true);
            //html = this.ReadFromUrl(initUrl);

            string boundary   = "--245419563ABA00BD2D9478CCB70DF28C";
            string newLine    = Environment.NewLine;
            string postFormat = boundary + newLine +
                                "Content-Disposition: form-data; name=\"machineName\"" + newLine + newLine +
                                Environment.MachineName + newLine +
                                boundary + newLine +
                                "Content-Disposition: form-data; name=\"attempt\"" + newLine + newLine +
                                "1" + newLine +
                                boundary + newLine +
                                "Content-Disposition: form-data; name=\"why\"" + newLine + newLine +
                                "serverDialog" + newLine +
                                boundary + newLine +
                                "Content-Disposition: form-data; name=\"guid\"" + newLine + newLine +
                                "1334361A.FE82C235.3EFDECB0.D47B6924.14DF9387.775CDDA0.3EE73B7E" + newLine +
                                boundary + newLine +
                                "Content-Disposition: form-data; name=\"password\"" + newLine + newLine +
                                "{0}" + newLine +
                                boundary + newLine +
                                "Content-Disposition: form-data; name=\"appleId\"" + newLine + newLine +
                                "{1}" + newLine +
                                boundary + newLine +
                                "Content-Disposition: form-data; name=\"createSession\"" + newLine + newLine +
                                "true" + newLine +
                                boundary + "--" + newLine + newLine;

            html        = this.ReadUrlContent(gameServer.AccountDetailUrl, string.Format(postFormat, account.Password, account.User));
            isMultiPart = false;
            return(html.Length > 0);
        }
Beispiel #4
0
        public void GetState(AccountItem account)
        {
            if (account == null)
            {
                return;
            }
            AppleLogManager.Instance.Info(string.Format("正在查询{0} ,{1}", account.Index, account.EMail));

            this.Account = account;
            GameServer gameServer = this.DetectionParamsItem.CurrentGameServer;
            string     html       = string.Empty;
            string     postFormat = PostFormat;

            //Get login uri
            if (!string.IsNullOrEmpty(gameServer.LoginUrl))
            {
                html = this.ReadFromUrl(gameServer.LoginUrl);
                if (IsReadSucceedFromUrl(html))
                {
                    string loginUrl = HtmlParser.GetPropertyFromHtml("<a class=\"more\" href=\"/cgi-bin/WebObjects/MyAppleId.woa", "\">", "href", html);
                    if (IsReadSucceedFromUrl(loginUrl))
                    {
                        html = this.ReadFromUrl(CreateAbUrlByRel(gameServer.DomainUrl, loginUrl));
                    }
                }
            }

            if (!IsReadSucceedFromUrl(html))
            {
                html = this.ReadFromUrl("https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/101/wa/directToSignIn?localang=zh_Cn");
            }
            //<form method="POST" id="signIn" name="signIn" action="/cgi-bin/WebObjects/MyAppleId.woa/101/wo/4lsbAuXWx4SntoC8xGeLtw/0.0.35.145.1">
            string postActionUrl = GetPostActionUri(html);

            if (string.IsNullOrEmpty(postActionUrl))
            {
                postActionUrl = HTTPERROR;
            }
            string[] splitItems = postActionUrl.Split('/');
            if (splitItems.Length > 2)
            {
                string id     = splitItems[splitItems.Length - 1];
                string random = splitItems[splitItems.Length - 2];
                string data   = string.Format(postFormat, id, Uri.EscapeDataString(this.Account.EMail), Uri.EscapeDataString(this.Account.Password).Replace("!", "%21"), random);
                html = this.ReadUrlContent(postActionUrl, data);
            }

            this.GetState(account, html);
            if (account.IsLoginSucceed)
            {
                GetLocation(account, html);
                //GetDetail(account);
            }
        }
Beispiel #5
0
        public void Output(AccountItem userItem, DetectionParamsItem paramsItem)
        {
            if ((null == userItem) || (null == paramsItem))
            {
                AppleLogManager.Instance.ErrorWithCallback("FileExportManager.Output error, parameters has null");
                return;
            }

            this.CreateFileExporter(paramsItem);
            this.fileExporter.Output(userItem);
        }
Beispiel #6
0
        public virtual void Output(AccountItem userItem)
        {
            lock (output)
            {
                if ((null != userItem))
                {
                    DBHelper.InsertHistory(userItem);
                    DBHelper.InsertQueriedItems(userItem);

                    StreamWriter sw      = GetStreamWriter(userItem);
                    string       content = userItem.ToString();
                    this.Output(content, sw);
                }
            }
        }
Beispiel #7
0
        private void GetState(AccountItem account, string html)
        {
            if ((null == account))
            {
                return;
            }
            if (this.IsContains(html, "<span id = \"primary-email\" class = \"email\">", "欢迎", "已验证", "您可以随时更改您的 Apple ID", "储存更改") &&
                this.IsContains(html, "注销"))
            {
                account.State = LoginState.LoginSucceed;

                if (this.IsContains(html, "已验证", "<span class=\"verified\">"))
                {
                    account.State = LoginState.LoginSucceedAndVerified;
                }
            }
            else if (this.IsContains(html, "21607", HTTPERROR))
            {
                account.State = LoginState.NetworkFailure;
            }
            else if (this.IsContains(html, "您输入的 Apple ID 或密码不正确", " 密码错误"))
            {
                account.State = LoginState.LoginFalied;
            }
            else if (this.IsContains(html, "此 Apple ID 已被锁"))
            {
                account.State = LoginState.Locked;
            }
            else if (this.IsContains(html, "<span class=\"input-msg red show\">这个人不在激活状态。</span>"))
            {
                account.State = LoginState.Unactive;
            }
            else if (this.IsContains(html, "验证您的电子邮件地址"))
            {
                account.State = LoginState.VerifyMail;
            }
            //密保
            //else if (this.IsContains(html, "验证您的电子邮件地址"))
            //{
            //    account.State = LoginState.VerifyMail;
            //}
            else
            {
                account.State = LoginState.Unknown;
            }
        }
Beispiel #8
0
        public static bool InsertQueriedItems(AccountItem account)
        {
            lock (lockInsertObj)
            {
                if (IsSqlConOpened)
                {
                    string sql = string.Format(" insert into QueriedApple (QueriedIndex,Email) values ({0},\'{1}\')",
                                               account.Index, account.EMail);

                    if (!string.IsNullOrEmpty(sql))
                    {
                        sqlList.Add(sql);
                        if (sqlList.Count % INSERTMAX == 0)
                        {
                            return(InsertData(sqlList));
                        }
                    }
                }
                return(false);
            }
        }
Beispiel #9
0
        public static bool InsertHistory(AccountItem account)
        {
            if (IsSqlConOpened)
            {
                string sql = string.Format(" insert into AppleResult (AccountId,Email,State,Result)" +
                                           " values ({0},\'{1}\',\'{2}\',\'{3}\') ",
                                           account.Index, account.EMail, account.State, account.StateComment);

                if (!string.IsNullOrEmpty(sql))
                {
                    //return RunSql(sql);
                    sqlHistoryList.Add(sql);
                    if (sqlHistoryList.Count % INSERTMAX == 0)
                    {
                        return(InsertData(sqlHistoryList));
                    }
                }
            }

            return(false);
        }