Exemple #1
0
        /// <summary>
        /// 允许登录
        /// </summary>
        public void Waitinglogin(string s)
        {
            for (int i = 0; i < 1;)
            {
                s   = HttpHelps.Get(Encoding.UTF8, "https://wx.qq.com/cgi-bin/mmwebwx-bin/login?loginicon=true&uuid=" + uuid + "&tip=0&r=-757158328&_=1491110788887", ref cookie);
                uri = function.middlestring(s.ToString(), "redirect_uri=\"", "\"");
                if (uri.IndexOf("qq.com") != -1)
                {
                    domain    = "http://wx2.qq.com";
                    heartbeat = "https://webpush.wx2.";
                    file      = "https://file.wx2.qq.com";
                    Err       = "https://wx2.qq.com";
                    if (uri.IndexOf("https://wx.qq.com") != -1)
                    {
                        domain    = "http://wx.qq.com";
                        heartbeat = "https://webpush.wx.";
                        file      = "https://file.wx.qq.com";
                        Err       = "https://wx.qq.com";
                    }
                    i = i + 1;
                }
                Thread.Sleep(500);
            }
            //开始获取登陆秘钥

            Thread th = new Thread(new ThreadStart(delegate { GetKey(uri); }));

            th.IsBackground = true;
            th.Start();
            //手机确认登陆事件
            if (cl != null)
            {
                cl();
            }
        }
Exemple #2
0
 /// <summary>
 /// 获取视频
 /// </summary>
 /// <param name="MsgID"></param>
 /// <returns></returns>
 public string Getvideo(string MsgID)
 {
     uri = domain + "/cgi-bin/mmwebwx-bin/webwxgetvideo?msgid=" + MsgID + "&skey=" + skey;
     byte[] bs64 = HttpHelps.HttpDownloadFile(uri, cookie);
     //File.WriteAllBytes();
     return(Convert.ToBase64String(bs64));
 }
        /// <summary>
        /// 获取验证码
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static string GetValidateCode(string url, CookieContainer webCookie, out Bitmap bmpImage)
        {
            try
            {
                //获取验证码
                Image HeadImage = HttpHelps.GetPicture(url, webCookie);

                //处理图片
                Bitmap bitmap = new Bitmap(HeadImage);

                UnCodebase ud = new UnCodebase(bitmap);
                ud.GrayByPixels();
                ud.ClearNoise(128, 2);

                //识别验证码
                tessnet2.Tesseract ocr = new tessnet2.Tesseract();                   //声明一个OCR类
                ocr.SetVariable("tessedit_char_whitelist", "0123456789");            //设置识别变量,当前只能识别数字。
                ocr.Init(Application.StartupPath + @"\\tmpe", "eng", true);          //应用当前语言包。
                List <tessnet2.Word> result = ocr.DoOCR(ud.bmpobj, Rectangle.Empty); //执行识别操作
                string validateCode         = result[0].Text;

                //pictureBox1.Image = ud.bmpobj;
                bmpImage = ud.bmpobj;
                return(validateCode);
            }
            catch (Exception ex)
            {
                function.log("验证码获取错误" + ex.Message);
                bmpImage = null;
                return("");
            }
        }
Exemple #4
0
        /// <summary>
        /// 获取余额
        /// </summary>
        /// <returns></returns>
        public static decimal getYuE(string url, CookieContainer webCookie)
        {
            decimal keYongJinE = 0;

            try
            {
                string resultCredits = HttpHelps.Post("LT=1", url + "/user/Refresh_Credits.aspx?_=" + DateTime.Now.Ticks, webCookie,
                                                      Encoding.Default);
                string credits = function.middlestring(resultCredits, "Current_Credits_kc\":", "}");
                if (credits.Length < 16)
                {
                    keYongJinE = decimal.Parse(credits);
                }
                else
                {
                    keYongJinE = -1;
                }
            }
            catch (Exception ex)
            {
                function.log("顺丰获取余额失败" + ex.Message);
                keYongJinE = -1;
            }

            return(keYongJinE);
        }
Exemple #5
0
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            string s = HttpHelps.Post("Account=" + textBox1.Text + "&Password="******"&Machine=" + textBox3.Text,
                                      ShouQuanServer + "/api/auth/regclient", ref ck, Encoding.UTF8);

            if (s == "")
            {
                MessageBox.Show("连接服务器失败!");
            }
            string zt = function.middlestring(s, "Status\":", ",");

            if (zt == "0")
            {
                MessageBox.Show("注册成功->已向管理员发送授权申请!");
            }
            if (zt == "-1")
            {
                MessageBox.Show("非法数据!");
            }
            if (zt == "1")
            {
                MessageBox.Show("数据验证错误!");
            }
            if (zt == "2")
            {
                MessageBox.Show("帐号已存在!");
            }
        }
Exemple #6
0
        /// <summary>
        /// 扫二维码
        /// </summary>
        public void Scanning()
        {
            while (true)
            {
                /// MessageBox.Show("https://login.wx.qq.com/cgi-bin/mmwebwx-bin/login?loginicon=true&uuid=" + uuid + "&tip=0&r=-755502095&_=1491109138225");
                s = HttpHelps.Get(Encoding.Default, "http://login.wx.qq.com/cgi-bin/mmwebwx-bin/login?loginicon=true&uuid=" + uuid + "&tip=0&r=-755502095&_=1491109138225", ref cookie);

                if (function.middlestring(s, "code=", ";") == "201")
                {
                    HeadImageBase64 = function.middlestring(s, "base64,", "'");
                    if (HeadImageBase64 != "")
                    {
                        HeadImage = function.Base64ToImage(HeadImageBase64);
                    }
                    if (SetImage != null)
                    {
                        SetImage(HeadImage);
                    }
                    Waitinglogin(s);
                    return;
                }
                if (function.middlestring(s, "code=", ";") == "200")
                {
                    Waitinglogin(s);
                    return;
                }
            }
        }
Exemple #7
0
 /// <summary>
 /// 备注
 /// </summary>
 /// <param name="username"></param>
 public void beizhu(string UserName, string RemarkName)
 {
     string ls   = cookie;
     string uri  = domain.Replace("http", "https") + "/cgi-bin/mmwebwx-bin/webwxoplog?lang=zh_CN&pass_ticket=" + pass_ticket;
     string Date = "{\"UserName\":\"" + UserName + "\",\"CmdId\":2,\"RemarkName\":\"" + RemarkName + "\",\"BaseRequest\":{\"Uin\":" + wxuin + ",\"Sid\":\"" + wxsid + "\",\"Skey\":\"" + skey + "\",\"DeviceID\":\"" + DeviceID() + "\"}}";
     string s    = HttpHelps.Post(Date, uri, ref ls, Encoding.UTF8);
 }
Exemple #8
0
        /// <summary>
        /// 尝试下注
        /// </summary>
        /// <param name="s_uPI_ID"></param>
        /// <param name="s_uPI_ID"></param>
        /// <param name="s_uPI_P"></param>
        /// <param name="s_uPI_M"></param>
        /// <returns></returns>
        private static bool postXiaZhu(string url, CookieContainer webCookie, string validate, string uPI_ID, string uPI_P, string uPI_M)
        {
            //获取验证
            validate = ServerShunFeng.getValidate(url, webCookie);

            string postData = "JeuValidate=" + validate + "&uPI_ID=" + uPI_ID.Substring(1)
                              + "&uPI_P=" + uPI_P.Substring(1) + "&uPI_M=" + uPI_M.Substring(1);
            string result = "";

            //JeuValidate=11271100276929&uPI_ID=73&uPI_P=1.943&uPI_M=5
            function.log("下注:" + postData);

            result = HttpHelps.Post(postData, url + "/user/L_Confirm_Jeu_cqsc.aspx", webCookie, Encoding.Default);

            //下註金額有誤!
            //下註规则有误,请重新下註,谢谢合作!


            if (result.IndexOf("下註金額有誤") > -1 || result.IndexOf("下註规则有误") > -1 || result.IndexOf("已經截止下註") > -1)
            {
                function.log("下注错误:" + result);
                return(false);
            }
            else
            {
                function.log("下注成功:" + result);
                return(true);
            }
        }
Exemple #9
0
        /// <summary>
        /// 获取离线消息推送
        /// </summary>
        public void OfflineMessage()
        {
            string uri  = domain + "/cgi-bin/mmwebwx-bin/webwxinit?pass_ticket=" + pass_ticket + "&r=" + function.MilliTime() + "&skey=" + skey;
            string Date = "{\"BaseRequest\":{\"Uin\":\"" + wxuin + "\",\"Sid\":\"" + wxsid + "\",\"Skey\":\"" + skey + "\",\"DeviceID\":\"" + DeviceID() + "\"}}";
            string s    = HttpHelps.Post(Date, uri, ref cookie, Encoding.UTF8);

            //cookie = Regex.Replace(cookie, "^[Domain].*[(GMT)|(GMT,)]$", "");

            cookie            = function.Deletetext(cookie, "Domain", "GMT").Replace("Secure,", null);
            webwx_data_ticket = "wxuin=" + wxuin + "; wxsid=" + wxsid + ";  webwx_data_ticket=" + function.middlestring(cookie, "webwx_data_ticket=", ";") + ";";

            Offline = JObject.Parse(s);

            //获取本号参数
            UserName  = Offline["User"]["UserName"].ToString();
            NickName  = Offline["User"]["NickName"].ToString();
            HeadImage = function.CreateRoundRectImage(function.SoftenImage(new Bitmap(HttpHelps.GetPicture(domain + Offline["User"]["HeadImgUrl"].ToString(), cookie))));
            session   = Offline["ContactList"];
            JToken record = Offline["SyncKey"];

            //获取POST秘钥
            SkeyPost = record.ToString();
            //获取GET秘钥
            string str = "";

            foreach (JObject jp in record["List"])
            {
                str = str + jp["Key"].ToString() + "_";
                str = str + jp["Val"].ToString() + "|";
            }
            SkeyGet = str.Substring(0, str.Length - 1);
            FriendsList(true);
        }
        /// <summary>
        /// 获取余额
        /// </summary>
        /// <returns></returns>
        public static decimal getYuE(string url, CookieContainer webCookie)
        {
            decimal keYongJinE = 0;

            try
            {
                //{"d":"[{\"Rows\":[{\"memberno\":\"ffgggg7788\",\"membername\":\"哥\",\"opena\":false,\"openb\":true,\"openc\":false,
                //\"opend\":false,\"opene\":false,\"credittype\":2,\"accounttype\":1,\"creditquota\":10.0000,\"usecreditquota\":0.00,
                //\"usecreditquota2\":0.00,\"allowcreditquota\":10.00}]},0.0000]"}
                string resultGetMembersInfo = HttpHelps.PostJson("", url + "/cp2-dfgj-mb/ch/main.aspx/GetMembersMbinfo", webCookie, Encoding.UTF8);

                string credits = function.middlestring(resultGetMembersInfo, ",\\\"creditquota\\\":", ",");
                if (credits.Length > 0)
                {
                    keYongJinE = decimal.Parse(credits);
                }
                else
                {
                    keYongJinE = -1;
                }
            }
            catch (Exception ex)
            {
                //function.log("永利获取余额失败" + ex.Message);
                keYongJinE = -1;
            }

            return(keYongJinE);
        }
Exemple #11
0
        /// <summary>
        /// 获取二维码
        /// </summary>
        public WebWeChat()
        {
            cookie = "";
            string s = Encoding.Default.GetString(HttpHelps.GetQr("https://login.weixin.qq.com/jslogin?appid=wx782c26e4c19acffb&redirect_uri="));

            uuid   = function.middlestring(s, "window.QRLogin.uuid = \"", "\";");
            QrCode = "https://login.weixin.qq.com/qrcode/" + uuid;
        }
Exemple #12
0
        /// <summary>
        /// 上传图片
        /// </summary>
        /// <param name="img"></param>
        public string send(Image img)
        {
            byte[] bt = function.ImageToBytes(img);
            string uploadmediarequest = "{\"BaseRequest\":{\"Uin\":" + wxuin + ",\"Sid\":\"" + wxsid + "\",\"Skey\":\"" + skey + "\",\"DeviceID\":\"" + DeviceID() + "\"}," +
                                        @"""ClientMediaId"":" + function.MilliTime() + ",\"TotalLen\":" + bt.Length.ToString() + ",\"StartPos\":0,\"DataLen\":" + bt.Length.ToString() + ",\"MediaType\":4}";
            Html   html = new Html(function.getImageType(img), webwx_data_ticket, uploadmediarequest, pass_ticket);
            string date = html.getdate();
            string str  = HttpHelps.HttpUploadFile1(file + "/cgi-bin/mmwebwx-bin/webwxuploadmedia?f=json", date, bt);

            return(str);
        }
Exemple #13
0
        /// <summary>
        /// 加群
        /// </summary>
        /// <param name="retcode"></param>
        /// <param name="selector"></param>
        public void jiaqun(string username, string tousername)
        {
            string ls   = cookie;
            string uri  = domain + "/cgi-bin/mmwebwx-bin/webwxupdatechatroom?fun=invitemember";
            string Date = "{\"InviteMemberList\":\"" + username + "\",\"ChatRoomName\":\"" + tousername + "\",\"BaseRequest\":{\"Uin\":" + wxuin + ",\"Sid\":\"" + wxsid + "\",\"Skey\":\"" + skey + "\",\"DeviceID\":\"" + DeviceID() + "\"}}";

            Date = Date.Replace("\r\n", "").Replace("  ", "");
            string s = "";

            s = HttpHelps.Post(Date, uri, ref ls, Encoding.UTF8);
        }
Exemple #14
0
        /// <summary>
        /// 收到消息
        /// </summary>
        /// <param name="retcode"></param>
        /// <param name="selector"></param>
        public void huidiao(string FromUserName, string ToUserName)
        {
            string ls   = cookie;
            string sjc  = function.MilliTime() + "3568";
            string uri  = domain + "/cgi-bin/mmwebwx-bin/webwxstatusnotify?lang=zh_CN&pass_ticket=" + pass_ticket;
            string Date = "{\"BaseRequest\":{\"Uin\":" + wxuin + ",\"Sid\":\"" + wxsid + "\",\"Skey\":\"" + skey + "\",\"DeviceID\":\"" + DeviceID() + "\"}" +
                          "\"Code\":1,\"FromUserName\":\"" + FromUserName + "\",\"ToUserName\":\"" + ToUserName + "\",\"ClientMsgId\":\"" + sjc + "\"}}";

            Date = Date.Replace("\r\n", "").Replace("  ", "");
            string s = HttpHelps.Post(Date, uri, ref ls, Encoding.UTF8);
        }
Exemple #15
0
        /// <summary>
        /// 撤回消息
        /// </summary>
        /// <param name="Type"></param>
        /// <param name="Content"></param>
        public string ErrMsg(string MsgID, string LocalID, string ToUserName)
        {
            string uri = Err + "/cgi-bin/mmwebwx-bin/webwxrevokemsg?lang=zh_CN&" + pass_ticket;
            string x   = function.middlestring(cookie, "wxloadtime=", ";");

            x = cookie.Replace(x, x + "_expired") + "wxpluginkey=" + function.MilliTime().Substring(0, 10) + ";";
            string Date = "{\"BaseRequest\":{\"Uin\":" + wxuin + ",\"Sid\":\"" + wxsid + "\",\"Skey\":\"" + skey + "\",\"DeviceID\":\"" + DeviceID() + "\"}," +
                          "\"SvrMsgId\":\"" + MsgID + "\",\"ToUserName\":\"" + ToUserName + "\",\"ClientMsgId\":\"" + LocalID + "\"}";
            string s = HttpHelps.Post(Date, uri, ref cookie, Encoding.UTF8);

            return(s);
        }
Exemple #16
0
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="Type"></param>
        /// <param name="Content"></param>
        public string SendMessage(string Content, string ToUserName)
        {
            //Content = Content.Replace("\\", "\\\\").Replace("\"", "\\\"");
            string uri  = domain + "/cgi-bin/mmwebwx-bin/webwxsendmsg?pass_ticket=" + pass_ticket;
            string sjc  = function.MilliTime() + "3568";
            string Date = "{\"BaseRequest\":{\"Uin\":" + wxuin + ",\"Sid\":\"" + wxsid + "\",\"Skey\":\"" + skey + "\",\"DeviceID\":\"" + DeviceID() + "\"}," +
                          "\"Msg\":{\"Type\":1,\"Content\":\"" + Content + "\",\"FromUserName\":\"" + UserName + "\",\"ToUserName\":\"" + ToUserName + "\",\"LocalID\":\"" + sjc + "\",\"ClientMsgId\":\"" + sjc + "\"}}";
            string x = function.middlestring(cookie, "wxloadtime=", ";");

            x = cookie.Replace(x, x + "_expired") + "wxpluginkey=" + function.MilliTime().Substring(0, 10) + ";";
            string s = HttpHelps.Post(Date, uri, ref x, Encoding.UTF8);

            return(s);
        }
Exemple #17
0
        /// <summary>
        /// 获取
        /// </summary>
        /// <param name="url"></param>
        /// <param name="webCookie"></param>
        /// <returns></returns>
        public static string getValidate(string url, CookieContainer webCookie)
        {
            string resultUserInfo = HttpHelps.Post("LT=1", url + "/user/L_UserInfo.aspx", webCookie, Encoding.Default);
            string jeuv           = function.middlestring(resultUserInfo, "parent.mainFrame.Update_JV(\"", "\");");

            if (jeuv.Length <= 16 && jeuv.Length > 0)
            {
                return(jeuv);
            }
            else
            {
                return("");
            }
        }
Exemple #18
0
        /// <summary>
        /// gif发送
        /// </summary>
        /// <param name="Type"></param>
        /// <param name="MediaId"></param>
        /// <param name="ToUserName"></param>
        /// <returns></returns>
        public string sendgif(string MediaId, string ToUserName)
        {
            string uri = domain + "/cgi-bin/mmwebwx-bin/webwxsendemoticon?fun=sys";
            string sjc = function.MilliTime() + "3568";

            string Date = "{\"BaseRequest\":{\"Uin\":" + wxuin + ",\"Sid\":\"" + wxsid + "\",\"Skey\":\"" + skey + "\",\"DeviceID\":\"" + DeviceID() + "\"}," +
                          "\"Msg\":{\"Type\":47,\"MediaId\":\"" + MediaId + "\",\"FromUserName\":\"" + UserName + "\",\"ToUserName\":\"" + ToUserName + "\",\"LocalID\":\"" + sjc + "\",\"ClientMsgId\":\"" + sjc + "\"}}";
            string x = function.middlestring(cookie, "wxloadtime=", ";");

            x = cookie.Replace(x, x + "_expired") + "wxpluginkey=" + function.MilliTime().Substring(0, 10) + ";";

            string s = HttpHelps.Post(Date, uri, ref x, Encoding.UTF8);

            return(function.middlestring(s, "MsgID\": \"", "\""));
        }
Exemple #19
0
        /// <summary>
        /// 初始化参数
        /// </summary>
        public void GetKey(string ur)
        {
            string s = HttpHelps.Get(Encoding.UTF8, ur.Replace("https", "http"), ref cookie);

            if (s.IndexOf("<error><ret>1203</ret>") != -1)
            {
                MessageBox.Show(function.middlestring(s, "<message>", "</message>"));
                return;
            }
            skey        = function.middlestring(s.ToString(), "<skey>", "</skey>");
            wxsid       = function.middlestring(s.ToString(), "<wxsid>", "</wxsid>");
            wxuin       = function.middlestring(s.ToString(), "<wxuin>", "</wxuin>");
            pass_ticket = function.middlestring(s.ToString(), "<pass_ticket>", "</pass_ticket>");
            OfflineMessage();
        }
Exemple #20
0
        /// <summary>
        /// 图片发送
        /// </summary>
        /// <param name="Type"></param>
        /// <param name="MediaId"></param>
        /// <param name="ToUserName"></param>
        /// <returns></returns>
        public string sendImage(string MediaId, string ToUserName)
        {
            if (!ServerCommon.isSendMessage)
            {
                return("zzzz");
            }
            string uri = domain + "/cgi-bin/mmwebwx-bin/webwxsendmsgimg?fun=async&f=json&lang=zh_CN&pass_ticket=" + pass_ticket;
            string sjc = function.MilliTime() + "3568";

            string Date = "{\"BaseRequest\":{\"Uin\":" + wxuin + ",\"Sid\":\"" + wxsid + "\",\"Skey\":\"" + skey + "\",\"DeviceID\":\"" + DeviceID() + "\"}," +
                          "\"Msg\":{\"Type\":3,\"MediaId\":\"" + MediaId + "\",\"FromUserName\":\"" + UserName + "\",\"ToUserName\":\"" + ToUserName + "\",\"LocalID\":\"" + sjc + "\",\"ClientMsgId\":\"" + sjc + "\"}}";
            string x = function.middlestring(cookie, "wxloadtime=", ";");

            x = cookie.Replace(x, x + "_expired") + "wxpluginkey=" + function.MilliTime().Substring(0, 10) + ";";

            return(HttpHelps.Post(Date, uri, ref x, Encoding.UTF8));
        }
Exemple #21
0
        /// <summary>
        /// 登陆
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            string s = HttpHelps.Post("Account=" + textBox1.Text + "&Password="******"&Machine=" + textBox3.Text + "&AuthCode=" + softReg.GetRNum(),
                                      ShouQuanServer + "/api/auth/login", ref ck, Encoding.UTF8);
            string zt = function.middlestring(s, "Status\":", ",");

            if (zt == "")
            {
                MessageBox.Show("连接服务器失败!");
            }
            if (zt == "0")
            {
                if (checkBox1.Checked)
                {
                    ConfigHelper.UpdateAppConfig("sfjz", "是");
                    ConfigHelper.UpdateAppConfig("user", textBox1.Text);
                    ConfigHelper.UpdateAppConfig("pass", textBox2.Text);
                }
                //
                string   expire   = function.middlestring(s, "Expire\":\"", "\"");
                DateTime dtExpire = new DateTime();
                DateTime.TryParse(expire, out dtExpire);
                新一城娱乐系统.FeiPan.ServerCommon.serverExpire = dtExpire;
                //
                //MessageBox.Show("登录成功,本软件仅供娱乐,禁止用于赌博,否则后果自负。");
                new QrCode("新一城娱乐系统V1.0 (有效期至:" + expire + ") 登录用户:" + textBox1.Text + "  (本软件仅供娱乐,禁止用于赌博,否则后果自负)").Show();
                this.Hide();
            }
            if (zt == "-1")
            {
                MessageBox.Show("非法数据!");
            }
            if (zt == "1")
            {
                MessageBox.Show("用户名或密码错误");
            }
            if (zt == "2")
            {
                MessageBox.Show("非授权客户端");
            }
            if (zt == "3")
            {
                MessageBox.Show("授权过期");
            }
        }
Exemple #22
0
        /// <summary>
        /// 获取图片缩略图
        /// </summary>
        /// <param name="MsgID"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public Image GetImage(string MsgID, string type)
        {
            if (type == "slave")
            {
                uri = domain + "/cgi-bin/mmwebwx-bin/webwxgetmsgimg?&MsgID=" + MsgID + "&skey=" + skey + "&type=slave";
            }

            if (type == "slaveImage")
            {
                uri = domain + "/cgi-bin/mmwebwx-bin/webwxgetmsgimg?&MsgID=" + MsgID + "&skey=" + skey;
            }

            if (type == "location")
            {
                uri = domain + "/cgi-bin/mmwebwx-bin/webwxgetpubliclinkimg?url=xxx&msgid=" + MsgID + "&pictype=location";
            }
            return(HttpHelps.GetPicture(uri, cookie));
        }
Exemple #23
0
        /// <summary>
        /// 查看消息
        /// </summary>
        public void BeingPushed(string retcode, string selector)
        {
            string ls   = cookie;
            string uri  = domain + "/cgi-bin/mmwebwx-bin/webwxsync?sid=" + wxsid + "&skey=" + skey + "&lang=zh_CN&pass_ticket=" + pass_ticket;
            string Date = "{\"BaseRequest\":{\"Uin\":" + wxuin + ",\"Sid\":\"" + wxsid + "\",\"Skey\":\"" + skey + "\",\"DeviceID\":\"" + DeviceID() + "\"},\"SyncKey\":" + SkeyPost + ",\"rr\":23522981}";

            Date = Date.Replace("\r\n", "").Replace("  ", "");
            string s = "";

            s = HttpHelps.Post(Date, uri, ref ls, Encoding.UTF8);
            if (s == "")
            {
                return;
            }
            Offline = JObject.Parse(s);
            if (Offline["AddMsgList"].ToString() == sing)
            {
                return;
            }
            sing = Offline["AddMsgList"].ToString();
            //消息处理
            if (job != null)
            {
                job(retcode, selector, Offline);
            }

            JToken record = Offline["SyncKey"];

            //设置POST所需秘钥
            SkeyPost = record.ToString();
            //设置GET所需秘钥
            string str = "";

            foreach (JObject jp in record["List"])
            {
                str = str + jp["Key"].ToString() + "_";
                str = str + jp["Val"].ToString() + "|";
            }
            if (str.Length > 1)
            {
                SkeyGet = str.Substring(0, str.Length - 1);
            }
        }
Exemple #24
0
        /// <summary>
        /// 获取群成员列表
        /// </summary>
        public List <GROUP> GETgrouplist(List <string> Date, string uriq)
        {
            List <GROUP> gro = new List <GROUP>();

            foreach (string dt in Date)
            {
                string xs = HttpHelps.Post(dt, uriq, ref cookie, Encoding.UTF8);
                foreach (JObject xxs in JObject.Parse(xs)["ContactList"])
                {
                    ///保存群成员信息
                    GROUP g = new GROUP();
                    g.UserName   = xxs["UserName"].ToString();
                    g.NickName   = xxs["NickName"].ToString();
                    g.RemarkName = xxs["RemarkName"].ToString();
                    gro.Add(g);
                }
            }
            return(gro);
        }
Exemple #25
0
        /// <summary>
        /// 心跳
        /// </summary>
        public void FeartBeat()
        {
            while (jieshu)
            {
                string uri = heartbeat + "qq.com/cgi-bin/mmwebwx-bin/synccheck?r=" + function.MilliTime() + "&skey=" + skey + "&sid=" + wxsid.Replace("+", "%2B") + "&uin=" + wxuin + "&deviceid=" + DeviceID() + "&synckey=" + SkeyGet + "&_=" + tim.ToString();
                tim++;
                string s = HttpHelps.GetQrh(uri, webwx_data_ticket);

                /*string retcode = function.middlestring(s, "retcode:\"", "\"");
                 * string selector = function.middlestring(s, "selector:\"", "\"");
                 *
                 * if (retcode == "0")
                 * {
                 *  if (int.Parse(selector) > 0)
                 *  {
                 *      //消息获取
                 *      BeingPushed(retcode, selector);
                 *  }
                 * }*/
                Thread.Sleep(1000);
            }
        }
Exemple #26
0
        /// <summary>
        /// 执行返回结果
        /// </summary>
        /// <param name="dgvrowid"> 线程号行号</param>
        /// <param name="number">循环总次数</param>
        private void PingTask(int dgvrowid, int number, string url, int time,string ip)
        {
            //获取开始时间
            DateTime st = DateTime.Now;

            //开始时间
            this.BeginInvoke(_upDateStateDelegate, st.ToString("hh:mm:ss tt zz"), dgvrowid, "开始时间");

            for (int i = 0; i < number; i++)
            {
                //获取线程开始时间
                DateTime stThread = DateTime.Now;

                try
                {
                    HttpHelps hh = new HttpHelps();
                    hh.SetWebProxy(ip);
                    //自动访问百度,主要是延长时间

                   // string strdate = hh.GetHttpRequestStringByNUll_Get(url, null);
                   string strdate = Test(ip);
                    strdate = HanlderString(strdate);
                    //当前循环次数
                    this.BeginInvoke(_upDateStateDelegate, strdate, dgvrowid, "返回结果");

                    //当前循环次数
                    this.BeginInvoke(_upDateStateDelegate, ip, dgvrowid, "ip");

                    //获取结束时间
                    DateTime et = DateTime.Now;

                    //结束时间
                    this.BeginInvoke(_upDateStateDelegate, et.ToString("hh:mm:ss tt zz"), dgvrowid, "结束时间");

                    //总用时(毫秒)
                    this.BeginInvoke(_upDateStateDelegate, ExecDateDiff(st, et), dgvrowid, "总用时(毫秒)");
                    do
                    {
                        if (stThread.AddSeconds(time) <= DateTime.Now)
                        {
                            break;
                        }
                    } while (true);
                }
                catch { }
            }
        }
Exemple #27
0
        /// <summary>
        /// 获取最新赔率
        /// </summary>
        public static peilv getPeilv(string url, CookieContainer webCookie)
        {
            string resultPeilv = "";
            peilv  serPeilv    = new peilv();

            try
            {
                function.log("获取赔率");

                //赔率
                //http://mem1.paeghe214.dqbpkj.com:88/user/xml_cqsc/Read_Multiple.aspx?LT=1&T=6&GT=2,3,5,6,8,9,11,12,14,15,16,17,18&_=1511706182975
                //http://mem1.paeghe214.dqbpkj.com:88/user/xml_cqsc/Read_Multiple.aspx?LT=1&T=24&GT=1,4,7,10,13&_=1511706183857
                resultPeilv = HttpHelps.Post("?LT=1&T=6&GT=2,3,5,6,8,9,11,12,14,15,16,17,18&_=" + function.MilliTime(),
                                             url + "/user/xml_cqsc/Read_Multiple.aspx", webCookie, Encoding.Default);
                string resultPeilv2 = HttpHelps.Post("?LT=1&T=24&GT=1,4,7,10,13&_=" + function.MilliTime(),
                                                     url + "/user/xml_cqsc/Read_Multiple.aspx", webCookie, Encoding.Default);
                // resultPeilv = "<?xml version=\"1.0\" encoding=\"gb2312\"?><update><k_qs>20171115109</k_qs><k_stat>y</k_stat><k_open_date>23:05:00</k_open_date><Stoptime>00:00:57</Stoptime><k_id>265126</k_id><Multiple_Info><m_2_11>1.943</m_2_11><m_2_12>1.943</m_2_12><m_3_13>1.943</m_3_13><m_3_14>1.943</m_3_14><m_5_25>1.943</m_5_25><m_5_26>1.943</m_5_26><m_6_27>1.943</m_6_27><m_6_28>1.943</m_6_28><m_8_39>1.943</m_8_39><m_8_40>1.943</m_8_40><m_9_41>1.943</m_9_41><m_9_42>1.943</m_9_42><m_11_53>1.943</m_11_53><m_11_54>1.943</m_11_54><m_12_55>1.943</m_12_55><m_12_56>1.943</m_12_56><m_14_67>1.943</m_14_67><m_14_68>1.943</m_14_68><m_15_69>1.943</m_15_69><m_15_70>1.943</m_15_70><m_16_71>1.943</m_16_71><m_16_72>1.943</m_16_72><m_17_73>1.943</m_17_73><m_17_74>1.943</m_17_74><m_18_75>1.943</m_18_75><m_18_76>1.943</m_18_76><m_18_77>9.26</m_18_77></Multiple_Info><Limitation_Info><i_2>第一球大小,5,50000</i_2><i_3>第一球單雙,5,50000</i_3><i_5>第二球大小,5,50000</i_5><i_6>第二球單雙,5,50000</i_6><i_8>第三球大小,5,50000</i_8><i_9>第三球單雙,5,50000</i_9><i_11>第四球大小,5,50000</i_11><i_12>第四球單雙,5,50000</i_12><i_14>第五球大小,5,50000</i_14><i_15>第五球單雙,5,50000</i_15><i_16>總和大小,5,50000</i_16><i_17>總和單雙,5,50000</i_17><i_18>龍虎,5,50000</i_18></Limitation_Info><Money_Credits>10</Money_Credits><Money_KY>10</Money_KY></update>";
                resultPeilv += resultPeilv2;

                if (resultPeilv.Length < 300)
                {
                    return(null);
                }

                string xunhao = "";

                #region 获取下注赔率

                for (int i = 0; i < 77; i++)
                {
                    //2_11 2_12 3_13 3_14
                    //5_25 5_26 6_27 6_28
                    //...
                    int     qiudao = i / 14 + 1;
                    int     leix   = i % 14 + 1;//1-10 球 11 12 大小 13 14 单双
                    int     hao    = i + 1;
                    decimal val    = 0;
                    if (qiudao < 6)
                    {
                        if (leix >= 1 && leix <= 10)
                        {
                            //球
                            xunhao = ((qiudao - 1) * 3 + 1).ToString() + "_" + hao.ToString();
                            string peilvNote = function.middlestring(resultPeilv, "<m_" + xunhao + ">", "</m_" + xunhao + ">");
                            decimal.TryParse(peilvNote, out val);
                            serPeilv.QD[qiudao - 1, leix - 1] = val;
                        }
                        else if (leix >= 11 && leix <= 12)
                        {
                            //大小
                            xunhao = ((qiudao - 1) * 3 + 2).ToString() + "_" + hao.ToString();
                            //
                            string peilvNote = function.middlestring(resultPeilv, "<m_" + xunhao + ">", "</m_" + xunhao + ">");
                            decimal.TryParse(peilvNote, out val);
                            if (leix == 11)
                            {
                                serPeilv.DXDS[qiudao - 1, 0] = val;
                            }
                            else
                            {
                                serPeilv.DXDS[qiudao - 1, 1] = val;
                            }
                        }
                        else if (leix >= 13 && leix <= 14)
                        {
                            //单双
                            xunhao = ((qiudao - 1) * 3 + 3).ToString() + "_" + hao.ToString();
                            string peilvNote = function.middlestring(resultPeilv, "<m_" + xunhao + ">", "</m_" + xunhao + ">");
                            decimal.TryParse(peilvNote, out val);
                            if (leix == 13)
                            {
                                serPeilv.DXDS[qiudao - 1, 2] = val;
                            }
                            else
                            {
                                serPeilv.DXDS[qiudao - 1, 3] = val;
                            }
                        }
                        else if (leix >= 13 && leix <= 14)
                        {
                        }
                    }
                }
                decimal valA       = 0;
                string  peilvNoteA = function.middlestring(resultPeilv, "<m_16_71>", "</m_16_71>");
                decimal.TryParse(peilvNoteA, out valA);
                serPeilv.ZHDXDS[0] = valA;


                peilvNoteA = function.middlestring(resultPeilv, "<m_16_72>", "</m_16_72>");
                decimal.TryParse(peilvNoteA, out valA);
                serPeilv.ZHDXDS[1] = valA;

                peilvNoteA = function.middlestring(resultPeilv, "<m_17_73>", "</m_17_73>");
                decimal.TryParse(peilvNoteA, out valA);
                serPeilv.ZHDXDS[2] = valA;

                peilvNoteA = function.middlestring(resultPeilv, "<m_17_74>", "</m_17_74>");
                decimal.TryParse(peilvNoteA, out valA);
                serPeilv.ZHDXDS[3] = valA;

                peilvNoteA = function.middlestring(resultPeilv, "<m_18_75>", "</m_18_75>");
                decimal.TryParse(peilvNoteA, out valA);
                serPeilv.LHH[0] = valA;

                peilvNoteA = function.middlestring(resultPeilv, "<m_18_76>", "</m_18_76>");
                decimal.TryParse(peilvNoteA, out valA);
                serPeilv.LHH[1] = valA;

                peilvNoteA = function.middlestring(resultPeilv, "<m_18_77>", "</m_18_77>");
                decimal.TryParse(peilvNoteA, out valA);
                serPeilv.LHH[2] = valA;
                #endregion 获取下注赔率

                function.log("获取赔率成功");
            }
            catch (Exception ex)
            {
                function.log("获取赔率失败" + ex.Message + "\n" + resultPeilv);
                return(null);
            }

            return(serPeilv);
        }
Exemple #28
0
        /// <summary>
        /// 登录状态
        /// </summary>
        public static bool login(string url, string username, string userpass, CookieContainer webCookie, int tryMax)
        {
            bool isSuccess = false;
            int  tryCount  = 0;

            try
            {
                while (true)
                {
                    #region 获取验证码

                    //图像验证码
                    string validateCode = "";
                    string urlVali      = url + "/user/ValidateImage.aspx?time=0." + DateTime.Now.Ticks;
                    Bitmap bitmap;

                    validateCode = ServerCommon.GetValidateCode(urlVali, webCookie, out bitmap);

                    #endregion 获取验证码

                    #region 登录

                    if (validateCode.Length == 4)
                    {
                        //登录获取Cookie
                        string resultLogin = HttpHelps.Post("loginName=" + username + "&loginPwd=" + userpass + "&ValidateCode=" + validateCode,
                                                            url + "/user/login_validate.aspx", webCookie, Encoding.Default);

                        if (resultLogin.IndexOf("系統已經自動把你列入黑名單") > -1)
                        {
                            //密碼輸入多次不正確,系統已經自動把你列入黑名單!!!
                            isSuccess = false;
                            break;
                        }
                        else if (resultLogin.IndexOf("驗證碼輸入不正確") == -1 && resultLogin.IndexOf("帳號或密碼不正確") == -1)
                        {
                            //
                            if (checkLogin(url, webCookie))
                            {
                                //登录成功
                                isSuccess = true;
                                function.log("顺丰登录成功");
                                break;
                            }
                        }
                        else
                        {
                            tryCount++;
                        }

                        function.log("顺丰登录失败,重新尝试");
                        Thread.Sleep(500);
                    }

                    #endregion 登录


                    if (tryCount > tryMax)
                    {
                        function.log("尝试登录次数过多");
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                function.log("尝试登录错误" + ex.Message);
            }

            return(isSuccess);
        }
        /// <summary>
        /// 获取最新赔率
        /// </summary>
        public static peilv getPeilv(string url, CookieContainer webCookie)
        {
            //获取赔率

            string resultPeilv = "";
            peilv  serPeilv    = new peilv();

            try
            {
                function.log("获取赔率");

                //赔率
                resultPeilv = HttpHelps.Post("stype=getoddsbytype&gameno=6&oddsgroupnos=205;206;207;208;209;210;211;212;213;214;215;216;217;218;219;330;331;332;333;334;335;336;337;338;339;340;341;342;343;344;345;346;347;&wagerroundno=B&ts="
                                             + function.MilliTime(), url + "/cp2-dfgj-mb/ashx/orderHandler.ashx", webCookie, Encoding.UTF8);

                if (resultPeilv.Length < 200)
                {
                    return(null);
                }

                string  xunhao = "";
                decimal val    = 0;

                #region 获取下注赔率

                //{"oddsgroupno":206,"objectid":2,"odds":9.7100}

                for (int i = 0; i < 5; i++)//单球
                {
                    for (int x = 0; x < 10; x++)
                    {
                        xunhao = "{\"oddsgroupno\":" + fpCanShu.QD[i, x].Replace("_", ",\"objectid\":") + ",\"odds\":";
                        string peilvNote = function.middlestring(resultPeilv, xunhao, "}");
                        decimal.TryParse(peilvNote, out val);
                        serPeilv.QD[i, x] = val;
                    }
                }
                for (int i = 0; i < 5; i++)//大小单双
                {
                    for (int x = 0; x < 4; x++)
                    {
                        xunhao = "{\"oddsgroupno\":" + fpCanShu.DXDS[i, x].Replace("_", ",\"objectid\":") + ",\"odds\":";
                        string peilvNote = function.middlestring(resultPeilv, xunhao, "}");
                        decimal.TryParse(peilvNote, out val);
                        serPeilv.DXDS[i, x] = val;
                    }
                }
                for (int i = 0; i < 3; i++)//龙虎和
                {
                    xunhao = "{\"oddsgroupno\":" + fpCanShu.LHH[i].Replace("_", ",\"objectid\":") + ",\"odds\":";
                    string peilvNote = function.middlestring(resultPeilv, xunhao, "}");
                    decimal.TryParse(peilvNote, out val);
                    serPeilv.LHH[i] = val;
                }

                for (int i = 0; i < 4; i++)//总和
                {
                    xunhao = "{\"oddsgroupno\":" + fpCanShu.ZHDXDS[i].Replace("_", ",\"objectid\":") + ",\"odds\":";
                    string peilvNote = function.middlestring(resultPeilv, xunhao, "}");
                    decimal.TryParse(peilvNote, out val);
                    serPeilv.ZHDXDS[i] = val;
                }

                #endregion 获取下注赔率

                function.log("获取赔率成功");
            }
            catch (Exception ex)
            {
                function.log("获取赔率失败" + ex.Message + "\n" + resultPeilv);
                return(null);
            }

            return(serPeilv);
        }
        /// <summary>
        /// 尝试下注
        /// </summary>
        /// <param name="url"></param>
        /// <param name="webCookie"></param>
        /// <param name="transtring">"212,,1,,1.9428,10;"</param>
        /// <param name="arrstring">"212:1:10;"</param>
        /// <param name="creditquota">金额</param>
        /// <returns></returns>
        public static bool postXiaZhu(string url, CookieContainer webCookie, string transtring, string arrstring)
        {
            string pb               = "B"; //parent.main_mbopen
            string gameno           = "6";
            string lianma_transtrin = "";  //空
            string creditquota      = getYuE(url, webCookie).ToString();

            //获取 xindan_roundno
            //cd-> xindan_roundno  -> parent.roundno
            //{"d":"{\"code\":1,\"message\":{\"sd\":\"20171124-018\",\"soTs\":-1,
            //\"seTs\":-1,\"swTs\":-1,\"cd\":\"20171124-019\",\"coTs\":-137,\"ceTs\":123,\"cwTs\":204,\"nd\":\"20171124-020\",\"noTs\":40,\"neTs\":260,
            //\"nwTs\":81,\"jgTs\":41,\"kjTs\":300,\"ld\":\"20171124-018\",\"lr\":[\"8\",\"9\",\"1\",\"9\",\"7\"]}}"}
            string resultLoadDrawsInfo = HttpHelps.PostJson("{gameno:" + gameno + "}", url + "/cp2-dfgj-mb/app/ws_game.asmx/LoadDrawsInfo",
                                                            webCookie, Encoding.UTF8);
            string xindan_roundno = function.middlestring(resultLoadDrawsInfo, "\\\"cd\\\":\\\"", "\\\"");

            //
            string formToken = "";

            if (xindan_roundno.Length > 0)
            {
                //下注前验证
                //{wagerround:"B",transtring:"212,,1,,1.9428,10;",arrstring:"212:1:10;",wagetype:0,allowcreditquota:10,hasToken:true}
                //"{wagerround:\"" + pb + "\",transtring:\"" + transtring + "\",arrstring:\"" + arrstring + "\",wagetype:"
                //    + (wagetype != undefined ? wagetype : 0) + ",allowcreditquota:" + (pricecount != undefined || pricecount != "" ? pricecount : 0) + ",hasToken:true}"

                string postDataA = "{wagerround:\"" + pb + "\",transtring:\"" + transtring + "\",arrstring:\"" + arrstring
                                   + "\",wagetype:0,allowcreditquota:" + creditquota + ",hasToken:true}";
                string   resuleA = HttpHelps.PostJson(postDataA, url + "/cp2-dfgj-mb/ch/left.aspx/GetMemberMtran", webCookie, Encoding.UTF8);
                string[] res     = resuleA.Split(new string[] { "$@" }, StringSplitOptions.None);

                if (res.Length == 7)
                {
                    formToken = res[6].Replace("\"}", "");
                }
            }

            function.log("下注参数:" + transtring + "  " + arrstring + "  " + xindan_roundno + "  " + formToken);

            bool isSuccess = false;

            if (formToken.Length > 0 && xindan_roundno.Length > 0)
            {
                //确认下注
                //"{gameno:" + parent.gameno + ",wagerroundstring:\"" + pb + "\",arrstring:\"" + arrs + "\",roundno:\"" + xindan_roundno + "\",lianma_transtrin:\"" + lianma_transtrin + "\",token:\"" + formToken + "\"}"
                string postDataB = "{gameno:\"" + gameno + "\",wagerroundstring:\"" + pb + "\",arrstring:\"" + arrstring
                                   + "\",roundno:\"" + xindan_roundno + "\",lianma_transtrin:\"" + lianma_transtrin
                                   + "\",token:\"" + formToken + "\"}";
                string resuleB = HttpHelps.PostJson(postDataB, url + "/cp2-dfgj-mb/ch/left.aspx/mtran_XiaDan_New", webCookie, Encoding.UTF8);

                //function.log("下注结果:" + resuleB);

                //没有该游戏操作权限!
                //超过您的每日信用额度,无法下注,请联系上级代理
                if (resuleB.IndexOf("没有该游戏操作权限") > -1 || resuleB.IndexOf("超过您的每日信用额度") > -1 || resuleB.IndexOf("索引超出了数组界限") > -1)
                {
                    isSuccess = false;
                    function.log("下注错误:" + resuleB);
                }
                else
                {
                    isSuccess = true;
                    function.log("下注成功:" + resuleB);
                }
            }
            return(isSuccess);
        }
        /// <summary>
        /// 获取用户信息x
        /// </summary>
        /// <param name="url"></param>
        /// <param name="webCookie"></param>
        /// <returns></returns>
        public static string getUserInfo(string url, CookieContainer webCookie)
        {
            string resultGetMembersInfo = HttpHelps.PostJson("", url + "/cp2-dfgj-mb/ch/main.aspx/GetMembersMbinfo", webCookie, Encoding.UTF8);

            return(resultGetMembersInfo);
        }