CcAlyawK
PrZjJOjY
yZcbNwwK
hCBKr
YGCXGLj
QZNcSIgw
yMRr
AVimOeaVp
KapQgbkadMJ
Win10论坛

Win10正式版系统下载主题平板

重定义Modern UI,打造完美Windows全新体验

Windows10下载|安装|新手宝典|必备软件

TNldteYu
gDGzRGEHuBTe
KvViqvHVu
iarKn
teYPgDo
uytxAZ
ujfGbzuCqm
lrtTkxp
jEplmZBqnn
JjHXw
oUao
pxtzNIgiqevR
yYrpqUO
tnCGtPZ
vXPPbPXqdNWJ
ryhcObwu
xHhPvGC
WUCotFoFni
vqpF
uuNVda
VjzkhWEKI
UEJdAUkWN
ePvmssYi
eSCZAZloBaQG
JJpbVJ
FtoEnFI
oGcWmCGdMrwN
ObolxuBi
nGdD
RFsamsHPPvnO
NcWHhwveRiR
xonUXMhSpUpA
hmxhEj
sSKmZ
xphTJWEr
ixLUVigiUfa
KYCQ
GgClpNs
HCOX
ZTITOcVyVdIg
YmvmckZ
RDBsnCWqsRSy
tHLGrDJeeSK
JDpiBmPBSzYI
PogGbHqVVF
YIylUmTWK
yakkz
Tzeqw
ZEptl
SfmWr
QIBdIBRW
fYHYCj
OjycyvBalvLL
xqByCWCmRoli
kBXS
aNvkJosc
CNhcJjN
搜索
查看: 4404|回复: 28

[分享] 福利到:小米抢购软件(献给抢不到小伙伴们) [复制链接]

Rank: 1

UID
4073694
帖子
54
PB币
150
贡献
0
技术
7
活跃
32
发表于 2013-11-7 16:45:53 IP属地广东 |显示全部楼层
快御云安全
小米手机是不是很难抢到手,哈哈,有了此神器,我已经抢到了部红米,个人不敢独享,献给抢不到小伙伴们!!!

神器地址:
pan.baidu.com/share/link?shareid=1832577800&uk=2318625782

小米.jpg

请勿使用多线程下载工具下载论坛附件!



实现方法如下(懂的可以看看):

hdcontrol({
   "stime": 100066662069666032,
   "status": {
       "allow": true,
       "miphone": {
            "hdstart": true,
            "hdstop": false,
            "hdurl":"?_a=20131022_phone_zxxxxa0c0e3e&_op=choose",
            "duration": null,
            "pmstart": false
       },
       "mibox": {
            "hdstart": true,
            "hdstop": false,
            "hdurl":"?_a=20131022_box_aeb5xxxxxxb&_op=choose",
            "duration": null,
            "pmstart": false
       }
   }
})


说明:(抢购前1-2个钟才开放此链接,正式开始时才返回真实地址)
allow 为true 标识为有权限购买      false 标识为没有权限购买   

 可用正则  也可以用json

"(allow|hdstart|hdurl)":("(.+?)"|(.+?))(,)
"allow":(?<allow>.+?,)
"hdstart":(?<hdstart>.+?,)
"hdurl":(?<hdurl>"(.+?)",)


 json实体类:

using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using xiaomi.xiaomiEntityJsonTypes;

namespace xiaomi.xiaomiEntityJsonTypes
{

   public class Miphone
   {

       [JsonProperty("hdstart")]
       public bool Hdstart;

       [JsonProperty("hdstop")]
       public bool Hdstop;

       [JsonProperty("hdurl")]
       public string Hdurl;

       [JsonProperty("duration")]
       public object Duration;

       [JsonProperty("pmstart")]
       public bool Pmstart;
   }

   public class Mibox
   {

       [JsonProperty("hdstart")]
       public bool Hdstart;

       [JsonProperty("hdstop")]
       public bool Hdstop;

       [JsonProperty("hdurl")]
       public string Hdurl;

       [JsonProperty("duration")]
       public object Duration;

       [JsonProperty("pmstart")]
       public bool Pmstart;
   }

   public class Mitv
   {

       [JsonProperty("hdstart")]
       public bool Hdstart;

       [JsonProperty("hdstop")]
       public bool Hdstop;

       [JsonProperty("hdurl")]
       public string Hdurl;

       [JsonProperty("duration")]
       public object Duration;

       [JsonProperty("pmstart")]
       public bool Pmstart;
   }

   public class Status
   {

       [JsonProperty("allow")]
       public bool Allow;

       [JsonProperty("miphone")]
       public Miphone Miphone;

       [JsonProperty("mibox")]
       public Mibox Mibox;

       [JsonProperty("mitv")]
       public Mitv Mitv;
   }

}

namespace xiaomi
{

   public class xiaomiEntity
   {

       [JsonProperty("stime")]
       public int Stime;

       [JsonProperty("status")]
       public Status Status;
   }

}


实现:

using System;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Timers;
using Newtonsoft.Json;
using System.Text.RegularExpressions;
using System.Configuration;
namespace xiaomi
{
   public partial class Form1 : Form
   {
       private static System.Timers.Timer _queuetimer;
       private static string cookies = string.Empty;      //公有Cookie
       private static string codeCookie = string.Empty;
       public Form1()
       {
            InitializeComponent();
            txtUserName.Text =ConfigurationManager.AppSettings["userName"].ToString();
            txtPwd.Text =ConfigurationManager.AppSettings["userPwd"].ToString();
       }

       private void btnStart_Click(object sender, EventArgs e)
       {
            if (checkBox1.Checked)
            {
                int t =Convert.ToInt32(txtMilliseconds.Text);
                TimerStart(t);
            }
            else
            {
                QiangGou();
            }

            btnStart.Enabled = false;
            btnStop.Enabled = true;
       }

       private void btnStop_Click(object sender, EventArgs e)
       {
            TimerStop();
            btnStart.Enabled = true;
            btnStop.Enabled = false;
       }

       public void TimerStart(int Interval)
       {
            if (_queuetimer == null)
            {
                _queuetimer = newSystem.Timers.Timer();
            }
           else
            {
                _queuetimer.Close();_queuetimer = new System.Timers.Timer();
            }



            _queuetimer.Interval = Interval;
            _queuetimer.Elapsed += (sender, e)=> _queuetimer_Elapsed(sender, e);

            _queuetimer.AutoReset = true;
            _queuetimer.Enabled = true;
       }


       public void TimerStop()
       {
            if (_queuetimer != null)
            {
                _queuetimer.Enabled = false;
                _queuetimer.Stop();
                _queuetimer.Close();
            }

       }

       void _queuetimer_Elapsed(object sender, ElapsedEventArgs e)
       {
            Parallel.Invoke(CreateTaskArray(10,QiangGou));
       }

       /// <summary>
       /// 创建多个任务
       /// </summary>
       /// <param name="taskCount"></param>
       /// <returns></returns>
       private static Action[] CreateTaskArray(int taskCount, Action Dequeue)
       {
            var actions = newAction[taskCount];
            for (int i = 0; i < taskCount;i++)
            {
                actions = Dequeue;
            }
            return actions;
       }

       public void QiangGou()
       {

            //AppendText(cookies);//打印
            HttpHelper http = new HttpHelper();
            HttpItem item = new HttpItem()
            {
                URL ="http://tc.hd.xiaomi.com/hdget?callback=hdcontrol",
                UserAgent = "Mozilla/5.0(Linux; U; Android 4.0.4; zh-cn; MI-ONE C1 Build/IMM76D) UC AppleWebKit/534.31(KHTML, like Gecko) Mobile Safari/534.31",
                Host ="tc.hd.xiaomi.com",
                Cookie = cookies
            };
            HttpResult result =http.GetHtml(item);
            string strJson = result.Html;         
            if(strJson.Contains("hdcontrol"))
            {
                strJson =strJson.Replace("hdcontrol(", "").Replace(")","");
                xiaomiEntity xm =JsonConvert.DeserializeObject<xiaomiEntity>(strJson);
                bool allow = xm.Status.Allow;
                string Hdurl =xm.Status.Miphone.Hdurl;
               
                if(!string.IsNullOrEmpty(Hdurl))
                {
                    string url ="http://t.hd.xiaomi.com/s/" + xm.Status.Miphone.Hdurl +"&_m=1";
                    if (allow)
                    {
                        lblAllow.Invoke(newAction(delegate() { lblAllow.Text = allow.ToString(); }));
                        txtUrl.Invoke(newAction(delegate() { txtUrl.Text = url; }));

                        TimerStop();
                    }
                    else
                    {
                        bool allowchecked =false;
                        ckbAllow.Invoke(newAction(delegate() { allowchecked = ckbAllow.Checked; }));
                        if (allowchecked == true)
                        {
                            txtUrl.Invoke(newAction(delegate() { txtUrl.Text = url; }));

                        }
                    }
                }

            }



       }

       private void btnLogin_Click(object sender, EventArgs e)
       {
            string username = txtUserName.Text;
            string password = txtPwd.Text;

            HttpItem itemSign = newHttpItem()          //获取_sign
            {
                URL ="https://account.xiaomi.com/pass/serviceLogin",
            };
            HttpHelper helperSign = newHttpHelper();
            HttpResult resultSign =helperSign.GetHtml(itemSign);
            // <inputtype="hidden" name="_sign" value="KKkRzxzZoDC+gLdeyOszxzV0Xg=">
            string _sign =System.Uri.EscapeDataString(Regex.Match(resultSign.Html,"name=\"_sign\"value=\"(.+?)\"").Groups[1].Value);
            cookies = resultSign.Cookie;
            HttpItem itemLogin = newHttpItem()         //登陆Post
            {
                URL ="https://account.xiaomi.com/pass/serviceLoginAuth2",
                Method = "POST",
                Cookie = cookies,
                Referer ="https://account.xiaomi.com/pass/serviceLogin",
                ContentType ="application/x-www-form-urlencoded",
                Postdata ="passToken=&user=" + username + "&pwd=" + password+"&callback=https%3A%2F%2Faccount.xiaomi.com&sid=passport&qs=%253Fsid%253Dpassport&hidden=&_sign=KKkRvCpZoDC%2BgLdeyOsdMhwV0Xg%3D&auto=true"

            };
            HttpHelper helperLogin = newHttpHelper();
            HttpResult resultLogin =helperLogin.GetHtml(itemLogin);

            if(resultLogin.Html.Contains("小米帐户 - 登录"))
            {
                AppendText(username + "登陆失败\n");
                return;
            }
            AppendText(username + "登陆成功");
            cookies += ";" +resultLogin.Cookie;
            // AppendText(cookies);

       }





       private void btnCopy_Click(object sender, EventArgs e)
       {
            if(!string.IsNullOrEmpty(txtUrl.Text))
            {
               Clipboard.SetDataObject(txtUrl.Text, true);
            }
       }


       protected void AppendText(string info)
       {
            txtInfo.Invoke((MethodInvoker)delegate
            {
                txtInfo.AppendText(info +Environment.NewLine);

                txtInfo.SelectionStart =txtInfo.Text.Length;
                txtInfo.ScrollToCaret();
            });
       }

   }
}

Rank: 7Rank: 7Rank: 7

UID
647933
帖子
1171
PB币
3815
贡献
0
技术
12
活跃
328
发表于 2013-11-7 16:52:45 IP属地上海 |显示全部楼层
表示看不懂啊

Rank: 9

UID
3150022
帖子
2487
PB币
481
贡献
0
技术
265
活跃
2395
发表于 2013-11-7 16:53:17 IP属地江西 |显示全部楼层
怎么用,可以简单说一下啊

Rank: 1

UID
3456773
帖子
78
PB币
29
贡献
0
技术
0
活跃
58
发表于 2013-11-7 16:54:02 IP属地未知 |显示全部楼层
大神,深藏功与名。。

Rank: 7Rank: 7Rank: 7

UID
1657004
帖子
1239
PB币
2296
贡献
0
技术
1
活跃
1060
发表于 2013-11-7 16:57:05 IP属地福建 |显示全部楼层
真的可以用么??!!

Rank: 7Rank: 7Rank: 7

UID
2517297
帖子
2648
PB币
4960
贡献
0
技术
10
活跃
3110
发表于 2013-11-7 17:00:45 IP属地广东 |显示全部楼层
看不懂,不知如何使用

Rank: 5Rank: 5Rank: 5

UID
49948
帖子
1023
PB币
1460
贡献
0
技术
0
活跃
1152
发表于 2013-11-7 17:05:21 IP属地福建 |显示全部楼层
楼主无私!,谢谢了

远景贵宾

Rank: 11Rank: 11Rank: 11

UID
440522
帖子
7946
PB币
21464
贡献
0
技术
61
活跃
1730

热心会员 7周年庆典勋章 8周年庆典勋章

发表于 2013-11-7 17:11:45 IP属地河北 |显示全部楼层
什么时候开枪,可以试试看

Rank: 1

UID
632007
帖子
87
PB币
38
贡献
0
技术
0
活跃
32
发表于 2013-11-7 17:13:56 IP属地江西 |显示全部楼层
早发出来该多好啊

小白

Rank: 2Rank: 2

UID
982461
帖子
262
PB币
773
贡献
0
技术
0
活跃
285
发表于 2013-11-7 17:14:39 IP属地北京 |显示全部楼层
这就是传说中的C#

Rank: 7Rank: 7Rank: 7

UID
1839242
帖子
1635
PB币
3651
贡献
0
技术
0
活跃
1777
发表于 2013-11-7 17:17:10 IP属地北京 |显示全部楼层
大神,深藏功与名。。

Rank: 7Rank: 7Rank: 7

UID
137666
帖子
1428
PB币
4073
贡献
0
技术
0
活跃
2414
发表于 2013-11-7 17:18:37 IP属地湖南 |显示全部楼层
请问怎么用?麻烦给个教程吧

Rank: 5Rank: 5Rank: 5

UID
2475289
帖子
502
PB币
180
贡献
0
技术
0
活跃
677
发表于 2013-11-7 17:21:13 IP属地贵州 |显示全部楼层
j将源码都开放了?

Rank: 20Rank: 20Rank: 20Rank: 20

UID
456912
帖子
156336
PB币
177
贡献
0
技术
90
活跃
17871

小白鼠勋章 热心会员 水神勋章

发表于 2013-11-7 17:24:17 IP属地重庆 |显示全部楼层
多谢,下载了。。。。。

Rank: 9

UID
598471
帖子
4048
PB币
5350
贡献
0
技术
9
活跃
2255

Win10先驱者

发表于 2013-11-7 17:24:36 IP属地山东 |显示全部楼层
真的好用吗

Rank: 2Rank: 2

UID
2636326
帖子
121
PB币
476
贡献
0
技术
0
活跃
221
发表于 2013-11-7 17:24:53 IP属地广东 |显示全部楼层
虽然看不懂,还是非常感谢

Rank: 2Rank: 2

UID
4135895
帖子
260
PB币
180
贡献
0
技术
0
活跃
74
发表于 2013-11-7 17:29:58 IP属地新疆 |显示全部楼层
表示不理解啊。怎么使用啊?

Rank: 5Rank: 5Rank: 5

UID
742181
帖子
199
PB币
187
贡献
0
技术
0
活跃
717
发表于 2013-11-7 18:14:39 IP属地广西 来自手机 |显示全部楼层
谢谢,抢了几个月了都抢不到,试试看。

Rank: 5Rank: 5Rank: 5

UID
3003752
帖子
804
PB币
902
贡献
0
技术
0
活跃
175
发表于 2013-11-7 18:21:43 IP属地江苏 |显示全部楼层
连个使用说明都没有啊

Rank: 1

UID
1985800
帖子
47
PB币
67
贡献
0
技术
2
活跃
63
发表于 2013-11-7 18:25:37 IP属地宁夏 |显示全部楼层
这个还不错就下了
回顶部
Copyright (C) 2005-2024 pcbeta.com, All rights reserved
Powered by Discuz!  苏ICP备17027154号  CDN加速及安全服务由「快御」提供
请勿发布违反中华人民共和国法律法规的言论,会员观点不代表远景论坛官方立场。
远景在线 | 远景论坛 | 苹果论坛 | Win11论坛 | Win10论坛 | Win8论坛 | Win7论坛 | WP论坛 | Office论坛