某森游戏列表

背景

发现现在3A游戏大作基本上300起步,网上找了某森的游戏下载工具,还需要账号或者激活码。我之前买过某森的一个永久VIP,后来原淘宝网店没了,换了新皮,问客服要账号也不理人。怒!!!本来已经躺平了,垂死病中惊坐起,誓要研究一番!

思路

1、通过Fiddler classic、wireShark等抓包工具找到API接口地址。

2、通过RestTemplate访问接口,发现接口地址竟然是公共服务。

代码

1、GameImg实体类

import java.io.Serializable;

import lombok.Data;

@Data
public class GameImg implements Serializable {

	private static final long serialVersionUID = 4995901746633163120L;

	private String id;

	private String gameId;

	private Integer orderNo;

	private String imgUrl;

	private String imgData;
}

 2、GameData实体类

import java.io.Serializable;
import java.util.List;

import lombok.Data;

@Data
public class GameData implements Serializable {

	private static final long serialVersionUID = -6932302826674271617L;

	private String id;

	private Integer deleted;

	private String creatorId;

	private String creatorName;

	private String createTime;

	private String modifierId;

	private String modifierName;

	private String modifyTime;

	private String name;

	private String pinyin;

	private String pinyinFirst;

	private Integer newGame;

	private Integer activeCount;

	private Integer playCount;

	private String encodeKey;

	private Integer sale;

	private Integer timeLimit;

	private String timeLimitNotice;

	private String headUrl;

	private String videoUrl;

	private String giftUrl;

	private String downloadUrl;

	private String downloadPassword;

	private String buyUrl;

	private String readmeUrl;

	private List gameDetailImages;

	private String redirectUrl;

}

 3、单响应对象

import java.io.Serializable;

import lombok.Data;

@Data
public class RespSingleResult implements Serializable {

	private static final long serialVersionUID = 1820980857598297402L;

	private Boolean result;

	private Integer errorCode;

	private String msg;

	private GameData json;
}

 4、多响应对象

import java.io.Serializable;
import java.util.List;

import lombok.Data;

@Data
public class RespMutipleResult implements Serializable {

	private static final long serialVersionUID = 1820980857598297402L;

	private Boolean result;

	private Integer errorCode;

	private String msg;

	private List json;
}

5、单元测试

import java.util.List;

import org.haisen.crack.entity.GameData;
import org.haisen.crack.entity.RespMutipleResult;
import org.haisen.crack.entity.RespSingleResult;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;

import com.aspose.words.Document;
import com.aspose.words.DocumentBuilder;
import com.aspose.words.ImportFormatMode;

@SpringBootTest
class CrackApplicationTests {

	/**
	 * 单个游戏数据基本信息
	 */
	private static final String SINGLE_GAME_DATA_URL = "http://yx.haisenyouxi8.com/hsgame/game/getById";

	/**
	 * 所有游戏数据基本信息
	 */
	private static final String ALL_GAME_DATA_URL = "http://yx.haisenyouxi8.com/hsgame/game/query";

	private RestTemplate restTemplate;

	@Autowired
	public void setRestTemplate(RestTemplate restTemplate) {
		this.restTemplate = restTemplate;
	}

	/**
	 * 获取单个游戏数据测试
	 */
	@Test
	void getSingleGameTest() {
		if (null != this.restTemplate) {

			String url = SINGLE_GAME_DATA_URL;

			/**
			 * 古墓丽影
			 */
			String gameId = "caf5347414c34ff3bd18b578c1b6d60a";

			MultiValueMap map = new LinkedMultiValueMap();
			map.add("id", gameId);
			HttpHeaders headers = new HttpHeaders();
			headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
			HttpEntity> request = new HttpEntity>(map,
					headers);
			try {
				ResponseEntity ret = this.restTemplate.postForEntity(url, request,
						RespSingleResult.class);
				GameData s = ret.getBody().getJson();
				System.out.print(s.getName());
				System.out.print(" ");
				System.out.print(s.getDownloadUrl());
				System.out.print(" ");
				System.out.print(s.getDownloadPassword());
				System.out.println();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	/**
	 * 获取所有游戏信息测试
	 */
	@Test
	void getAllGamesTest() {
		if (null != this.restTemplate) {

			String url = ALL_GAME_DATA_URL;

			MultiValueMap map = new LinkedMultiValueMap();
			HttpHeaders headers = new HttpHeaders();
			headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
			HttpEntity> request = new HttpEntity>(map,
					headers);
			try {
				ResponseEntity ret = this.restTemplate.postForEntity(url, request,
						RespMutipleResult.class);
				List list = ret.getBody().getJson();
				list.stream().forEach(s -> {
					System.out.print(s.getName());
					System.out.print(" ");
					System.out.print(s.getDownloadUrl());
					System.out.print(" ");
					System.out.print(s.getDownloadPassword());
					System.out.println();
				});
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}

 6、测试结果

古墓丽影9豪华版 https://pan.baidu.com/s/1xWixrZ2y46xYfEAt4zZXSA okd7

后记

1、接口服务器用的tomcat;

2、接口服务公开,属于公共服务;

3、百度网盘共享任何人;

4、本篇仅用于技术研究哈。

你可能感兴趣的:(Crack,游戏)