/// <summary> /// 模拟登陆,ip代理可能需要用到 /// </summary> /// <returns></returns> public bool SimulateLogin() { //return true; //Settings.SimulateCookies = "pgv_pvid=1513639250; aliyungf_tc=AQAAADPRHnGrvwQAIkg9OwOqtkYJbU4N; oldFlag=1; CNZZDATA1259577625=112366950-1466409958-%7C1466415358; hide-index-popup=1; hide-download-panel=1; _alicdn_sec=576ba5f9a986fb4802dacf51bc99b1e76724f58e; connect.sid=s%3AeYWXycPKai63BYTmB9d6h-0IM_R2kp6n.EUgfW0AmJ6GB%2F0TamTi4tT53QK4OR4yQtU1I3Ba8Ryo; userKey=QXBAdmin-Web2.0_N3iUdNobAoys4M395Pk5v%2F6Zxcwjt1tiCqeSf3X3ZnI%3D; userValue=bea26f0d-e414-168a-0fe2-b8eb4278ab07; Hm_lvt_52d64b8d3f6d42a2e416d59635df3f71=1464663982,1464775028,1464776749,1465799273; Hm_lpvt_52d64b8d3f6d42a2e416d59635df3f71=1466672591";//设置cookie值 //return true; if (!string.IsNullOrEmpty(Settings.LoginAccount)) { return(true); } // return SimulateLoginEx(); var userName = string.Empty; var passWord = string.Empty; if (AccountQueue.Count() > 0) { var _curCookie = AccountQueue.Dequeue(); if (_curCookie != null) { Console.WriteLine("提取账号{0}", _curCookie.Text("name")); userName = _curCookie.Text("name"); passWord = _curCookie.Text("password"); Settings.LoginAccount = userName; } else { Environment.Exit(0); } } else { Environment.Exit(0); } return(AliyunAutoLoin(userName, passWord)); IPProxy ipProxy = null; HttpManager.Instance.InitWebClient(hi, true, 30, 30); Random rand = new Random(Environment.TickCount); var nameNormal = userName; var pwdNormal = passWord; if (string.IsNullOrEmpty(nameNormal) || string.IsNullOrEmpty(pwdNormal)) { return(false); } var validUrl = ""; var postFormat = ""; bool result = false; // var postFormat = "geetest_challenge={0}&geetest_validate={1}&geetest_seccode={1}%7Cjordan&requestType=search_enterprise"; var passResult = geetestHelper.PassGeetest(hi, postFormat, validUrl, Settings.SimulateCookies); result = passResult.Status; // this.richTextBoxInfo.Document.Blocks.Clear(); //this.webBrowser.Refresh(); if (passResult.Status) { hi.Url = "http://www.qichacha.com/user_loginaction"; hi.Refer = "http://www.qichacha.com/user_login"; hi.PostData = string.Format("nameNormal={0}&pwdNormal={1}&geetest_challenge={2}&geetest_validate={3}&geetest_seccode={3}%7Cjordan", nameNormal, pwdNormal, passResult.Challenge, passResult.ValidCode); var ho = HttpManager.Instance.ProcessRequest(hi); if (ho.IsOK) { if (ho.TxtData.Contains("true")) { Settings.SimulateCookies = ho.Cookies; Console.WriteLine("过验证码模拟登陆成功"); return(true); } } var resultText = geetestHelper.GetLastPoint(hi); Console.WriteLine(resultText); } return(false); }
/// <summary> /// 模拟登陆,ip代理可能需要用到 /// </summary> /// <returns></returns> public bool SimulateLogin() { //return true; Settings.SimulateCookies = "yunsuo_session_verify=760b6fed201cabba9dbbc08d6ee95433; yoursessionname1=217703E3DF30F6B367DEC0B3B4EBD13F; yoursessionname0=2ACF87288AD50420E1507A8F20B69186";//设置cookie值 return(true); if (!string.IsNullOrEmpty(Settings.LoginAccount)) { return(true); } // return SimulateLoginEx(); var userName = string.Empty; var passWord = string.Empty; if (AccountQueue.Count() > 0) { var _curCookie = AccountQueue.Dequeue(); if (_curCookie != null) { Console.WriteLine("提取账号{0}", _curCookie.Text("name")); userName = _curCookie.Text("name"); passWord = _curCookie.Text("password"); Settings.LoginAccount = userName; } else { Environment.Exit(0); } } else { Environment.Exit(0); } // return AliyunAutoLoin(userName, passWord); IPProxy ipProxy = null; HttpManager.Instance.InitWebClient(hi, true, 30, 30); Random rand = new Random(Environment.TickCount); var nameNormal = userName; var pwdNormal = passWord; if (string.IsNullOrEmpty(nameNormal) || string.IsNullOrEmpty(pwdNormal)) { return(false); } var validUrl = ""; var postFormat = ""; bool result = false; // var postFormat = "geetest_challenge={0}&geetest_validate={1}&geetest_seccode={1}%7Cjordan&requestType=search_enterprise"; var passResult = geetestHelper.PassGeetest(hi, postFormat, validUrl, Settings.SimulateCookies); result = passResult.Status; // this.richTextBoxInfo.Document.Blocks.Clear(); //this.webBrowser.Refresh(); if (passResult.Status) { hi.Url = "http://www.qichacha.com/user_loginaction"; hi.Refer = "http://www.qichacha.com/user_login"; hi.PostData = string.Format("nameNormal={0}&pwdNormal={1}&geetest_challenge={2}&geetest_validate={3}&geetest_seccode={3}%7Cjordan", nameNormal, pwdNormal, passResult.Challenge, passResult.ValidCode); var ho = HttpManager.Instance.ProcessRequest(hi); if (ho.IsOK) { if (ho.TxtData.Contains("true")) { Settings.SimulateCookies = ho.Cookies; Console.WriteLine("过验证码模拟登陆成功"); return(true); } } var resultText = geetestHelper.GetLastPoint(hi); Console.WriteLine(resultText); } return(false); }