Beispiel #1
0
        /// <summary>
        /// 获取微信图片
        /// </summary>
        /// <param name="MsgID"></param>
        /// <param name="slave"></param>
        void _12_WEBWXGETMSGIMG(string MsgID, bool slave = false)
        {
            //&type=slave
            RecordMessage(System.Reflection.MethodBase.GetCurrentMethod().Name, null);

            Dictionary <string, string> KEYS = new Dictionary <string, string>();

            KEYS["MSGID"] = MsgID;
            KEYS["SLAVE"] = slave ? "&type=slave" : "";

            var response = WEB.SendRequest(@"GET https://wx{NUMBER}.qq.com/cgi-bin/mmwebwx-bin/webwxgetmsgimg?&MsgID={MSGID}&skey={SKEY}{SLAVE} HTTP/1.1
Host: wx.qq.com
Connection: keep-alive
Accept: image/webp,image/*,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Referer: https://wx.qq.com/
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
Cookie: pgv_pvid=5421692288; ptcz=4e0a323b1662b719e627137efa1221bb5c435b44a27cba4b09293c0e2cb57516; pt2gguin=o0007103505; pgv_pvi=1998095360; webwxuvid=2be019a311a30a82471c657deb21d97e9d1f45d435bfe8cc3c6d44572bc274f1e6b73083e1be6658fafce8b8da910d9f; pgv_si=s1289632768; MM_WX_NOTIFY_STATE=1; MM_WX_SOUND_STATE=1; mm_lang=zh_CN; wxloadtime=1452566666_expired; wxpluginkey=1452560151; wxuin=840648442; wxsid=dIBYM9GLd2uGFXUR; webwx_data_ticket=AQes8oz/tWrY4mE1SyL1tTnM

", null, KEYS);


            _12_Response(response);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="FromUserName"></param>
        /// <param name="ToUserName"></param>
        /// <param name="message"></param>
        /// <param name="type"></param>
        string _17_WEBWXUPLOADMEDIA(string filename)
        {
            var KEYS = new Dictionary <string, string>
            {
                ["id"]               = "WU_FILE_0",
                ["name"]             = Path.GetFileName(filename),
                ["type"]             = MimeMapping.GetMimeMappingByFile(filename),
                ["lastModifiedDate"] = "Thu Jan 07 2016 20:33:28 GMT+0800 (中国标准时间)",
                ["size"]             = File.ReadAllBytes(filename).Length + "",
                ["mediatype"]        = "doc"
            };

            KEYS["uploadmediarequest"] = WEB.FormatKeys(@"{""BaseRequest"":{""Uin"":{WXUIN},""Sid"":""{WXSID}"",""Skey"":""{SKEY}"",""DeviceID"":""{DEVICEID}""},""ClientMediaId"":{TIME}363,""TotalLen"":" + KEYS["size"] + @",""StartPos"":0,""DataLen"":" + KEYS["size"] + @",""MediaType"":4}");
            KEYS["webwx_data_ticket"]  = WEB["webwx_data_ticket"];
            KEYS["pass_ticket"]        = WEB["PASS_TICKET"];

            RecordMessage(System.Reflection.MethodBase.GetCurrentMethod().Name, null);

            var response = WEB.SendUpload(@"POST https://file.wx.qq.com/cgi-bin/mmwebwx-bin/webwxuploadmedia?f=json HTTP/1.1
Host: file.wx.qq.com
Connection: keep-alive
Content-Length: 3386
Origin: https://wx.qq.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryuM55vqcAjmXSlVHa
Accept: */*
Referer: https://wx.qq.com/?&lang=zh_CN
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8",
                                          filename, KEYS);

            return(_17_Response(response));
        }
        void _10_WEBWXSENDMSG(string fromUserName, string toUserName, string message, int type = 1)
        {
            var KEYS = new Dictionary <string, string>
            {
                ["FROMUSERNAME"] = toUserName,
                ["TOUSERNAME"]   = fromUserName,
                ["MSG"]          = message,
                ["TYPE"]         = type + ""
            };

            RecordMessage(message, new MessageObject {
                FromUserName = fromUserName, ToUserName = toUserName, Content = message, MsgType = 1,
            });

            var response = WEB.SendRequest(@"POST https://wx{NUMBER}.qq.com/cgi-bin/mmwebwx-bin/webwxsendmsg?lang=zh_CN&pass_ticket={PASS_TICKET} HTTP/1.1
Host: wx.qq.com
Connection: keep-alive
Content-Length: 411
Accept: application/json, text/plain, */*
Origin: https://wx.qq.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Content-Type: application/json;charset=UTF-8
Referer: https://wx.qq.com/?&lang=zh_CN
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8
Cookie: webwxuvid=bebe27f97a88e8ce573a38b4c48984e8f578650b8ba48b2bacce4ec572e41a3f2b1d021c6656cfeef62091ed7ac2c000; o_cookie=7103505; pgv_pvid=4255253068; pt_clientip=4c950af78b5036b4; pt_serverip=feef0abf0662c02f; ptui_loginuin=7103505; ptcz=6a354e61d971ccc416a5d9fa461f67c599f02d19c0bbb5cc8dad6d82c7850721; pt2gguin=o0007103505; uin=o0007103505; skey=@SVm04rrY6; qm_username=7103505; qm_sid=65f2ed6111bef5d92e7dbf710aec3449,qb3BUenJOMmtmUndFenl3MVFmaExsQkJOYmpVLWRqeC1qNG0xeGxGdDZVUV8.; pgv_pvi=9815860224; pgv_si=s1555394560; MM_WX_NOTIFY_STATE=1; MM_WX_SOUND_STATE=1; mm_lang=zh_CN; wxloadtime=1452518428_expired; wxpluginkey=1452511573; wxuin=840648442; wxsid=BJONNeerx+IW+mmH; webwx_data_ticket=AQfiPZdvOnP2C2jMbzfG7DN/


",
                                           @"{""BaseRequest"":{""Uin"":{WXUIN},""Sid"":""{WXSID}"",""Skey"":""{SKEY}"",""DeviceID"":""{DEVICEID}""},""Msg"":{""Type"":{TYPE},""Content"":""{MSG}"",""FromUserName"":""{FROMUSERNAME}"",""ToUserName"":""{TOUSERNAME}"",""LocalID"":""{TIME}"",""ClientMsgId"":""{TIME}""}}"

                                           , KEYS);

            _10_Response(response);
        }
Beispiel #4
0
        void _7_SYNCCHECK()
        {
            RecordMessage(System.Reflection.MethodBase.GetCurrentMethod().Name, null);

            bool bRun = true;

            ThreadPool.QueueUserWorkItem(new WaitCallback(delegate
            {
                while (bRun)
                {
                    try
                    {
                        var response = WEB.SendRequest(@"GET https://webpush{NUMBER}.weixin.qq.com/cgi-bin/mmwebwx-bin/synccheck?r={TIME}&skey={SKEY}&sid={WXSID}&uin={WXUIN}&deviceid={DEVICEID}&synckey={SYNCKEY}&_={TIME} HTTP/1.1
Host: webpush.weixin.qq.com
Connection: keep-alive
Accept: */*
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Referer: https://wx.qq.com/?&lang=zh_CN
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
Cookie: ts_uid=7490200750; o_cookie=7103505; pgv_pvid=4255253068; pt_clientip=4c950af78b5036b4; pt_serverip=feef0abf0662c02f; ptui_loginuin=7103505; ptcz=6a354e61d971ccc416a5d9fa461f67c599f02d19c0bbb5cc8dad6d82c7850721; pt2gguin=o0007103505; uin=o0007103505; skey=@SVm04rrY6; qm_username=7103505; qm_sid=65f2ed6111bef5d92e7dbf710aec3449,qb3BUenJOMmtmUndFenl3MVFmaExsQkJOYmpVLWRqeC1qNG0xeGxGdDZVUV8.; pgv_pvi=9815860224; pgv_si=s1555394560; webwx_data_ticket=AQfiPZdvOnP2C2jMbzfG7DN/


");
                        bRun         = _7_Response(response);
                    }
                    catch { }
                    Thread.Sleep(2000);
                }
            }));
        }
Beispiel #5
0
        /// <summary>
        /// 获取其他文件
        /// </summary>
        /// <param name="MsgID"></param>
        void _14_WEBWXGETMEDIA(string MsgID, MessageObject json)
        {
            //&type=slave
            RecordMessage(System.Reflection.MethodBase.GetCurrentMethod().Name, null);

            Dictionary <string, string> KEYS = new Dictionary <string, string>
            {
                ["MEDIAID"]  = json.MediaId,
                ["FILENAME"] = System.Web.HttpUtility.UrlEncode(json.FileName, WEB.Encoding),
                ["FROMUSER"] = json.FromUserName
            };

            var response = WEB.SendRequest(@"GET https://file{NUMBER}.wx.qq.com/cgi-bin/mmwebwx-bin/webwxgetmedia?sender={FROMUSER}&mediaid={MEDIAID}&filename={FILENAME}&fromuser={WXUIN}&pass_ticket={PASS_TICKET}&webwx_data_ticket={WEBWX_DATA_TICKET} HTTP/1.1
Host: file.wx.qq.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
Cookie: pgv_pvid=5421692288; ptcz=4e0a323b1662b719e627137efa1221bb5c435b44a27cba4b09293c0e2cb57516; pt2gguin=o0007103505; pgv_pvi=1998095360; webwxuvid=2be019a311a30a82471c657deb21d97e9d1f45d435bfe8cc3c6d44572bc274f1e6b73083e1be6658fafce8b8da910d9f; pgv_si=s1289632768; mm_lang=zh_CN; wxloadtime=1452566666_expired; wxpluginkey=1452560151; wxuin=840648442; wxsid=dIBYM9GLd2uGFXUR; webwx_data_ticket=AQes8oz/tWrY4mE1SyL1tTnM

", null, KEYS);


            _14_Response(response);
        }
Beispiel #6
0
        public string GetAuthorPage(string url)
        {
            var _url = url;

            _url = (_url.EndsWith("/")) ? _url  : _url + "/";
            return(WEB.DownloadPageSilent(_url));
        }
Beispiel #7
0
        ///// <summary>
        ///// Обновляет информацию о произведениях автора.
        ///// Адрес берется из поля author.URL.
        ///// </summary>
        ///// <exception <exception cref="System.Exception">Когда страница не загружена</exception>
        ///// <returns>true-есть новые произведения, false-нет</returns>
        //public bool UpdateAuthor()
        //{
        //    bool retValue;
        //    if (!URL.EndsWith("indexdate.shtml"))
        //        URL = (URL.EndsWith("/"))
        //                  ? URL + "indexdate.shtml"
        //                  : URL + "/indexdate.shtml";

        //    byte[] buffer = WEB.DownloadPageSilent(URL);
        //    if (buffer != null)
        //    {
        //        retValue = UpdateAuthorInfo(WEB.ConvertPage(buffer));
        //    }
        //    else
        //    {
        //        throw new Exception(string.Format("Недоступна страница '{0}'", Name));
        //    }

        //    return retValue;
        //}

        public string GetAuthorPage()
        {
            string url = URL;

            if (!url.EndsWith("indexdate.shtml"))
            {
                url = (url.EndsWith("/")) ? URL + "indexdate.shtml" : URL + "/indexdate.shtml";
            }

            return(WEB.DownloadPageSilent(url));
        }
Beispiel #8
0
        public string GetAuthorPage(string url)
        {
            var _url = url;

            if (!_url.EndsWith("indexdate.shtml") && !_url.EndsWith("indextitle.shtml"))
            {
                _url = (_url.EndsWith("/")) ? url + "indextitle.shtml" : url + "/indextitle.shtml";
            }

            return(WEB.DownloadPageSilent(_url));
        }
 public void Start()
 {
     if (_isDownloading)
     {
         return;
     }
     _isDownloading = true;
     _client        = null;
     _stop          = false;
     Logger.Add(string.Format("Запущена закачка книги '{0}'.", AuthorText.Name));
     WEB.DownloadPageSilent(AuthorText.GetFullLink(_author), Progress, Complete);
 }
Beispiel #10
0
        void _4_Response(LxwResponse o)
        {
            var value = o.Value;

            if (value.IndexOf("pass_ticket") == -1)
            {
                throw new Exception("没有得到wxsid信息" + value);
            }

            var weixin = Xml2Json <WeiXinTicket>(value);

            //存储数据
            WEB.Add(SKEY, weixin.skey);
            WEB.Add(WXSID, weixin.wxsid);
            WEB.Add(WXUIN, weixin.wxuin);
            WEB.Add(PASS_TICKET, weixin.pass_ticket);
        }
        MemberItem[] _6_WEBWXGETCONTACT()
        {
            RecordMessage(System.Reflection.MethodBase.GetCurrentMethod().Name, null);
            var response = WEB.SendRequest(@"GET https://wx{NUMBER}.qq.com/cgi-bin/mmwebwx-bin/webwxgetcontact?lang=zh_CN&pass_ticket={PASS_TICKET}&r={TIME}&seq=0&skey={SKEY} HTTP/1.1
Host: wx.qq.com
Connection: keep-alive
Accept: application/json, text/plain, */*
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Referer: https://wx.qq.com/?&lang=zh_CN
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
Cookie: pgv_pvid=5421692288; ptcz=4e0a323b1662b719e627137efa1221bb5c435b44a27cba4b09293c0e2cb57516; pt2gguin=o0007103505; pgv_pvi=1998095360; webwxuvid=2be019a311a30a82471c657deb21d97e9d1f45d435bfe8cc3c6d44572bc274f1e6b73083e1be6658fafce8b8da910d9f; pgv_si=s1289632768; wxpluginkey=1452474574; MM_WX_NOTIFY_STATE=1; MM_WX_SOUND_STATE=1; wxuin=840648442; wxsid=+tGm0ywQU38jT5PG; wxloadtime=1452502754; mm_lang=zh_CN; webwx_data_ticket=AQd2WpESNN3Z2JoHNxnridSy


");

            return(_6_Response(response));
        }
Beispiel #12
0
        void _1_JSLOGIN()
        {
            RecordMessage(System.Reflection.MethodBase.GetCurrentMethod().Name, null);

            var response = WEB.SendRequest(@"GET https://login.weixin.qq.com/jslogin?appid={APPID}&redirect_uri=https%3A%2F%2Fwx.qq.com%2Fcgi-bin%2Fmmwebwx-bin%2Fwebwxnewloginpage&fun=new&lang=zh_CN&_=1452483004640 HTTP/1.1
Host: login.weixin.qq.com
Connection: keep-alive
Accept: */*
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Referer: https://wx.qq.com/?&lang=zh_CN
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
Cookie: pgv_pvid=5421692288; ptcz=4e0a323b1662b719e627137efa1221bb5c435b44a27cba4b09293c0e2cb57516; pt2gguin=o0007103505; pgv_pvi=1998095360; pgv_si=s9303685120

");

            _1_Response(response);
        }
Beispiel #13
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);
        }
Beispiel #14
0
        bool _3_Response(LxwResponse o)
        {
            var result = o.Value;

            if (result.IndexOf("window.redirect_uri=") != -1)
            {
                var redirect_uri = SearchKey(result, "redirect_uri", "\"(.*?)\"");
                WEB.Add(REDIRECT_URL, redirect_uri);

                WEB.Add(NUMBER, "");
                if (redirect_uri.IndexOf("wx2.qq.com") != -1)
                {
                    WEB.Add(NUMBER, "2");
                }
                return(true);
            }
            return(false);
        }
Beispiel #15
0
        byte[] _2_QRCODE()
        {
            RecordMessage(System.Reflection.MethodBase.GetCurrentMethod().Name, null);

            var response = WEB.SendRequest(@"GET https://login.weixin.qq.com/qrcode/{UUID} HTTP/1.1
Host: login.weixin.qq.com
Connection: keep-alive
Accept: image/webp,image/*,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Referer: https://wx.qq.com/?&lang=zh_CN
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
Cookie: pgv_pvid=5421692288; ptcz=4e0a323b1662b719e627137efa1221bb5c435b44a27cba4b09293c0e2cb57516; pt2gguin=o0007103505; pgv_pvi=1998095360; pgv_si=s9303685120


");

            return(_2_Response(response));
        }
Beispiel #16
0
        ///   <summary>
        ///   提交验证码
        ///   </summary>
        ///  <param name="qq">QQ账号</param>
        ///  <param name="sess">sess</param>
        ///  <param name="sid">sid</param>
        ///  <param name="cap_cd">cap_cd</param>
        ///  <param name="vsig">vsig</param>
        ///  <param name="x">x坐标</param>
        ///  <param name="y">y坐标</param>
        ///  <param name="rand_par">rand_par</param>
        ///  <param name="data">data</param>
        ///  <param name="websig">websig</param>
        ///  <param name="cdata">cdata</param>
        ///  <param name="ticket">ticket</param>
        /// <returns>文本型</returns>
        public string SubmissionCode(string qq, string sess, string sid, string cap_cd, string vsig, string x, string y, string rand_par, string data, string websig, string cdata, ref string ticket)
        {
            Json   json = new Json();
            string url, PostData, temp = "";

            url      = "https://ssl.captcha.qq.com/cap_union_new_verify";
            PostData = "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 + "&subsid=6&uid=" + qq + "&cap_cd=" + cap_cd + "&rnd=411109&forcestyle=undefined&wxLang=&TCapIframeLoadTime=9&prehandleLoadTime=36&createIframeStart=1530521827025&tcScale=1&rand=0.8450369252791015&subcapclass=13&vsig=" + vsig + "&ans=" + x + "," + y + ";&" + rand_par + "=" + data + "&websig=" + websig + "&cdata=" + cdata + "&fpinfo=" + Resources.fpinfo + "&tlg=1&vlg=0_0_0&vmtime=_&vmData=";
            PostData = WEB.GetWebData(url, ref temp, ref temp, ref temp, "POST", temp, temp, PostData);
            json.Analysis(PostData);
            ticket = json.Getvalue("ticket");
            if (json.Getvalue("randstr") != "")
            {
                return(json.Getvalue("randstr"));
            }
            else
            {
                return(PostData);
            }
        }
Beispiel #17
0
        ///   <summary>
        ///   登录
        ///   </summary>
        ///  <param name="qq">QQ账号</param>
        ///  <param name="password">QQ密码</param>
        ///  <param name="code">验证码</param>
        ///  <param name="tv">ticket 或者 verify(需要滑块验证码的时候填ticket)</param>
        ///  <param name="cookie">登录成功或失败返回的cookie</param>
        ///  <param name="is_need_code">如果经过滑块了就填真(与tv一个性质)</param>
        /// <returns>文本型</returns>
        public string Login(string qq, string password, string code, string tv, ref string cookie, bool is_need_code)
        {
            string url, p, data, temp = string.Empty;

            p = PasswordEncryption(qq, password, code);
            if (is_need_code)
            {
                url = "https://ssl.ptlogin2.qq.com/login?verifycode=" + code.ToUpper() + "&u=" + qq + "&p=" + p + "&pt_randsalt=2&ptlang=2052&low_login_enable=1&low_login_hour=720&u1=https%3A%2F%2Fw.mail.qq.com%2Fcgi-bin%2Flogin%3Fvt%3Dpassport%26vm%3Dwsk%26delegate_url%3D%26f%3Dxhtml%26target%3D%26ss%3D1&from_ui=1&fp=loginerroralert&device=2&aid=" + Resources.aid + "&daid=4&pt_3rd_aid=0&ptredirect=1&h=1&g=1&pt_uistyle=9&regmaster=&pt_vcode_v1=1&pt_verifysession_v1=" + tv + "&";

                data = WEB.GetWebData(url, ref temp, ref temp, ref cookie);
                return(data);
            }
            else
            {
                url  = "https://ssl.ptlogin2.qq.com/login?pt_vcode_v1=0&pt_verifysession_v1=" + tv + "&verifycode=" + code.ToUpper() + "&u=" + qq + "&p=" + p + "&pt_randsalt=2&ptlang=2052&low_login_enable=1&low_login_hour=720&u1=https%3A%2F%2Fw.mail.qq.com%2Fcgi-bin%2Flogin%3Fvt%3Dpassport%26vm%3Dwsk%26delegate_url%3D%26f%3Dxhtml%26target%3D%26ss%3D1&from_ui=1&fp=loginerroralert&device=2&aid=" + Resources.aid + "&daid=4&pt_3rd_aid=0&ptredirect=1&h=1&g=1&pt_uistyle=9&regmaster=&";
                data = WEB.GetWebData(url, ref temp, ref temp, ref cookie);
                return(data);
            }
        }
Beispiel #18
0
        void _4_REDIRECT_URL()
        {
            RecordMessage(System.Reflection.MethodBase.GetCurrentMethod().Name, null);

            var response = WEB.SendRequest(@"GET {REDIRECT_URL} HTTP/1.1
Host: wx.qq.com
Connection: keep-alive
Accept: application/json, text/plain, */*
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Referer: https://wx.qq.com/?&lang=zh_CN
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
Cookie: pgv_pvid=5421692288; ptcz=4e0a323b1662b719e627137efa1221bb5c435b44a27cba4b09293c0e2cb57516; pt2gguin=o0007103505; pgv_pvi=1998095360; webwxuvid=2be019a311a30a82471c657deb21d97e9d1f45d435bfe8cc3c6d44572bc274f1e6b73083e1be6658fafce8b8da910d9f; pgv_si=s9303685120; wxloadtime=1452481173_expired; wxpluginkey=1452474574; wxuin=840648442; mm_lang=zh_CN; MM_WX_NOTIFY_STATE=1; MM_WX_SOUND_STATE=1



");

            _4_Response(response);
        }
Beispiel #19
0
        void _5_Response(LxwResponse o)
        {
            var login = JsonConvert.DeserializeObject <WEBWXINITRootObject>(o.Value);

            if (login.BaseResponse.Ret != 0)
            {
                throw new Exception("没有返回正确的数据,webwxinit错误!");
            }

            // USER_INFO
            LoginUser = login.User;

            WEB.Add(SYNCKEY, string.Join("|", login.SyncKey.List.Select(kv => $"{kv.Key}_{kv.Val}")));
            WEB.Add(SYNCKEY_LONG, JsonConvert.SerializeObject(login.SyncKey));

            foreach (var item in login.ContactList.Where(c => string.IsNullOrEmpty(c.KeyWord)).OrderByDescending(c => c.ContactFlag))
            {
                USER_DI.Add((item.UserName, item));
            }
        }
Beispiel #20
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);
            }
        }
Beispiel #21
0
 public MainWindow()
 {
     InitializeComponent();
     Field.status       = status;
     data               = new WEB(this);
     Field.web          = data;
     per.LabelFormatter = x => x + "%";
     otr.LabelFormatter = x => x + "%";
     qr.LabelFormatter  = x => x + "%";
     oee.LabelFormatter = x => x + "%";
     try
     {
         slide.Interval = TimeSpan.FromSeconds(1);
         slide.Tick    += ExSlide;
         slide.Start();
         data.getAllData(false);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
Beispiel #22
0
        void _5_WEBWXINIT()
        {
            RecordMessage(System.Reflection.MethodBase.GetCurrentMethod().Name, null);

            var response = WEB.SendRequest(@"POST https://wx{NUMBER}.qq.com/cgi-bin/mmwebwx-bin/webwxinit?r=-784058664&lang=zh_CN&pass_ticket={PASS_TICKET} HTTP/1.1
Host: wx.qq.com
Connection: keep-alive
Content-Length: 148
Accept: application/json, text/plain, */*
Origin: https://wx.qq.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Content-Type: application/json;charset=UTF-8
Referer: https://wx.qq.com/?&lang=zh_CN
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8
Cookie: pgv_pvid=5421692288; ptcz=4e0a323b1662b719e627137efa1221bb5c435b44a27cba4b09293c0e2cb57516; pt2gguin=o0007103505; pgv_pvi=1998095360; webwxuvid=2be019a311a30a82471c657deb21d97e9d1f45d435bfe8cc3c6d44572bc274f1e6b73083e1be6658fafce8b8da910d9f; pgv_si=s9303685120; wxpluginkey=1452474574; MM_WX_NOTIFY_STATE=1; MM_WX_SOUND_STATE=1; wxuin=840648442; wxsid=5D8s8i5gHhv7JbGO; wxloadtime=1452483021; mm_lang=zh_CN; webwx_data_ticket=AQfq+7neXON/cnHqx9WtuaT/
",

                                           @"{""BaseRequest"":{""Uin"":""{WXUIN}"",""Sid"":""{WXSID}"",""Skey"":""{SKEY}"",""DeviceID"":""{DEVICEID}""}}");

            _5_Response(response);
        }
Beispiel #23
0
        void _8_Response(LxwResponse o)
        {
            var value = o.Value;

            if (value.IndexOf("\"SyncKey\": ") == -1)
            {
                throw new Exception("SyncKey 没有捕获到");
            }

            var root = JsonConvert.DeserializeObject <SyncRoot>(value);

            if (root.SyncKey != null && root.SyncKey.Count != null)
            {
                WEB.Add(SYNCKEY_LONG, JsonConvert.SerializeObject(root.SyncKey));
            }
            foreach (var item in root.AddMsgList)
            {
                var content = item.Content.Replace("&gt;", ">").Replace("&lt;", "<").Replace("<br/>", "");
                //处理消息
                _9_DoMessage(content, item, item.MsgId);
            }
        }
Beispiel #24
0
    private void Init(StartMessage start)
    {
        for (int i = 0; i < start.Peers.Length; i++)
        {
            GameObject Player = Instantiate(PlayerPrefab);
            Player.GetComponent <Player>().ID = start.Peers[i];
        }

        if (WEB.HOST == WEB.ID)
        {
            float pie = Mathf.PI * 2 / start.Peers.Length;

            for (int i = 0; i < start.Peers.Length; i++)
            {
                WEB.Broadcast(new AssignMessage()
                {
                    Position = new Vector3(Mathf.Cos(pie * i), 0, Mathf.Sin(pie * i)) * 10,
                    Target   = start.Peers[i],
                    Type     = PeerMessageType.ASSIGN
                }, new string[] { });
            }
        }
    }
Beispiel #25
0
        ///   <summary>
        ///   是否需要验证码
        ///   </summary>
        ///  <param name="qq">QQ号</param>
        ///   <param name="cap_cd">cap_cd</param>
        ///   <param name="code">code</param>
        ///  <param name="verify">verify</param>
        /// <returns>逻辑型</returns>
        public bool Is_Code(string qq, ref string cap_cd, ref string code, ref string verify)
        {
            string url  = "https://ssl.ptlogin2.qq.com/check?pt_tea=2&uin=" + qq + "&appid=" + Resources.aid + "&ptlang=2052&regmaster=&pt_uistyle=9&r=" + GetText.GenerateTimeStamp() + "&pt_jstoken=1468653375";
            string temp = string.Empty;

            temp = WEB.GetWebData(url, ref temp, ref temp, ref temp);

            string [] data = GetText.TextMiddle(temp, "ptui_checkVC(", ")", 0).Replace("'", "").Split(',');
            if (data[0] == "0")
            {
                code   = data[1];
                verify = data[3];
                return(false);
            }
            else if (data[0] == "1")
            {
                cap_cd = data[1];
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #26
0
        void _8_WEBWXSYNC()
        {
            //_ShowMessage(System.Reflection.MethodInfo.GetCurrentMethod().Name);
            var response = WEB.SendRequest(@"POST https://wx{NUMBER}.qq.com/cgi-bin/mmwebwx-bin/webwxsync?sid={WXSID}&skey={SKEY}&lang=zh_CN&pass_ticket={PASS_TICKET} HTTP/1.1
Host: wx.qq.com
Connection: keep-alive
Content-Length: 301
Accept: application/json, text/plain, */*
Origin: https://wx.qq.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Content-Type: application/json;charset=UTF-8
Referer: https://wx.qq.com/?&lang=zh_CN
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8
Cookie: webwxuvid=bebe27f97a88e8ce573a38b4c48984e8f578650b8ba48b2bacce4ec572e41a3f2b1d021c6656cfeef62091ed7ac2c000; o_cookie=7103505; pgv_pvid=4255253068; pt_clientip=4c950af78b5036b4; pt_serverip=feef0abf0662c02f; ptui_loginuin=7103505; ptcz=6a354e61d971ccc416a5d9fa461f67c599f02d19c0bbb5cc8dad6d82c7850721; pt2gguin=o0007103505; uin=o0007103505; skey=@SVm04rrY6; qm_username=7103505; qm_sid=65f2ed6111bef5d92e7dbf710aec3449,qb3BUenJOMmtmUndFenl3MVFmaExsQkJOYmpVLWRqeC1qNG0xeGxGdDZVUV8.; pgv_pvi=9815860224; pgv_si=s1555394560; MM_WX_NOTIFY_STATE=1; MM_WX_SOUND_STATE=1; wxuin=840648442; wxsid=BJONNeerx+IW+mmH; wxloadtime=1452518428; mm_lang=zh_CN; webwx_data_ticket=AQfiPZdvOnP2C2jMbzfG7DN/



",
                                           @"{""BaseRequest"":{""Uin"":{WXUIN},""Sid"":""{WXSID}"",""Skey"":""{SKEY}"",""DeviceID"":""{DEVICEID}""},""SyncKey"":{SYNCKEY_LONG},""rr"":{TIME}}"
                                           );

            _8_Response(response);
        }
Beispiel #27
0
        bool _3_LOGIN()
        {
            for (int i = 0; i < LOGIN_TRY_TIMES; i++)
            {
                RecordMessage(System.Reflection.MethodBase.GetCurrentMethod().Name, null);
                var response = WEB.SendRequest(@"GET https://login.weixin.qq.com/cgi-bin/mmwebwx-bin/login?loginicon=true&uuid={UUID}&tip=0&r=-784071163&_={TIME} HTTP/1.1
Host: login.weixin.qq.com
Connection: keep-alive
Accept: */*
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Referer: https://wx.qq.com/?&lang=zh_CN
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8
Cookie: pgv_pvid=5421692288; ptcz=4e0a323b1662b719e627137efa1221bb5c435b44a27cba4b09293c0e2cb57516; pt2gguin=o0007103505; pgv_pvi=1998095360; pgv_si=s9303685120
");

                if (_3_Response(response))
                {
                    return(true);
                }
                System.Threading.Thread.Sleep(SAOMIAO_SLEEPTIME);
            }
            return(false);
        }
Beispiel #28
0
        void _1_Response(LxwResponse o)
        {
            var value = SearchKey(o.Value, "200", "\"(.*?)\"");

            WEB.Add(UUID, value);
        }
        private void Complete(object sender, DownloadDataCompletedEventArgs e)
        {
            WebClient client = (WebClient)sender;

            client.DownloadDataCompleted   -= Complete;
            client.DownloadProgressChanged -= Progress;

            DownloadTextHelper.Remove(this);

            if ((e != null) && e.Cancelled)
            {
                Logger.Add(string.Format("Загрузка книги '{0}' прервана.", AuthorText.Name));
            }
            else if ((e != null) && (e.Error != null))
            {
                Logger.Add(e.Error.StackTrace, false, true);
                Logger.Add(e.Error.Message, false, true);
                Logger.Add(string.Format("Ошибка при загрузке книги '{0}'.", AuthorText.Name), true, true);
            }

            if ((e != null) && (e.Error == null) && (!e.Cancelled))
            {
                Text = (e.Result != null) ? WEB.ConvertPage(e.Result) : null;
                if (Text != null)
                {
                    Text = PostProcess(Text);
                    if (!Directory.Exists(Path.GetDirectoryName(GetCachedFileName())))
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(GetCachedFileName()));
                    }

                    // надо проверить разницу с предыдущим текстом
                    // для этого ищем предыдущий файл и сравниваем с ним, результат пишем в отдельный файл
                    #region Вычисление изменений в тексте файла

                    string CachedFileName = Path.GetFileNameWithoutExtension(GetCachedFileName());
                    // делаем так, потому что имя файла может поменяться. Мы ориентируемся на последний вариант в предположении,
                    // что автор обновляет проду, а не перезаливает с новым именем
                    // убираем штамп времени
                    string[] name_parts = CachedFileName.Split(".".ToCharArray());
                    if (name_parts.Length > 1)
                    {
                        string CachedFileNameWithoutTimeMask = "";
                        for (int i = 0; i < name_parts.Length - 1; i++)
                        {
                            CachedFileNameWithoutTimeMask = CachedFileNameWithoutTimeMask +
                                                            ((CachedFileNameWithoutTimeMask == "") ? name_parts[i] : "." + name_parts[i]);
                        }
                        CachedFileNameWithoutTimeMask = CachedFileNameWithoutTimeMask + ".";
                        // берем последний закачанный файл
                        var files = from f in Directory.GetFiles(Path.GetDirectoryName(GetCachedFileName()))
                                    where Path.GetFileName(f).ToLower().StartsWith(CachedFileNameWithoutTimeMask.ToLower()) &&
                                    Path.GetFileName(f).ToLower().EndsWith(".shtml")
                                    orderby f
                                    select f;
                        string last_file = "";
                        if (files.Count() > 0)
                        {
                            last_file = files.Last();
                        }

                        // если такой есть, то проведем сравнение
                        #region код вычисления различий
                        // если текст больше 150 кило - небудем находить различия, ибо медленно
                        if (Text.Length < 150 * 1024)
                        {
                            if (!string.IsNullOrEmpty(last_file))
                            {
                                // засунем вычисления в отдельный поток, так как это медленная операция
                                System.ComponentModel.BackgroundWorker bw = new System.ComponentModel.BackgroundWorker();
                                bw.DoWork += (o, e1) =>
                                {
                                    Logger.Add(string.Format("Нахождение различий в обновлении книги '{0}'.", AuthorText.Name));
                                    Helpers.HtmlDiff diff      = new Helpers.HtmlDiff(File.ReadAllText(last_file, Encoding.GetEncoding(1251)), Text);
                                    string           diff_file = "";
                                    try
                                    {
                                        diff_file = diff.Build();
                                    }
                                    catch
                                    { }
                                    if (!string.IsNullOrEmpty(diff_file))
                                    {
                                        diff_file = diff_file.Replace("<head>", "<head><STYLE type=\"text/css\">table {border:1px solid #d9d9d9;} td {border:1px solid #d9d9d9; padding:3px;} ins {background-color: #00542E;text-decoration:inherit;} del {color: #999;	background-color:#FEC8C8;} ins.mod { background-color: #FFE1AC; }</STYLE>");
                                        File.WriteAllText(
                                            Path.Combine(Path.GetDirectoryName(GetCachedFileName()), CachedFileName + "_diff.shtml"),
                                            diff_file, Encoding.GetEncoding(1251));
                                        AuthorText.UpdateHasDiff(_author);
                                    }
                                    Logger.Add(string.Format("Файл различий в обновлении книги '{0}' сформирован.", AuthorText.Name));
                                };
                                bw.RunWorkerAsync();
                            }
                        }
                        else
                        {
                            Logger.Add(string.Format("Нахождение различий в обновлении книги '{0}' не будет произведено, оазмер превышает 150кб.", AuthorText.Name));
                        }
                        #endregion
                    }


                    #endregion


                    File.WriteAllText(GetCachedFileName(), Text, Encoding.GetEncoding(1251));
                    Logger.Add(string.Format("Книга '{0}' закачана.", AuthorText.Name));
                }
            }
            if (DownloadTextComplete != null)
            {
                DownloadTextComplete(this, e);
            }
        }
Beispiel #30
0
        public static Author AddAuthor(string url)
        {
            _logger.Add("Добавление автора...");
            // Перевести URL на samlib.ru
            url = url.ToLowerInvariant().Replace("zhurnal.lib.ru", "samlib.ru");

            // аналог DoEvents в WPF, иначе "Добавление автора..." вообще не появляется, т.к. метод синхронный
            Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { }));

            if (!url.StartsWith("http://") && !url.StartsWith("https://"))
            {
                url = "http://" + url;
            }

            Sites.ISite site = Sites.SitesDetector.GetSite(url);

            if (site == null)
            {
                _logger.Add("Указан незнакомый адрес/домен/протокол.", true, true);
                return(null);
            }


            // Если URL заканчивается на index.shtml, преобразовать его в нужный)
            url = site.PrepareAuthorUrlOnAdding(url);


            Author author = Authors.FindAuthor(url);

            if (author != null)
            {
                _logger.Add("Этот автор уже присутствует в списке", true, true);
                return(author);
            }

            try
            {
                string pageContent = WEB.DownloadPageSilent(url);
                if (pageContent == null)
                {
                    _logger.Add("Не удалось открыть страницу автора", true, true);
                    return(null);
                }


                string   authorName = "";
                DateTime updateDate = DateTime.MinValue;
                site.GetAuthorCredentials(pageContent, out authorName, out updateDate);
                //int index = pageContent.IndexOf('.', pageContent.IndexOf("<title>")) + 1;
                //string authorName = pageContent.Substring(index, pageContent.IndexOf('.', index) - index);
                //DateTime updateDate = GetUpdateDate(pageContent);

                if (updateDate == DateTime.MinValue)
                {
                    _logger.Add("Не удалось получить дату со страницы автора", true, true);
                    return(null);
                }
                if (authorName.Trim() == "")
                {
                    _logger.Add("Не удалось получить имя автора", true, true);
                    return(null);
                }
                author = new Author {
                    Name = authorName, IsNew = false, UpdateDate = updateDate, URL = url
                };


                author.CheckID();// генерим id
                Authors.Add(author);
                author.UpdateAuthorInfo(pageContent, SynchronizationContext.Current);
                _logger.Add("Добавлен: " + author.Name);
                author.Changed = true;
            }
            catch (Exception ex)
            {
                _logger.Add(ex.StackTrace, false, true);
                _logger.Add(ex.Message, false, true);
                _logger.Add("Необработанная ошибка при добавлении автора", true, true);
            }
            return(author);
        }