吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 16908|回复: 115
收起左侧

[Android 原创] 关于某仙网抢茅台的协议分析和源代码(续)

  [复制链接]
qiucx 发表于 2021-3-20 11:20
本帖最后由 qiucx 于 2021-4-2 14:06 编辑

关于某仙网抢茅台的协议分析和源代码 https://www.52pojie.cn/thread-1396064-1-1.html
发布后,得到很多网友的支持,但很多网友不理解怎么写,现提供部分源码供研究,请勿用于商业用途,否则后果自负。
[Java] 纯文本查看 复制代码
 Date deadDate = getDeadline();
                String token = "";
                while (true) {
                        // login the system before buying 12 seconds.
                        if ((deadDate.getTime() - new Date().getTime()) / 1000 > 20) {
                                System.out.println("Going to sleep 5 second...");
                                Thread.sleep(5000);
                                continue;
                        }
                        System.out.println("Starting to login system...");
                        token = login();

                        cookie = cookie + token;
                        // preReservationOrderUrl = (preReservationOrderUrl +
                        // token).replace("APPKEYXXX", appkey).replace("PUSHTOKENXXX",
                        // pushToken);
                        settlementUrl = (settlementUrl + token).replace("APPKEYXXX", appkey).replace("PUSHTOKENXXX", pushToken);
                        // getAccountSecurityUrl = (getAccountSecurityUrl+
                        // token).replace("APPKEYXXX", appkey).replace("PUSHTOKENXXX",
                        // pushToken);
                        // collectUrl = (collectUrl + token).replace("APPKEYXXX",
                        // appkey);//.replace("PUSHTOKENXXX", pushToken);
                        System.out.println("ANDROID" + URLDecoder.decode(appkey, "UTF-8") + DEVICE_ID);
                        // //System.out.println(MD5Util.encode("ANDROID" +
                        // URLDecoder.decode(appkey, "UTF-8") + DEVICE_ID));
                        orderUrl = (orderUrl + token)
                                .replace("APPKEYXXX", appkey)
                                .replace("PUSHTOKENXXX", pushToken)
                                .replace("RESERVATIONTOKENXXX",
                                        JiuXianWebMd5.encode("ANDROID" + URLDecoder.decode(appkey, "UTF-8") + DEVICE_ID));
                        // reservationProDetailURL = (reservationProDetailURL +
                        // token).replace("APPKEYXXX", appkey).replace("PUSHTOKENXXX",
                        // pushToken);
                        // cookie = cookie+token;
                        System.out.println("settlementUrl= " + settlementUrl);
                        System.out.println("ordertUrl= " + orderUrl);
                        break;
                }
                
                while (true) {

                        System.out.println("========The server date is ===========" + new Date());
                        // long internal = sysTime - new Date().getTime();
                        if (new Date().getTime() > deadDate.getTime()) {
                                settlement(settlementUrl);
                                // for (int i = 0; i < 100; i++) {
                                while (true) {
                                        JiuXianWebAndroid.getInstance().httpAsyncSendByMap();
                                        // Thread.sleep(1111111);
                                }
                        }                }



[Java] 纯文本查看 复制代码
private static String login() {
                String url = "";
                String urlConf = config.get("LoginURL");
                if (urlConf != null && urlConf.trim().length() > 0) {
                        url = urlConf;
                }
                url = url.replace("APPKEYXXX", appkey).replace("PUSHTOKENXXX", pushToken);
                //System.out.println("loginUrl==" + url);
                HttpPost post = new HttpPost(url);

                post.setHeader("Content-Type", contentType);
                post.setHeader("Accept", accept);
                post.setHeader("User-Agent", agent);
                post.setHeader("Cookie", cookie);
                try {
                        HttpResponse response = httpClient.execute(post);

                        HttpEntity entitys = response.getEntity();
                        if (entitys != null) {
                                InputStream instream = entitys.getContent();
                                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                                byte[] data = new byte[1024];
                                int count = -1;
                                while ((count = instream.read(data, 0, 1024)) != -1)
                                        outStream.write(data, 0, count);
                                data = null;
                                String ret = new String(outStream.toByteArray(), "utf-8");
                                //System.out.println(ret);
                                JSONObject jsonArray = JSONObject.fromObject(ret);
                                String token = "";
                                try {
                                        token = jsonArray.getJSONObject("result").getJSONObject("userInfo").getString("token");
                                } catch (Exception e) {
                                        int idx = ret.indexOf("\"token\":\"");
                                        token = ret.substring(idx + 9, idx + 50);
                                }

                                System.out.println("Login successfully and the return token is : " + token);
                                
                                return token;
                        }
                } catch (Exception e) {
                        e.printStackTrace();
                        // break;
                }

                return null;
        }


[Java] 纯文本查看 复制代码
private static void settlement(String setUrl) {

                HttpPost post = new HttpPost(setUrl);
                post.setHeader("Content-Type", contentType);
                post.setHeader("Accept", accept);
                post.setHeader("User-Agent", agent);
                post.setHeader("Cookie", cookie);
                try {
                        while (true) {

                                HttpResponse response = httpClient.execute(post);

                                HttpEntity entitys = response.getEntity();
                                if (entitys != null) {
                                        InputStream instream = entitys.getContent();
                                        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                                        byte[] data = new byte[1024];
                                        int count = -1;
                                        while ((count = instream.read(data, 0, 1024)) != -1)
                                                outStream.write(data, 0, count);
                                        data = null;
                                        String ret = new String(outStream.toByteArray(), "utf-8");
                                        
                                        JSONObject jsonArray = JSONObject.fromObject(ret);
                                        System.out.println("settlement response============" + ret);
        
                                        JSONArray arr = jsonArray.getJSONObject("result").getJSONObject("productsList").getJSONArray("unableProducts");
                                                
                                        if(arr.size() == 0) {
                                                break;
                                        }
                                }

                                Thread.sleep(80);
                        }
                } catch (Exception e) {
                        e.printStackTrace();
                }

        }


[Java] 纯文本查看 复制代码
private static void order(String orderUrl) {

                //System.out.println("settlementUrl=" + setUrl + ", orderUrl=" + orderUrl);
/*                HttpPost post = new HttpPost(setUrl);

                post.setHeader("Content-Type", contentType);
                post.setHeader("Accept", accept);
                post.setHeader("User-Agent", agent);
                post.setHeader("Cookie", cookie);
                try {
                        HttpResponse response = httpClient.execute(post);

                        HttpEntity entitys = response.getEntity();
                        if (entitys != null) {
                                InputStream instream = entitys.getContent();
                                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                                byte[] data = new byte[1024];
                                int count = -1;
                                while ((count = instream.read(data, 0, 1024)) != -1)
                                        outStream.write(data, 0, count);
                                data = null;
                                String ret = new String(outStream.toByteArray(), "utf-8");
                                System.out.println("settlement response============" + ret);
                        }
                } catch (Exception e) {
                        e.printStackTrace();
                }*/
                
                
                HttpPost post = new HttpPost(orderUrl);
                post.setHeader("Content-Type", contentType);
                post.setHeader("Accept", accept);
                post.setHeader("User-Agent", agent);
                post.setHeader("Cookie", cookie);
                try {
                        HttpResponse response = httpClient.execute(post);

                        HttpEntity entitys = response.getEntity();
                        if (entitys != null) {
                                InputStream instream = entitys.getContent();
                                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                                byte[] data = new byte[1024];
                                int count = -1;
                                while ((count = instream.read(data, 0, 1024)) != -1)
                                        outStream.write(data, 0, count);
                                data = null;
                                String ret = new String(outStream.toByteArray(), "utf-8");
                                System.out.println("Order response============" + ret);
                        }
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }


打字不易,有帮助就点个赞,加个分。

免费评分

参与人数 23吾爱币 +24 热心值 +20 收起 理由
Brembo + 1 热心回复!
yimeng0826 + 1 我很赞同!
b0xianz + 1 + 1 谢谢
007大哥 + 1 合作嘛 我负责引流,真心的
qtfreet00 + 7 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
1248827423 + 1 + 1 热心回复!
神马还在浮云里 + 1 我很赞同!
dayone919 + 1 + 1 茅台好仙
KXXS + 1 + 1 用心讨论,共获提升!
shuaibi_chen + 1 + 1 &amp;lt;font style=&amp;quot;vertical-align: inherit;&amp;quot;&amp;gt;&amp;lt;font style=
pentium315 + 1 热心回复!
gzshlp33 + 1 我很赞同!
zpzwz + 1 + 1 谢谢@Thanks!
笙若 + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
秋意浓6 + 1 + 1 我很赞同!
亚瑟骑士 + 1 谢谢@Thanks!
a657938016 + 1 + 1 我很赞同!
shanse12345 + 1 + 1 我很赞同!
aze1990 + 1 &amp;lt;font style=&amp;quot;vertical-align: inherit;&amp;quot;&amp;gt;&amp;lt;font style=
这是追求不是梦 + 1 + 1 用心讨论,共获提升!
saoxu + 1 + 1 谢谢@Thanks!
a2f88 + 1 + 1 谢谢@Thanks!学习茅台
zfyuser + 1 + 1 用心讨论,共获提升!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

 楼主| qiucx 发表于 2021-4-2 14:08
zfyuser 发表于 2021-4-2 13:42
上次加了Q 本想把SK的加密方式告诉你 奈何你不回我 等了一个礼拜 我就把你删了

不好意思,可能不小心忽视了。SK加密算法已经搞好了,谢谢!
 楼主| qiucx 发表于 2021-4-5 10:41
hjlost 发表于 2021-4-4 22:48
DEVICE_ID这个参数是什么 ?是 deviceIdentify 吗?那不是跟appKey一样了?

有些设备一样,有些设备不一样的
 楼主| qiucx 发表于 2021-3-20 11:22
本帖最后由 qiucx 于 2021-3-20 11:27 编辑

另外,在不同的设备登录N次都不影响,每个token都有效。也就是说,你用10台手机登录同一个账户都没问题。
zfyuser 发表于 2021-3-20 11:30
感谢分享~
1624394966 发表于 2021-3-20 11:38
来学习一下
wildfire_810 发表于 2021-3-20 11:39
厉害厉害。有心了
飞奔送煎饼 发表于 2021-3-20 11:46
来学习学习  感谢大佬分享
QmiaopasiQ 发表于 2021-3-20 11:48
学习学习感谢大佬
13350485476 发表于 2021-3-20 12:03
nb大佬 学习学习
凝天 发表于 2021-3-20 12:03
来学习学习
PpaPingggg 发表于 2021-3-20 12:12
nb大佬 学习学习
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-24 14:02

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表