LuckyPray / DexKit

An easy-to-use, high-performance dex deobfuscation library.
https://luckypray.org/DexKit/
GNU Lesser General Public License v3.0
461 stars 57 forks source link

如何搜索数字? #13

Closed GuhDoy closed 1 year ago

GuhDoy commented 1 year ago
package io.luckypray.dexkit.demo;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        int i = 1145;
    }
}

例如,查找这段代码中使用了 R.layout.activity_main 或 1145 的方法

teble commented 1 year ago

暂未支持数字搜索(感觉平时没用上就没写),目前重构已经上排期了,后续会支持更详细的搜索

teble commented 1 year ago

R.layout.activity_main这种值会在R8编译时内联进去,field的搜索是支持的,但是静态数字常量就没支持

teble commented 1 year ago

尝试更新依赖版本为1.1.5以使用 FindMethodUsingNumber

GuhDoy commented 1 year ago

好快,谢谢作者!

teble commented 1 year ago

不过目前的查找没搜索.array-data初始化的数据,仅仅查找了const,const-wide,binop/lit16以及binop/lit8的opcode调用。 有bug随时提出,总感觉有点小问题,对于const以及const-wide是支持任意32/64位数据,然后我对比的时候全部强转成int64_t处理了,不知道在特定情况下会不会有bug

teble commented 1 year ago

1.1.5 把 binop/high16 过滤掉了,搜索结果不完整,1.1.6已修复

GuhDoy commented 1 year ago

在我的用例中未发现问题