Beispiel #1
0
        private void btnGetWebbrowserCookie_Click(object sender, EventArgs e)
        {
            //只能以字符串方式获得
            XJHTTP xjhttp = new XJHTTP();
            string cookie = xjhttp.GetCookieByWininet("https://www.taobao.com");
            HttpHelpers http = new HttpHelpers();
            HttpItems hi = new HttpItems();
            hi = new HttpItems();

            hi.URL = "http://i.taobao.com/my_taobao.htm?spm=a21bo.7724922.1997525045.1.2gOl9t";
            hi.Cookie = cookie;
            hr = http.GetHtml(hi);
            if (hr.Html.Contains("我的淘宝"))
            {
                MessageBox.Show("登录成功");
            }
        }
Beispiel #2
0
        private string activeRegEmai2(string emailname,CookieContainer ccc)
        {
            string reText = "";
            string[] status = { "操作", "成功/失败", "状态信息", "无验证码", "无附加信息" };
            Thread.Sleep(15000);
            HttpItems item = new HttpItems();
            HttpHelpers heler = new HttpHelpers();
            HttpResults hr = new HttpResults();
            Regex regex = null;
            MatchCollection mc = null;
            int trytimes = 0;
            string emalid="";
            emalid = emailname .Substring (0,emailname .IndexOf ('@'));
            item = new HttpItems();
            //https://10minutemail.net/
            item.URL = @"http://mailcatch.com/en/rpc.lua";
            item.Method = "Post";
            item.Postdata = string.Format("mod=ListMailsRPC&fct=List&json=%7B%22box%22%3A%22{0}%3Dmailcatch.com%22%2C%22anim%22%3Atrue%7D",emalid );//@"AJAXREQUEST=j_id3&j_id4=j_id4&javax.faces.ViewState=j_id42162&j_id4%3Apoll=j_id4%3Apoll&";
            item.Container = ccc;
            item.Allowautoredirect = true;
            hr = heler.GetHtml(item);
            string emalurl = hr.Html.Replace("\r\n", "").Replace("\t", "").Replace("\n", "");
            if ("errorerror".Equals(emalurl))
            {
                return "失败:errorerror";
            }
            //?box=$boxid&show=a134fc9d-5412-4cda-ac7e-04b48103f78f\">[CSDN

            regex = new Regex("\\&show=(.*?)\\\"\\>\\[CSDN");
            mc = regex.Matches(emalurl);
            if (mc != null && mc.Count >= 1)
            {
                status[0] = "注册帐号";
                status[1] = "进行中";
                status[2] = "扫描到激活邮件";
                status[3] = "即将完成申请";
                status[4] = "";
                Logscomsole(status);
                string []strtmp=mc[0].Groups[0].Value.Split(new char[] { '\"','\\' });
                string urltmp = string.Format("http://yourinbox.mailcatch.com/en/temporary-inbox?box={0}=mailcatch.com{1}", emalid, strtmp[0]);// +"lang=zh-cn";
                //Console.WriteLine(urltmp );
                item = new HttpItems();
                item.URL = urltmp;
                item.Container = ccc;
                item.Allowautoredirect = true;
                hr = heler.GetHtml(item);
                emalurl = hr.Html.Replace("\r\n", "").Replace("\t", "").Replace("\n", "");

                regex = new Regex("https://passport.csdn.net(.*?)action=userInfoView");
                mc = regex.Matches(emalurl);
                if (mc != null && mc.Count > 0)
                {
                    string urlacc = mc[0].Groups[0].Value.Replace("&", "&");
                    return urlacc;
                    //string urlacc = mc[0].Groups[0].Value.Split(new char[] { '\"' })[1]; ;
                    item = new HttpItems();
                    item.URL = urlacc;
                    item.Container = new CookieContainer();
                    hr = heler.GetHtml(item);
                    string htmlss = hr.Html;
                    if (htmlss.Contains("注册成功"))
                    {
                        return "注册成功";
                    }
                    else
                    {
                        return "注册失败" + htmlss;
                    }
                }
            }

            return "注册失败";
        }
Beispiel #3
0
        private string activeRegEmai1(CookieContainer ccc)
        {
            string reText = "";
            string[] status = { "操作", "成功/失败", "状态信息", "无验证码", "无附加信息" };

            HttpItems item = new HttpItems();
            HttpHelpers heler = new HttpHelpers();
            HttpResults hr = new HttpResults();
            Regex regex = null;
            MatchCollection mc = null;
            int trytimes = 0;

            item = new HttpItems();
            //https://10minutemail.net/
            item.URL = @"http://10minutemail.com/10MinuteMail/index.html";
            item.Method = "Post";
            item.Postdata = @"AJAXREQUEST=j_id3&j_id4=j_id4&javax.faces.ViewState=j_id42162&j_id4%3Apoll=j_id4%3Apoll&";
            item.Container = ccc;
            item.Allowautoredirect = true;
            CHECKEMAIL:
            hr = heler.GetHtml(item);
            string emalurl = hr.Html.Replace("\r\n", "").Replace("\t", "").Replace("\n", "");
            if ("errorerror".Equals(emalurl))
            {
                return "失败:errorerror";
            }
            regex = new Regex("<td>service@register\\.csdn.net</td><td><a href=\".*?\">\\[CSDN\\]");
            mc = regex.Matches(emalurl);

            if (mc.Count == 0)
            {
                if (trytimes <= 10)
                {
                    trytimes++;
                    status[0] = "注册帐号";
                    status[1] = "进行中";
                    status[2] = "等待邮件到达";
                    status[3] = "20秒后重新扫描";
                    status[4] = "";
                    Logscomsole(status);
                    Thread.Sleep(20000);
                    goto CHECKEMAIL;
                }
                else
                {
                    status[0] = "注册帐号";
                    status[1] = "失败";
                    status[2] = "邮件长时间未到";
                    status[3] = "重试申请";
                    status[4] = "";
                    Logscomsole(status);
                    //reg();
                    return "邮件长时间未到";
                }

            }
            if (mc != null && mc.Count >= 1)
            {
                status[0] = "注册帐号";
                status[1] = "进行中";
                status[2] = "扫描到激活邮件";
                status[3] = "即将完成申请";
                status[4] = "";
                Logscomsole(status);

                string urltmp = @"http://10minutemail.com/" + mc[0].Groups[0].Value.Split(new char[] { '\"' })[1].Replace ("&amp;","&");// +"lang=zh-cn";
                //Console.WriteLine(urltmp );
                item = new HttpItems();
                item.URL = urltmp;
                item.Container = ccc;
                item.Allowautoredirect=true;
                hr = heler.GetHtml(item);
                emalurl = hr.Html.Replace("\r\n", "").Replace("\t", "").Replace("\n", "");
                // Console.WriteLine(emalurl);
                //action=userInfoView
                //regex = new Regex("CSDN各项服务。<br/><br/> https(.*?)<br/>");

                regex = new Regex("https://passport.csdn.net(.*?)action=userInfoView");
                mc = regex.Matches(emalurl);
                if (mc != null && mc.Count > 0)
                {
                    string urlacc = mc[0].Groups[0].Value.Replace("&amp;", "&");
                    //string urlacc = mc[0].Groups[0].Value.Split(new char[] { '\"' })[1]; ;
                    item = new HttpItems();
                    item.URL = urlacc;
                    item.Container = new CookieContainer();
                    hr = heler.GetHtml(item);
                    string htmlss = hr.Html;
                    if (htmlss.Contains("注册成功"))
                    {
                        return "注册成功";
                    }
                    else
                    {
                        return "注册失败" + htmlss;
                    }
                }
            }

            return "注册失败";
        }
Beispiel #4
0
        /// <summary>
        /// .net
        /// </summary>
        /// <param name="ccc"></param>
        /// <returns></returns>
        private string activeRegEmai(CookieContainer ccc)
        {
            string reText = "";
            string[] status = { "操作", "成功/失败", "状态信息", "无验证码", "无附加信息" };

            HttpItems item = new HttpItems();
            HttpHelpers heler = new HttpHelpers();
            HttpResults hr = new HttpResults();
            Regex regex = null ;
            MatchCollection mc = null;
            int trytimes = 0;

            item = new HttpItems();
            //https://10minutemail.net/
            item.URL = @"https://10minutemail.net/mailbox.ajax.php?_=";

            item.Container = ccc ;
             CHECKEMAIL:
            hr = heler.GetHtml(item);
            string emalurl = hr.Html.Replace("\r\n", "").Replace("\t", "").Replace("\n", "");
            if ("errorerror".Equals(emalurl))
            {
                return "失败:errorerror";
            }
            regex = new Regex("<td>service@register\\.csdn.net</td><td><a href=\".*?\">\\[CSDN\\]");
            mc = regex.Matches(emalurl);

            if (mc.Count == 0)
            {
                if (trytimes <= 10)
                {
                    trytimes++;
                    status[0] = "注册帐号";
                    status[1] = "进行中";
                    status[2] = "等待邮件到达";
                    status[3] = "20秒后重新扫描";
                    status[4] = "";
                    Logscomsole(status);
                    Thread.Sleep(20000);
                    goto CHECKEMAIL;
                }
                else
                {
                    status[0] = "注册帐号";
                    status[1] = "失败";
                    status[2] = "邮件长时间未到";
                    status[3] = "重试申请";
                    status[4] = "";
                    Logscomsole(status);
                    //reg();
                    return "邮件长时间未到";
                }

            }
            if (mc != null && mc.Count >= 1)
            {
                status[0] = "注册帐号";
                status[1] = "进行中";
                status[2] = "扫描到激活邮件";
                status[3] = "即将完成申请";
                status[4] = "";
                Logscomsole(status);

                string urltmp = @"https://10minutemail.net/" + mc[0].Groups[0].Value.Split(new char[] { '\"' })[1];// +"lang=zh-cn";
                //Console.WriteLine(urltmp );
                item = new HttpItems();
                item.URL = urltmp;
                item.Container =ccc ;
                hr  = heler .GetHtml(item);
                emalurl = hr.Html.Replace("\r\n", "").Replace("\t", "").Replace("\n", "");
                // Console.WriteLine(emalurl);
                regex = new Regex("href=\".*?\"");
                mc = regex.Matches(emalurl);
                if (mc != null && mc.Count > 0)
                {
                    string urlacc = mc[103].Groups[0].Value.Split(new char[] { '\"' })[1].Replace("&amp;", "&"); ;
                    item = new HttpItems();
                    item.URL = urlacc;
                    item.Container = new CookieContainer ();
                    hr = heler.GetHtml(item);
                    string htmlss = hr.Html;
                    if (htmlss.Contains("注册成功"))
                    {
                        return "注册成功";
                    }
                    else
                    {
                        return "注册失败"+htmlss;
                    }
                }
            }

            return "注册失败" ;
        }
Beispiel #5
0
        private string[] regForIn(string proxyip="")
        {
            Start:
            //string proxyip = "";
            int trytimes = 0;
            string[] status = { "操作", "成功/失败", "状态信息", "无验证码", "无附加信息" };
            status[0] = "注册帐号";
            status[1] = "开始";
            status[2] = "";
            status[3] = "";
            status[4] = "";
            Logscomsole(status);

            HttpItems items_reg = new HttpItems();
            HttpHelpers heler_reg = new HttpHelpers();
            HttpResults hr_reg = new HttpResults();

            CookieContainer cc_em = new CookieContainer();
            CookieContainer cc_reg = new CookieContainer();
            Regex regex = null;
            MatchCollection mc = null;

            byte[] regCodebytes = null;

            string email = "";
            string name = "";
            string regCode = "";

            //https://passport.csdn.net/ajax/verifyhandler.ashx//验证码
            hr_reg = heler_reg.GetHtml(new HttpItems()
            {
                URL = @"https://passport.csdn.net/ajax/verifyhandler.ashx",
                ResultType = ResultType.Byte,
                Container = cc_reg
            });

            regCodebytes = hr_reg.ResultByte;

            if (getRegVcode != null)
            {
                regCode = getRegVcode(regCodebytes);
            }
            if (regCode == "")
            {
                status[0] = "注册帐号";
                status[1] = "失败";
                status[2] = "识别验证码失败";
                status[3] = "重试申请";
                status[4] = "";
                Logscomsole(status);
                //reg();
                return regForIn();
            }
            //检查验证码
            //http://passport.csdn.net/account/register?action=validateCode&validateCode=
            items_reg = new HttpItems() {
                URL= "http://passport.csdn.net/account/register?action=validateCode&validateCode=" + regCode,
                Container =cc_reg
            };
            hr_reg = heler_reg.GetHtml(items_reg);
            if (hr_reg.Html.ToLower() != "true")
            {
                status[0] = "注册帐号";
                status[1] = "失败";
                status[2] = "识别验证码失败";
                status[3] = "重试申请";
                status[4] = "";
                Logscomsole(status);
                goto Start;
            }
            trytimes = 0;
            //检查名字
            //http://passport.csdn.net/account/register?action=validateUsername&username=
            //检查邮箱
            //http://passport.csdn.net/account/register?action=validateEmail&[email protected]
            //检查验证码
            //http://passport.csdn.net/account/register?action=validateCode&validateCode=
            //重发激活右键
            //http://passport.csdn.net/account/register?action=resendActiveEmail&username=
            GetMail:

            email = getRegEmail2(cc_em);
            //检查验证码
            //http://passport.csdn.net/account/register?action=validateCode&validateCode=

            hr_reg = heler_reg.GetHtml(new HttpItems() {
                URL = "http://passport.csdn.net/account/register?action=validateEmail&email=" + email,
                Container =cc_reg
            });
            if (hr_reg.Html.ToLower() != "true")
            {
                trytimes++;
                if (trytimes < 5)
                {
                    Logscomsole(new string[] { "注册帐号", "失败", "邮箱验证失败", hr_reg.Html, "" });
                    goto GetMail;
                }
                else
                {
                    Logscomsole(new string[] { "注册帐号","失败", "邮箱验证失败次数过多",hr_reg .Html ,"" });
                    return new string[] { };
                }
            }
            trytimes = 0;
            GetregName:
            name = GetName();
            //检查名字
            hr_reg = heler_reg.GetHtml(new HttpItems()
            {
                URL = "http://passport.csdn.net/account/register?action=validateUsername&username="******"true")
            {
                trytimes++;
                if (trytimes < 5)
                {
                    Logscomsole(new string[] { "注册帐号", "失败", "用户名验证失败", hr_reg.Html, "" });
                    goto GetregName;
                }
                else
                {
                    Logscomsole(new string[] { "注册帐号", "失败", "用户名验证失败次数过多", hr_reg.Html, "" });
                    return new string[] { };
                }
            }
            //string email = string.Format("{0}@qq.com", name);
            string pwd = string.IsNullOrEmpty(mima) ? "aa13655312932bb" : mima;
            Logscomsole(new string[] { "注册帐号", "进行中", "验证成功", "用户名:" + name, "邮箱:" + email });
            PostRequest:

            #region 提交注册请求

            hr_reg = heler_reg.GetHtml(new HttpItems()
            {
                Container = cc_reg,
                URL = "http://passport.csdn.net/account/register?action=saveUser&isFrom=False",
                Postdata = string.Format("fromUrl={0}&userName={1}&email={2}&password={3}&confirmpassword={4}&validateCode={5}&agree=on",
                string.Empty, name, email, pwd, pwd, regCode),
                Method = "POST",

                ProxyIp = proxyip,
            });
            int trycount = 0;
              WaitForEmail:
            trycount++;
            string html = hr_reg.Html.Replace("\r\n", "").Replace("\t", "").Replace("\n", "");

            if (html.Contains("邮件已发送到邮箱")||html .Contains ("不允许在一分钟内重复发送激活邮件,请稍后"))
            {
                Logscomsole(new string[] {"注册帐号","进行中","激活邮件已发送", "等待邮件到达","" });
                string str = "";
                if (!(str = activeRegEmai2(email, cc_em)).Contains("失败"))
                {
                    str = "http" + str.Substring(5);
                    hr_reg = new HttpHelpers().GetHtml(new HttpItems() {
                        URL =str.Replace ("https","http") ,
                        ProxyIp =proxyip ,
                        //Allowautoredirect =true
                    });

                    hr_reg = new HttpHelpers().GetHtml(new HttpItems()
                    {
                        URL = str.Replace("https", "http"),
                        ProxyIp = proxyip,
                        //Allowautoredirect =true
                    });
                    string htmlss = hr_reg.Html;
                    if (htmlss.Contains("注册成功")||htmlss .Contains ("账户已经激活"))
                    {
                        status[0] = "注册帐号";
                        status[1] = "成功";
                        status[2] = "帐号:" + name;
                        status[3] = "密码:" + pwd;
                        status[4] = "";
                        Logscomsole(status);
                        return new string[] { name, pwd };
                    }
                    else
                    {
                        status[0] = "注册帐号";
                        status[1] = "失败";
                        status[2] = htmlss;
                        status[3] = "";
                        status[4] = "";
                        Logscomsole(status);
                        return new string[] { };
                    }
                }
                else
                {

                     if(trycount <7)
                    {

                        if (trycount % 5 == 0)
                        {
                            status[0] = "注册帐号";
                            status[1] = "进行中";
                            status[2] = "重发邮件" + name;
                            status[3] = "15秒后重新检测";
                            status[4] = "";
                            Logscomsole(status);
                            hr_reg = new HttpHelpers().GetHtml(new HttpItems()
                            {
                                URL = string.Format("http://passport.csdn.net/account/register?action=resendActiveEmail&username={0}", name),
                                ProxyIp =proxyip
                            });
                        }
                        else
                        {
                            status[0] = "注册帐号";
                            status[1] = "进行中";
                            status[2] = "等待激活邮件" + name;
                            status[3] = "15秒后重新检测";
                            status[4] = "";
                            Logscomsole(status);
                        }
                        goto WaitForEmail;
                    }

                    status[0] = "注册帐号";
                    status[1] = "失败";
                    status[2] = "激活邮箱问题";
                    status[3] = str;
                    status[4] = "";
                    Logscomsole(status);
                    if (str.Contains("errorerror"))
                    {
                        return regForIn();
                    }
                    return new string[] { str };
                }
            }
            else
            {
                status[0] = "注册帐号";
                status[1] = "失败";

                if (html.Contains("此ip单位时间内注册个数已超过限定值"))
                {
                    //if (regeristResult != null)
                    //{
                    //    regeristResult();
                    //}
                    status[2] = "此ip单位时间内注册个数已超过限定值";
                    status[3] = "";
                    status[4] = "";
                    Logscomsole(status);
                    return new string[] { "单位时间内注册个数已超过限定值" };
                }
                else
                {
                    status[2] = "验证码错误";
                    status[3] = "重试申请";
                    status[4] = html;
                    Logscomsole(status);
                    goto Start;
                    // return;
                }
            }
            #endregion

            status[0] = "注册帐号";
            status[1] = "失败";
            status[2] = "未知原因";
            status[3] = "";
            status[4] = "";
            Logscomsole(status);

            return new string[] { };
        }
Beispiel #6
0
        private void getUploadRs()
        {
            // Logscomsole(status);
            HttpHelpers helper_up = new HttpHelpers();
            HttpItems items_up = new HttpItems();
            HttpResults hr_up = new HttpResults();
            string url;
            string rehtml;

            url =string.Format ("http://download.csdn.net/my");
            items_up = new HttpItems() {
                URL = url,
                Container = cc
            };
            hr_up = helper_up.GetHtml(items_up);
            string DownHtml = hr_up.Html.Replace("\r", "").Replace("\n", "").Replace("\t", "").Replace(" ", "");
            string result = Regex.Replace(DownHtml, @"<!--(.+?)-->", "");

            //获取下载资源数量
            Regex regDown = new Regex("上传资源:<spanclass=\"red\">(.+?)</span>");
            MatchCollection mcDown = regDown.Matches(result);
            double upCount = 0;
            if (mcDown.Count > 0)
            {
                upCount = Convert.ToDouble(mcDown[0].Groups[1].Value);
            }
            //Regex reg = new Regex("<dt><divclass=\"icon\"><imgsrc=\"(.+?)\"title=\"(.+?)\"></div><divclass=\"btns\"></div><h3><ahref=\"(.+?)\"(.*?)\">(.+?)</a><spanclass=\"points\">(.+?)</span></h3></dt>");
            Regex reg = new Regex("<dt><divclass=\"icon\"><imgsrc=\"(.+?)\"title=\"(.+?)\"></div><divclass=\"btns\">(<ahref=(.*?)删除</a>)?</div><h3><ahref=\"(.+?)\"(.*?)\">(.+?)</a><spanclass=\"points\">(.+?)</span></h3></dt>");
            MatchCollection mc = reg.Matches(result);
            if (mc.Count > 0)
            {
                foreach (Match item in mc)
                {
                    CsdnResouce cdsr = new CsdnResouce();
                    if (item.Groups.Count == 9)
                    {
                        cdsr.Url = item.Groups[5].Value;
                        cdsr.Name = item.Groups[7].Value;
                        cdsr.Point = item.Groups[8].Value;
                    }
                    else
                    {
                        cdsr.Url = item.Groups[3].Value;
                        cdsr.Name = item.Groups[5].Value;
                        cdsr.Point = item.Groups[6].Value;
                    }
                    //CsdnResouce cdsr = new CsdnResouce(tmp1[6], tmp1[4]);
                    cdsr.Tag = String.Format("http://download.csdn.net{0}", cdsr.Url);
                    uploadedRS.Add(cdsr );
                }
            }
            Logscomsole(new string[] { "获取上传资源", "结束", "共 " + upCount.ToString() + " 个资源", "", "" });
        }
Beispiel #7
0
        private string getRegEmail2(CookieContainer ccc)
        {
            HttpItems item = new HttpItems();
            HttpHelpers heler = new HttpHelpers();
            HttpResults hr = new HttpResults();

            item = new HttpItems();
            //http://10minutemail.com/10MinuteMail/index.html
            item.URL = @"http://mailcatch.com/en/disposable-email";
            item.Container = ccc;

            hr = heler.GetHtml(item);
            Regex regex = new Regex("ata-clipboard-text=\".*?\"");
            MatchCollection mc = regex.Matches(hr.Html.Replace("\r\n", "").Replace("\t", "").Replace("\n", ""));
            if (mc != null && mc.Count > 0)
            {

                string email = mc[0].Groups[0].Value;
                email = email.Split(new char[] { '\\', '\"' })[1];
                return email;
            }

            return "";
        }
Beispiel #8
0
        /// <summary>
        /// .net
        /// </summary>
        /// <param name="ccc"></param>
        /// <returns></returns>
        private string getRegEmail(CookieContainer ccc)
        {
            HttpItems item = new HttpItems();
            HttpHelpers heler = new HttpHelpers();
            HttpResults hr = new HttpResults();
            string url;

            url = @"https://10minutemail.net/";
            item = new HttpItems()
            {
                URL = url ,
                Container =ccc
            };
            hr = heler.GetHtml(item);
            Regex regex = new Regex("ata-clipboard-text=\".*?\"");
            MatchCollection mc = regex.Matches(hr.Html.Replace("\r\n", "").Replace("\t", "").Replace("\n", ""));
            if (mc != null && mc.Count > 0)
            {

                string email = mc[0].Groups[0].Value;
                email = email.Split(new char[] { '\\', '\"' })[1];
                return email;
            }

            return "";
        }
Beispiel #9
0
        private void button6_Click(object sender, EventArgs e)
        {
            CookieContainer cc = new CookieContainer();
            HttpItems items = new HttpItems();
            HttpHelpers helper = new HttpHelpers();
            HttpResults hr = new HttpResults();

            string cookie = "";//字符串方式处理
            items = new HttpItems();
            //items.Container = cc; 自动处理方式
            items.Cookie = cookie;
            items.URL = "http://www.u193.com/opt.php?do=login";
            items.Referer = "http://mrtx.u193.com/";
            items.Method = "Post";
            items.Postdata = "username=ceshiyixia1&password=111111";
            items.Allowautoredirect = true;
            hr = helper.GetHtml(items);

            #region 手动处理字符串Cookie方式
            //hr.Cookie调用时会自动清理cookie 自动剔除无用信息.等同于
            // new XJHTTP().ClearCookie(hr.Cookie);
            cookie = new XJHTTP().UpdateCookie(cookie, hr.Cookie);//手动合并两个Cookie
            #endregion

            #region 自动处理字符串Cookie方式
            //使用ref将cookie传递进方法,每次会自动合并上次与本次返回的cookie
            hr = helper.GetHtml(items, ref cookie);

            #endregion
            //第二次请求
            items = new HttpItems();
            items.URL = "http://mrtx.u193.com/";
            items.Referer = "http://mrtx.u193.com/";
            items.Cookie = cookie;
            //  items.Container = cc; 当cc无法被携带提交失败时使用字符串方式即可
            hr = helper.GetHtml(items);
        }