Ejemplo n.º 1
0
        ///   <summary>
        ///   获取验证码基本配置
        ///   </summary>
        ///  <param name="qq">QQ号</param>
        ///   <param name="cap_cd">cap_cd</param>
        ///   <param name="sid">sid</param>
        ///  <param name="sess">sess</param>
        /// <returns>逻辑型</returns>
        public bool GetSliderInfo(string qq, string cap_cd, ref string sid, ref string sess)
        {
            string callback, data, url, temp = string.Empty;
            Json   json = new Json();

            callback = "_aq_" + GetText.GetRandom(111111, 999999);
            url      = "https://ssl.captcha.qq.com/cap_union_prehandle?aid=" + Resources.aid + "&captype=&protocol=https&clientype=1&disturblevel=&apptype=2&noheader=0&color=&showtype=&fb=1&theme=&lang=2052&ua=" + Resources.ua + "&cap_cd=" + cap_cd + "&uid=" + qq + "&callback=" + callback + "&sess=&subsid=1";
            data     = WEB.GetWebData(url, ref temp, ref temp, ref temp);
            data     = GetText.TextMiddle(data, callback + "(", ")", 0);
            json.Analysis(data);
            sid  = json.Getvalue("sid");
            sess = json.Getvalue("sess");
            if (sid == "" || sess == "")
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 2
0
        ///   <summary>
        ///   获取验证码剩余配置
        ///   </summary>
        ///  <param name="qq">QQ账号</param>
        ///  <param name="sid">sid</param>
        ///  <param name="sess">sess</param>
        ///  <param name="cap_cd">cap_cd</param>
        ///  <param name="vsig">vsig</param>
        ///  <param name="rand_par">rand_par</param>
        ///  <param name="websig">websig</param>
        ///  <param name="y">Y坐标</param>
        /// <returns>Image</returns>
        public void LoadSlider(string qq, string sid, string sess, string cap_cd, ref string vsig, ref string rand_par, ref string websig, ref int y)
        {
            string temp = string.Empty, url = string.Empty, data = string.Empty;
            Regexs a = new Regexs();

            url  = "https://ssl.captcha.qq.com/cap_union_new_show?aid=" + Resources.aid + "&captype=&protocol=https&clientype=1&disturblevel=&apptype=2&noheader=0&color=&showtype=&fb=1&theme=&lang=2052&ua=" + Resources.ua + "&sess=" + sess + "&fwidth=0&sid=" + sid + "&uid=" + qq + "&cap_cd=" + cap_cd + "&rnd=" + GetText.GetRandom(111111, 999999) + "&forcestyle=undefined&wxLang=";
            data = WEB.GetWebData(url, ref temp, ref temp, ref temp);
            a.Matches(data, "class=13&vsig=\"\\+(.*?)\\+");
            temp = a.GetText(0, 1);
            a.Matches(data, "," + "Q" + "=\"(.*?)\"");
            vsig = a.GetText(0, 1);
            a.Matches(data, "Number\\(\"(.*?)\"");
            y = Convert.ToInt16(a.GetText(0, 1));
            a.Matches(data, "ans=\"(.*?)\"&(.*?)=");
            rand_par = a.GetText(0, 2);
            a.Matches(data, "websig=(.*?)&");
            websig = a.GetText(0, 1);
        }
Ejemplo n.º 3
0
        ///   <summary>
        ///   取滑块阴影坐标
        ///   </summary>
        ///  <param name="sess">sess</param>
        ///   <param name="sid">sid</param>
        ///   <param name="vsig">vsig</param>
        /// <returns>整数型</returns>
        public static int SliderCoordinate(string sess, string sid, string vsig, int y)
        {
            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); //查看程序耗时
            stopwatch.Start();                                                           //开始计时
            string code_img_url = "https://ssl.captcha.qq.com/cap_union_new_getcapbysig?aid=" + Resources.aid + "&clientype=2&accver=1&ua=" + Resources.ua + "&ptcz=62894169db720fee1652745b0e05d87306bd4cb4a090dc5e38c561bc680764c2&fpinfo=" + Resources.fpinfo + "&tkid=1785885581&sess=" + sess + "&theme=undefined&sid=" + sid + "&showtype=popup&fb=1&forcestyle=undefined&uid=&cap_cd=&lang=2052&rnd=" + GetText.GetRandom(111111, 999999) + "&rand=" + GetText.GenerateTimeStamp() + "&vsig=" + vsig + "&img_index=";
            Bitmap newBmp       = (Bitmap)GetImg(code_img_url + "1");
            Bitmap oldBmp       = (Bitmap)GetImg(code_img_url + "0");

            Login.F.newBmp.Image = Image.FromHbitmap(newBmp.GetHbitmap());
            Login.F.oldBmp.Image = Image.FromHbitmap(oldBmp.GetHbitmap());
            for (int i = 400; i < newBmp.Width; i++) //因为腾讯的滑块没有低于450的,为了保险填400
            {
                for (int j = y; j < y + 100; j++)    //加载验证码配置的y坐标,比实际的要小100
                {
                    //获取一个点的像素的RGB的颜色
                    Color oldColor = oldBmp.GetPixel(i, j);
                    Color newColor = newBmp.GetPixel(i, j);
                    if (Math.Abs(oldColor.R - newColor.R) > 60 || Math.Abs(oldColor.G - newColor.G) > 60 || Math.Abs(oldColor.B - newColor.B) > 60)
                    {
                        Login.F.Log.Text += String.Format("计算 X:{0} Y:{1}  计算耗时:{2}s", i, j, stopwatch.Elapsed.TotalSeconds) + Environment.NewLine;
                        return(i - 16);
                    }
                }
            }
            return(0);
        }