本帖最后由 你上当了 于 2022-12-19 09:58 编辑
准备工具
1、cheat-engine
2、frIDA
打开游戏,CE连接进程
搜索血量400
打怪减血,然后搜索376,只剩一个。明显只能是它了
然后看下它附近的内存地址,人物是个结构体,附近的地址肯定有会相关的数值。(当然一个个搜索也是可以的)
现在问题来了,怎么对这内存进行寻址?硬看so代码肯定是可以找到,不过CE支持内存读写监听,很容易找到读写的指令
分析完毕 ,下面使用frida 进行mod
[Asm] 纯文本查看 复制代码
var mt24mgr = Module.findExportByName(moduleName, '_ZN4mt247GameMgrC2Ev')
var mt50mgr = Module.findExportByName(moduleName, '_ZN4mt507GameMgrC2Ev')
var refreshAddr = Module.findExportByName(moduleName, '_ZN4mt507UILayer17refreshHeroStatusEv')
var schedulerAddr = Module.findExportByName(moduleName, '_ZN7cocos2d9SchedulerC2Ev')
var refreshFunc= new NativeFunction(refreshAddr, "int", ["pointer"])
console.log(mt24mgr)
console.log(mt50mgr)
console.log(refreshAddr)
var schedulerInstance = null
var playerBaseMT24 = null
Interceptor.attach(mt24mgr, {
onEnter: function (args) {
console.log('mt24mgr')
console.log(ptr(args[0]))
playerBaseMT24 = ptr(args[0])
}
})
var playerBaseMT50 = null
Interceptor.attach(mt50mgr, {
onEnter: function (args) {
console.log('mt50mgr')
playerBaseMT50 = ptr(args[0])
console.log(playerBaseMT50)
}
})
{
setInterval(function(){
if(playerBaseMT50!=null && Memory.readInt( playerBaseMT50.add(0xc))< -200000){
console.log('mod',Memory.readPointer( playerBaseMT50.add(0xc)))
Memory.writeInt(playerBaseMT50.add(0x18),888888)
Memory.writeInt(playerBaseMT50.add(0x18+4),888888)
Memory.writeInt(playerBaseMT50.add(0x18+8),888888)
Memory.writeInt(playerBaseMT50.add(0x18+12),888888)
refreshFunc(Memory.readPointer( playerBaseMT50.add(0xc)))
playerBaseMT50 = null
playerBaseMT24 = null
}
}, 10000)
}
样本:
https://lachs.lanzoue.com/i4USG0iz9yif
代码
https://github.com/qajknsdjaks/frida-game-cheat
|