luajava逆向总结
luajava 逆向注意事项
1)libluajava.so lua_load进行dump lua文件
1 Interceptor.attach(luaL_loadbuffer, { 2 onEnter: function(args) { 3 var ptr = Memory.readPointer(args[2]); 4 var len = Memory.readInt(args[2].add(4)); 5 //console.log(hexdump(ptr, { length: len, ansi: false })); 6 var content = Memory.readCString(ptr, len); 7 var obj = {} 8 obj.size = len 9 obj.name = name; 10 obj.content = Memory.readCString(ptr, obj.size); 11 12 var path = "/sdcard/" + 'xxxx.lua'; 13 var file = new File(path,'wb'); 14 var data = Memory.readByteArray(ptr,len); 15 file.write(data); 16 file.flush(); 17 file.close(); 18 Interceptor.detachAll();
2)注意dump出来可能是luac 需要luac转lua
unluac的源码是开源,需要根据lua的版本 进行操作码确认,如有修改需转换。
定位转换的操作码函数,搜提示字符串"initial value must be a number".
操作码函数: