diff --git a/course/frida/04_frida_with_typescript/package.json b/course/frida/04_frida_with_typescript/package.json index 896b0e5ab6b5533a64ac797900ee2213f170091c..ffc58a9ff9da2544200251dcb501744896439004 100644 --- a/course/frida/04_frida_with_typescript/package.json +++ b/course/frida/04_frida_with_typescript/package.json @@ -5,7 +5,8 @@ "main": "src/index.ts", "scripts": { "build": "frida-compile src/index.ts -o index.js -c", - "watch": "frida-compile src/index.ts -o index.js -w" + "watch": "frida-compile src/index.ts -o index.js -w", + "watch05": "frida-compile ../05_读取棋盘数据/index.ts -o index.js -w" }, "keywords": [], "author": "", diff --git "a/course/frida/05_\350\257\273\345\217\226\346\243\213\347\233\230\346\225\260\346\215\256/index.ts" "b/course/frida/05_\350\257\273\345\217\226\346\243\213\347\233\230\346\225\260\346\215\256/index.ts" new file mode 100644 index 0000000000000000000000000000000000000000..a1418d8e4052dccdf3a1f2813e5ffd1f99b60ee3 --- /dev/null +++ "b/course/frida/05_\350\257\273\345\217\226\346\243\213\347\233\230\346\225\260\346\215\256/index.ts" @@ -0,0 +1,38 @@ +class L07 { + private module_name_winmine = "winmine.exe"; + private module_winmine: Module; + constructor() { + console.log("======================", new Date().toISOString(), "=========================="); + console.log("Frida.version", Frida.version); + //获取模块基址 + this.module_winmine = Process.getModuleByName(this.module_name_winmine); + } + + board_info() { + let height = this.module_winmine.base.add(0x5338).readU32(); + console.log("棋盘高度:", height); + + let width = this.module_winmine.base.add(0x5334).readU32(); + console.log("棋盘宽度:", width); + + let mine_count = this.module_winmine.base.add(0x5330).readU32(); + console.log("地雷数量:", mine_count); + + let head = this.module_winmine.base.add(0x5340); + console.log("棋盘头:", head); + + //遍历棋盘,按行遍历 + for (let i = 0; i < height + 2; i++) { + //按列遍历 + let data = []; + for (let j = 0; j < width + 2; j++) { + let byte_data = head.add(j + 0x20 * i).readU8(); + data.push(byte_data.toString(16).padStart(2, '0')); + } + console.log(data.join(" ")); + } + } +} + +let l07 = new L07(); +l07.board_info(); \ No newline at end of file