0
点赞
收藏
分享

微信扫一扫

一篇文章带你了解知乎热门话题的撰写技巧

cnlinkchina 2024-03-22 阅读 9

🛫 系列文章导航

▒ 目录 ▒

🛫 导读

开发环境

版本号描述
文章日期2024-03-17
操作系统Win11 - 22H222621.2715
node -vv20.10.0
npm -v10.2.3
yarn -v3.1.1
frida-compile10.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();

🛬 文章小结

举报

相关推荐

0 条评论