🛫 系列文章导航
▒ 目录 ▒
🛫 导读
开发环境
版本号 | 描述 | |
---|---|---|
文章日期 | 2024-03-17 | |
操作系统 | Win11 - 22H2 | 22621.2715 |
node -v | v20.10.0 | |
npm -v | 10.2.3 | |
yarn -v | 3.1.1 | |
frida-compile | 10.2.1 | 高版本各种异常 |
扫雷程序下载地址 | https://download.csdn.net/download/kinghzking/88979919 | |
课程源码 | https://gitcode.net/kinghzking/MyOpen | 所在目录:/course/frida |
1️⃣ 需求分析
获取游戏地图区域位置(软件窗口固定偏移)
class L07 {
// 设置鼠标位置_自动点击鼠标
private start_x = 0;
private start_y = 0;
private step = 16;
获取软件窗口位置_设置鼠标指针位置() {
let lpRect = Memory.alloc(4 * 4);
User32.GetWindowRect(this.hWnd, lpRect);
this.start_x = lpRect.readU32() + 6;
this.start_y = lpRect.add(4).readU32() + 88;
console.log("start_x", this.start_x);
console.log("start_y", this.start_y);
}
模拟点击:mouse_click
2️⃣ 代码编写测试
class L07 {
run() {
this.将目标窗口切换到前台()
this.获取软件窗口位置_设置鼠标指针位置()
//遍历棋盘,按行遍历
for (let i = 0; i < this.height + 2; i++) {
//按列遍历
let data = [];
for (let j = 0; j < this.width + 2; j++) {
let byte_data = this.head.add(j + 0x20 * i).readU8();
data.push(byte_data.toString(16).padStart(2, "0"));
// 标记地雷
if (byte_data == 0x8F) {
this.mouse_click(j, i, false);
}
// 点击无雷区
if (byte_data == 0x0F) {
this.mouse_click(j, i);
}
}
console.log(data.join(" "));
}
// 重绘窗口区域
this.board_repaint()
}
}
let l07 = new L07();
l07.run();