首页
社区
课程
招聘
[讨论]frida能否动态读入文件替换要加载的dll
发表于: 2018-10-16 21:17 4725

[讨论]frida能否动态读入文件替换要加载的dll

2018-10-16 21:17
4725
闲来无事逆向了一个U3d游戏玩,游戏有反调试.Assembly-CSharp 当时是加密了。
frida hook 获取到了解密的  Assembly-CSharp。
但是苦于 IL 的 DLL 无法动态调试,内部函数如何运作还是无法清晰了解
于是想到了修改DLL 函数自己打印 局部变量出来。
可以实现,但是太麻烦了。
能不能用frida 在hook mono_image_open_from_data_with_name 的时候 用 改过的dll替换 刚解密的dll呢?
翻烂了 frida的官方手册也没找到办法,特来求助
附上部分代码
import frida,sys,time

def on_message(message ,data):
    print (message)


scr = """
//mono_image_open_from_data_with_name
Module = Process.findModuleByName("libmono.so");
addr = 0x17D4E2;
natviePointer =  Module.base.add(addr);
send("Module.base:"+ Module.base + " Module.size:"+ Module.size + " native pointers:" + natviePointer);
Interceptor.attach(natviePointer, {
    onEnter:function(args)  {
        filesize = Memory.readUInt(this.context.ebp.add(12));
        if(filesize == 3964556){
            buff = Memory.readPointer(this.context.ebp.add(8));
            buff = buff.add(0x6111E7);
            console.log(hexdump(buff, {length:32}))
            Memory.writeU32(buff,0x8201E)
            console.log(hexdump(buff, {length:32}))
            info = "filesize:"+ filesize;
            send(info)
        }
        
    }
});
"""


[课程]Android-CTF解题方法汇总!

收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 33
活跃值: (322)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
曲线救国 反射调用File类?
最后于 2018-10-17 20:07 被gaybc编辑 ,原因:
2018-10-17 13:15
0
雪    币: 121
活跃值: (44)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
主要是 frida的 File 类只有写没有读

File
new File(filePath, mode): open or create the file at filePath with the mode string specifying how it should be opened. For example "wb" to open the file for writing in binary mode (this is the same format as fopen() from the C standard library).

write(data): synchronously write data to the file, where data is either a string or a buffer as returned by Memory#readByteArray

flush(): flush any buffered data to the underlying file

close(): close the file. You should call this function when you’re done with 
2018-10-18 22:29
0
游客
登录 | 注册 方可回帖
返回
//