2020-03-06 13,584 ℃

距离上次在博客发布都要快一年了,这次因为又添加了一个新功能,所以在博客介绍一下。
ida脚本现在分为“ida.py”和“ida_with_struct.py”两个,使用“ida_with_struct.py”会载入“il2cpp.h”并在ida应用结构信息,包括变量,函数,虚函数表等等。
测试代码
public class Class1 { private int b; public Class1() { b = 1; } public virtual int Add(int a) { return b + a; } public virtual int Sub(int a) { return b - a; } } public class Class2 : Class1 { private int c; public Class2() { c = 2; } public override int Add(int a) { return c + a; } public override int Sub(int a) { return c - a; } } public class Class3 { public Dictionary<Class2, int> a = new Dictionary<Class2, int>(); public static int b = 5; public int test(Class2 d) { var c = new Class2[255]; c[50] = d; var e = d.Sub(b); a.Add(d, e); return e; } }
使用脚本后ida F5 Class3.test函数,我已经添加了注释
int32_t __cdecl Class3__test(Class3_o *this, Class2_o *d) { Class2_array *v2; // eax Class3_o *v3; // ecx Class2_array *v4; // edi Class3_c *v5; // eax int v6; // eax Il2CppObject *v7; // edi System_Collections_Generic_Dictionary_TKey__TValue__o *v8; // eax int v10; // eax int v11; // eax if ( !byte_1059BC60 ) { sub_100CD270(1700); byte_1059BC60 = 1; } //var c = new Class2[255]; v2 = (Class2_array *)il2cpp_array_new_specific(Class_Class2__, 255); v4 = v2; if ( !v2 ) goto LABEL_18; if ( d && !sub_100CCFE0(d, v2->obj.klass->_1.element_class) ) { v10 = sub_100CD1A0(); sub_100CD380(v10, 0); } if ( v4->max_length <= 50 ) { v11 = sub_100CD1E0(); sub_100CD380(v11, 0); } //c[50] = d; v4->m_Items[50] = d; v5 = Class_Class3; if ( Class_Class3->_2.bitflags2 & 2 && !Class_Class3->_2.cctor_finished ) { il2cpp_runtime_class_init((unsigned int)Class_Class3); v5 = Class_Class3; } //var e = d.Sub(b); v3 = (Class3_o *)v5->static_fields->b; if ( !d || (v6 = ((int (__cdecl *)(Class2_o *, Class3_o *, void *))d->klass->vtable._5_Sub.methodPtr)( d, v3, d->klass->vtable._5_Sub.method), v3 = this, v7 = (Il2CppObject *)v6, (v8 = (System_Collections_Generic_Dictionary_TKey__TValue__o *)this->a) == 0) ) { LABEL_18: sub_100CD3B0(v3); } //a.Add(d, e); System_Collections_Generic_Dictionary_TKey__TValue___Add(v8, (Il2CppObject *)d, v7); //return e; return (int32_t)v7; }
注意对于函数中实例化的局部变量,ida没法正确判断类型,需要手动指定类型。
虽然脚本已经经过了多次测试,但是也不能保证不会报错,其中“apply_type failed”这个错误可以无视,因为ida也不给具体的错误原因,修都不知道从哪里修,其他错误的话欢迎在github或者这里反馈。
ghidra的脚本不支持载入“il2cpp.h”,因为我暂时懒得去翻ghidra的文档了,等等看有没有大佬帮忙完善一下(
最后惯例
下载地址
Latest Build版本
源码
打扰大佬了,我是一名小白,使用AssetStudio没有拆出资源怀疑是加密了,成功用Il2CppDumper拆出DummyDll文件夹,但接下来不知道该如何提取spine,网上搜到的相关都是修改游戏数据,大佬是否能指点一下,或者指路现有的教程呢,十分感谢
dalao能拆一下重装战姬的live2D吗,拆包后没看到立绘全live2D散件
因为用的是spine,不是live2d
大佬有macOS版本的吗
有net core版本可以在macOS上运行
大佬,请问使用iL2CPP打包的U3D游戏,游戏的配置表一般在什么地方?是在\assets\bin\Data文件夹下面的ASSET文件里面,还是在SO文件里面呢?
Init ializing me tadata….Me tadata Version: 24.1
In it ializ ing il2cpp f ile.. .
Detected this maybeadumpfile
Input il2cpp dump address or input a to force cont inue:Øx7f 554bØØ0
I 12Cpp Version: 24.1Se arching- . –
Code Regis trat ion
Me t adat aRegis trat ion :0
ERROR : No symbol is detected
ERROR: Gan’t use auto mode to process file. try manual mode Input Code Reg is trat ion:
怎么解决
新版(包括这里的610和github的624)都有个细微问题
举例以前的dump文件都是
public static void xxxx() //RVA: 0xXXXXXXXX Offset: 0xXXXXXXXX VA: 0xXXXXXXXX
public void .ctor(); //RVA: 0xXXXXXXXX Offset: 0xXXXXXXXX VA: 0xXXXXXXXX
(…)
现在每一行直接加了空格变成了
//RVA: 0xXXXXXXXX Offset: 0xXXXXXXXX VA: 0xXXXXXXXX
public static void xxxx()
//RVA: 0xXXXXXXXX Offset: 0xXXXXXXXX VA: 0xXXXXXXXX
public void .ctor();
//RVA: 0xXXXXXXXX Offset: 0xXXXXXXXX VA: 0xXXXXXXXX
(…)
造成的结果就是比如用notepad++搜索某个方法非常慢,以前可以瞬间最多一两秒搜索出来的结果现在可能要10-20秒
尤其是如果有很多同名方法的情况下搜索速度会更慢
搜索的话用dnspy打开DummyDll搜索他不香吗,还能限制搜索范围和类型
最近试用一下https://github.com/djkaty/Il2CppInspector 发现它这个能导出保存在metadata的常量
比如
public const int kTargetFps = 60; // Metadata: 0x00AD3895
public const float kTargetFpsF = 60f; // Metadata: 0x00AD3899
public const float kFrameToSec = 0.016666668f; // Metadata: 0x00AD389D
但il2cppdumper给出的dummydll却是
[Il2CppDummyDll.FieldOffset(Offset = “0x0”)]
public const int kTargetFps = 60;
[Il2CppDummyDll.FieldOffset(Offset = “0x0”)]
public const float kTargetFpsF = 60f;
[Il2CppDummyDll.FieldOffset(Offset = “0x0”)]
public const float kFrameToSec = 0.0166666675f;
希望能考虑支持给出常量在MetaData的地址
根据你贴的信息来看,我姑且认为你是想直接修改常量的值?
但是常量在编译后,除了string类型的值转成stringliteral后还是存储在metadata中,其他值类型都是编译时就替换成了具体的值,修改metadata也没有任何效果,所以我认为输出常量的metadata offset没有任何意义。
至于数组类型初始化所用到的值是会在dump.cs里输出metadata offset的。
[FieldOffset(Offset = “0x0”)]
public const string LEGACY_SUFFIX = “_legacy”;
给个地址呗,有时可能也要改字符串;开两个工具看还有点麻烦
其他值类型都是编译时就替换成了具体的值,修改metadata也没有任何效果——那么想要改非string常量 该怎么做呢
常量只是在编译时期用的数据,string常量转成stringliteral后的metadata offset跟原本string常量的metadata offset是不一样的,你修改原本string常量值并不会改变已经编译成stringliteral的值。只是stringliteral依旧存储在metadata中,你搜索“_legacy”应该可以搜到两个一样的字符串。
要修改非string的常量就直接修改il2cpp的代码。
System.IO.InvalidDataException: ERROR: Metadata file supplied is not valid metadata file.
於 Il2CppDumper.Program.Init(Byte[] il2cppBytes, Byte[] metadataBytes, Metadata& metadata, Il2Cpp& il2Cpp) 於 C:\projects\il2cppdumper\Il2CppDumper\Program.cs: 行 119
於 Il2CppDumper.Program.Main(String[] args) 於 C:\projects\il2cppdumper\Il2CppDumper\Program.cs: 行 81
Press any key to exit…
求大佬解答
解决了吗,同问。看报错是global-metadata.dat不能正确识别,昨天以为是unity更新了文件结构,但是刚刚查了一下,unity最新的是2019年发布的,所以估计是Java层或者so层对这个文件加密了。
大佬,出现以下错误:
Initializing metadata…
Metadata Version: 24.1
Initializing il2cpp file…
Select Platform: 1.32bit 2.64bit
Il2Cpp Version: 24.1
Searching…
CodeRegistration : 100f37560
MetadataRegistration : 100f655c8
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Il2CppDumper.Il2Cpp.Init(UInt64 codeRegistration, UInt64 metadataRegistration) in C:\projects\il2cppdumper\Il2CppDumper\Il2Cpp\Il2Cpp.cs:line 72
at Il2CppDumper.Il2Cpp.AutoInit(UInt64 codeRegistration, UInt64 metadataRegistration) in C:\projects\il2cppdumper\Il2CppDumper\Il2Cpp\Il2Cpp.cs:line 65
at Il2CppDumper.Macho64.PlusSearch(Int32 methodCount, Int32 typeDefinitionsCount) in C:\projects\il2cppdumper\Il2CppDumper\ExecutableFormats\Macho64.cs:line 198
at Il2CppDumper.Program.Init(Byte[] il2cppBytes, Byte[] metadataBytes, Metadata& metadata, Il2Cpp& il2Cpp) in C:\projects\il2cppdumper\Il2CppDumper\Program.cs:line 175
ERROR: An error occurred while processing.
大佬我想知道手游的角色台词在哪个文件(global-metadata.dat里找不到
),怎么查看? 
为什么更改格式
I was wondering why you changed the format of the cs file
it was like this with the string and offset on the same line
public static WeeklyEvent get_ActiveWeeklyEvent() { } // RVA: 0x12C693C Offset: 0x12C693C
but now you have split this into two lines and changed the order like this
// RVA: 0x12C693C Offset: 0x12C693C VA: 0x77FFA2E93C
public static WeeklyEvent get_ActiveWeeklyEvent() { }
this seems illogical and makes automated parsing of the file quite a pain
大佬UEAB下载不到了 能否发一下给我124733292@qq.com 感激不尽
Assembly-CSharp.dll没有加密也没有global-metadata.dat 怎么用这个软件dump看结构 类名 偏移呢?
请问解压出来的 Assembly-CSharp.dll 怎么打包回so文件 …..
想搞一下最近出来的公主连接
有什么思路么? 兄弟。貌似有成品出来了。
无思路+1
最近的成品都是用GG运行lua脚本 更改内存. 这种很容易检测.
Android republic有直装的说明已经有dump的可行思路了
么有VIP 没法下载.
之前看过hearthbuddy在Windows上的操作. 是通过RemoteThread 注入 反编译指令完成的.
Android这种dump也是利用android上的某些特性才对.
AR的封包数据修改,不是修改客户端。。。

是这样啊 打扰了
同问这种被保护的so文件怎么dump,谢谢大佬
大佬本人萌新 用gg脱出il2cpp之后用dump不出来提示被保护之后要怎么操作?
我也是萌新,请问怎么用gg脱出il2cpp?
大佬你在github上说被保护的so文件需要用gg从内存dump出来
要怎么dump。。。。
能出个dump,so 以及怎么找到那个地址多教程吗
使用ida_with_struct.py 并依次选择 stringliteral.json il2cpp.h 后,ida报
ida_with_struct.py: parse_decls expected 4 arguments, got 2
Traceback (most recent call last):
File “省略路径\ida_idaapi.py”, line 553, in IDAPython_ExecScript
execfile(script, g)
File “省略路径/ida_with_struct.py”, line 25, in
parse_decls(open(hpath, ‘rb’).read(), 0)
File “省略路径\ida_typeinf.py”, line 2205, in parse_decls
return _ida_typeinf.parse_decls(*args)
TypeError: parse_decls expected 4 arguments, got 2
能提供一下解决思路么,感谢
请使用7.0以上版本的ida
额。之前懒省事,没有改路径名称,实际版本是7.0.17.914版本
重新尝试了下,可能跟我选择的情况有问题有关,我这次选择顺序是ida_with_struct.py ->script.json ->il2cpp.h这样的顺序
之前是ida_with_struct.py ->stringliteral.json ->il2cpp.h 前者顺序是对的么?
选择框顶上不是有告诉你选什么文件吗
的确有,抱歉,疏忽了。
作者,新的24.2版好像用不了,全出错了
有问题请上传文件,就发个错误信息我怎么知道什么原因
大佬,新版本报错了
Il2CppDumper v6.4.19
Il2Cpp Version: 24.2
Initializing metadata…
Metadata Version: 24.2
Initializing il2cpp file…
Il2Cpp Version: 24.2
Searching…
CodeRegistration : 10337efd8
MetadataRegistration : 10342cfa0
Dumping…
ERROR: Some errors in dumping
ERROR: Some errors in dumping
ERROR: Some errors in dumping
Done!
Generate script…
System.ArgumentOutOfRangeException
大佬。用你的Il2CppDumper v6.1.0给il2cpp.so dump出来后,用ida反编译il2cpp.so
完成后导入il2cpp.so的脚本,到这里就没有可以导入的脚本了,这个版本怎么导入呢,求大佬指教一下。
大佬你好,之前你所写的双生视界的Live2d提取方法能用到约战.精灵再临这款游戏里的看板提取吗,
我怀疑它里面的physics3文件也经过了加密,可我不知道怎么解出来,游戏虽然不怎么样但它里面的高级看板还是挺精美的,求大佬解答
感谢大佬
大佬的博文让我受益匪浅
双生视界dump不出来,出现下面错误,请问是什么原因
Initializing metadata…
Metadata Version: 24.1
Initializing il2cpp file…
Applying relocations…
WARNING: find .init_proc
ERROR: This file may be protected.
Il2Cpp Version: 24.1
Searching…
CodeRegistration : 3ca5074
MetadataRegistration : 3ca50ac
System.IndexOutOfRangeException: 索引超出了数组界限。
在 Il2CppDumper.Il2Cpp.Init(UInt64 codeRegistration, UInt64 metadataRegistration)
在 Il2CppDumper.Il2Cpp.AutoInit(UInt64 codeRegistration, UInt64 metadataRegistration)
在 Il2CppDumper.Program.Init(Byte[] il2cppBytes, Byte[] metadataBytes, Metadata& metadata, Il2Cpp& il2Cpp)
ERROR: An error occurred while processing.
自己看第六行
这种被保护的文件怎么搞
ghidra的脚本要怎么用?我下了ghidra最新版,但是不知道怎么导入这个脚本。直接导入的话,选择Language应该选哪个?
Window-Script Manager-添加脚本所在的文件夹,然后过滤ghidra.py
谢谢大佬
dll导出来只有方法名没有具体内容
第一次用?建议百度一下il2cpp是什么东西 什么概念
第一!