java代码,测过可以无限刷通关
[Java] 纯文本查看 复制代码 import cn.hutool.core.codec.Base64;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class YLYUHttp {
static ExecutorService threadPool= Executors.newFixedThreadPool(10);
static String loginOppoURL = "https://cat-match.easygame2021.com/sheep/v1/user/login_oppo" ;
static String matchTypeURL = "https://cat-match.easygame2021.com/sheep/v1/game/map_info_ex?matchType=3" ;
static String t = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2OTQ3ODI5NjIsIm5iZiI6MTY2MzY4MDc2MiwiaWF0IjoxNjYzNjc4OTYyLCJqdGkiOiJDTTpjYXRfbWF0Y2g6bHQxMjM0NTYiLCJvcGVuX2lkIjoiIiwidWlkIjo4MTMxOTUyOSwiZGVidWciOiIiLCJsYW5nIjoiIn0.GHT4Oi_3lbLYrsnaXyFSL6Xhv1azQVre6N82_z56-lU";
public static void main(String[] args) {
//String uid = "230058077";
String uid = "81315929";
getToken(t);
}
public static String getToken(String t ) {
try {
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
// public static void sucees(String uid){
// if(uid.length() < 10 && uid.matches("[0-9]+")){
// String tokne = getToken(uid);
// System.out.println(tokne);
// int num = 0;
// for(int i=0 ; i< 10 ; i++){
// num = send( tokne) + num;
// try {
// Thread.sleep(500);
// System.out.print(num);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
// System.out.println( " [通关 "+num+" 次 ,成功] ");
// }else {
// System.out.println("不是数字");
// }
// }
public static String autoGame(String t) {
try {
HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("t", t);
paramMap.put("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/6.5.2.501 NetType/WIFI MiniGame WindowsWechat");
paramMap.put("Referer", "https://servicewechat.com/wx141bfb9b73c970a9/23/page-frame.html");
String matchType = HttpUtil.get(matchTypeURL+ "&t=" +t);
String mad5 = JSONObject.parseObject(matchType).getJSONObject("data").getJSONArray("map_md5").getString(1);
String url = "https://cat-match-static.easygame2021.com/maps/" + mad5 + ".txt";
String s = HttpUtil.get(url);
JSONObject jsonObject = JSONObject.parseObject(s);
JSONObject levelData = jsonObject.getJSONObject("levelData");
Iterator<String> iterator = levelData.keySet().iterator();
int totalSize = 0;
while (iterator.hasNext()) {
String next = iterator.next();
JSONArray jsonArray = levelData.getJSONArray(next);
totalSize += jsonArray.size();
}
JSONArray jsonArray = new JSONArray();
for (int i = 0; i < totalSize; i++) {
JSONObject data = new JSONObject();
data.put("chessIndex", Math.min(i, 127));
data.put("timeTag", Math.min(i, 127));
jsonArray.add(data);
}
List<Byte> bytes = Lists.newArrayList();
bytes.add((byte) 8);
bytes.add((byte) 3);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject1 = jsonArray.getJSONObject(i);
bytes.add((byte) 34);
bytes.add((byte) 4);
bytes.add((byte) 8);
bytes.add(jsonObject1.getByte("chessIndex"));
bytes.add((byte) 16);
bytes.add(jsonObject1.getByte("chessIndex"));
}
byte[] dataByte = new byte[bytes.size()];
for (int i = 0; i < bytes.size(); i++) {
dataByte[i] = bytes.get(i);
}
String gameOverExUrl = "https://cat-match.easygame2021.com/sheep/v1/game/game_over_ex" ;
HashMap<String, Object> paramMap1 = new HashMap<>();
paramMap1.put("rank_score",1);
paramMap1.put("rank_state",1);
paramMap1.put("rank_time",1);
paramMap1.put("rank_role",1);
paramMap1.put("skin",1);
paramMap1.put("t",t);
paramMap1.put("MatchPlayInfo", Base64.encode(dataByte));
String json = JSONObject.toJSONString(paramMap1);
System.out.println(json);
String s1 = sendPost(gameOverExUrl,json,paramMap);;
System.out.println(s1);
return "";
} catch (Exception e) {
e.printStackTrace();
System.out.println("获取token失败");
return "01";
}
}
// public static void sucees(String uid){
// if(uid.length() < 10 && uid.matches("[0-9]+")){
// String tokne = getToken(uid);
// System.out.println(tokne);
// int num = 0;
// for(int i=0 ; i< 10 ; i++){
// num = send( tokne) + num;
// try {
// Thread.sleep(500);
// System.out.print(num);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
// System.out.println( " [通关 "+num+" 次 ,成功] ");
// }else {
// System.out.println("不是数字");
// }
// }
public static String sendPost(String url, String param, Map<String, Object> header) throws UnsupportedEncodingException, IOException {
PrintWriter out = null;
BufferedReader in = null;
String result = "";
URL realUrl = new URL(url);
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
//设置超时时间
conn.setConnectTimeout(5000);
conn.setReadTimeout(15000);
// 设置通用的请求属性
if (header!=null) {
for (Map.Entry<String, Object> entry : header.entrySet()) {
conn.setRequestProperty(entry.getKey(), entry.getValue().toString());
}
}
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("Content-Type", "application/json; charset=utf-8");
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// 获取URLConnection对象对应的输出流
out = new PrintWriter(conn.getOutputStream());
// 发送请求参数
out.print(param);
// flush输出流的缓冲
out.flush();
// 定义BufferedReader输入流来读取URL的响应
in = new BufferedReader(
new InputStreamReader(conn.getInputStream(), "utf8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
if(out!=null){
out.close();
}
if(in!=null){
in.close();
}
return result;
}
}
|