Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

求助:请问ArrayList<Pair<String, String>> 要怎么构造传参啊? 真心求救啊 #703

Open
oybo opened this issue Nov 27, 2024 · 2 comments

Comments

@oybo
Copy link

oybo commented Nov 27, 2024

`public final class SensorDataBuilder {

/* renamed from: a, reason: collision with root package name */
private static final SensorDataBuilder f1140a = new SensorDataBuilder();

public native synchronized String buildN(ArrayList<Pair<String, String>> arrayList);

public native synchronized void initializeKeyN();

SensorDataBuilder() {
}

static {
    System.loadLibrary("akamaibmp");
}

public static SensorDataBuilder a() {
    return f1140a;
}

}`

这是Java的源代码, 自己在Android Studio里已经跑通了,unidbg一直报错,来个好人帮帮忙一下,谢谢, 附上unidbg代码

`public class AkaMaiUtils extends TestCase {

// 静态属性, 以后对象和类都可以直接使用
public static AndroidEmulator emulator;
public static Memory memory;
public static VM vm;
public static Module module;

private DvmClass SensorDataBuilder;

// 1.创建设备(32位或64位模拟器), 具体看so文件在哪个目录。 在armeabi-v7a就选择32位
// 传进设备时,如果是32位,后面so文件就要用32位,同理需要用64位的
// 这个名字可以随便写,一般写成app的包名    以后可能会动
private static AndroidEmulator createARMEmulator() {
    return AndroidEmulatorBuilder.for64Bit()
            .setProcessName("id.dana")
            .addBackendFactory(new HypervisorFactory(true))
            .addBackendFactory(new DynarmicFactory(true))
            .addBackendFactory(new KvmFactory(true))
            .addBackendFactory(new Unicorn2Factory(true))
            .build();
}

public AkaMaiUtils() {
    emulator = createARMEmulator();

    // 2 获取内存对象(可以操作内存)
    memory = emulator.getMemory();

    // 3.设置安卓sdk版本(只支持19、23)
    memory.setLibraryResolver(new AndroidResolver(23));

    // 4.创建虚拟机
    vm = emulator.createDalvikVM(new File("unidbg-android/src/test/java/com/id/dana/base.apk"));
    vm.setDvmClassFactory(new ProxyClassFactory());
    Module module = new JniGraphics(emulator, vm).register(memory);
    assert module != null;
    new AndroidModule(emulator, vm).register(memory);

    System.out.println("backend=" + emulator.getBackend());
    // 是否展示调用过程的细节
    vm.setVerbose(true);

    // 5.加载so文件
    DalvikModule dm = vm.loadLibrary(new File("unidbg-android/src/test/resources/example_binaries/arm64-v8a/libakamaibmp.so"), true);
    // jni开发动态注册,会执行JNI_OnLoad,如果是动态注册,需要执行一下这个,如果静态注册,这个不需要执行,车智赢案例是静态注册
    dm.callJNI_OnLoad(emulator);

    // 1 找到java中 jni的类 native 类,必须用固定的写法写
    // 只要拿类,就要使用这个方法写,使用resolveClass把它包裹起来,中间用 /  区分
    SensorDataBuilder = vm.resolveClass("com/cyberfend/cyfsecurity/SensorDataBuilder");
}


public void initializeKeyN() {
    SensorDataBuilder.callStaticJniMethodObject(emulator, "initializeKeyN()V;");
}

public void loadAcfSensorData(ArrayList<Pair<String, String>> arrayList) {
    // 2 找到类中的方法--》固定写法
    // 方法名(参数签名)返回值签名
    String method = "buildN(Ljava/util/ArrayList;)Ljava/lang/String;";

    // 3 执行方法---》
    // 第一个参数:设备对象emulator
    // 第二个参数:方法的签名字符串 method
    // 再往后的参数,是 执行方法时,需要传入的参数,按位置一个个传即可
    StringObject obj = SensorDataBuilder.callStaticJniMethodObject(
            emulator,
            method,
            ProxyDvmObject.createObject(vm, arrayList)
    );

    if (obj == null) {
        System.out.println("null");
        return;
    }

    // 4 执行,得到结果--》拿到真正的字符串
    String result = obj.getValue();

    System.out.println(result);
}

public static void main(String[] args) {
    String str4 = "-1,uaend,-1,2138,1080,1,100,1,zh,13,0,Pixel%205,r3-0.5-9825705,redfin,-1,id.dana,-1,-1,675a3151979cdc17,-1,0,1,REL,10753682,33,Google,redfin,release-keys,user,android-build,TQ3A.230901.001.C2,redfin,google,redfin,google/redfin/redfin:13/TQ3A.230901.001.C2/10753682:user/release-keys,abfarm-release-rbe-64-2004-0087,TQ3A.230901.001.C2,24251," + (new Random().nextInt()) + "," + (System.currentTimeMillis() / 2);
    ;
    String str13 = "0,0,9203824534,10257383882,19461208416,5141,0,0,16,32,4000,69000,1,534442084525874521,1732612534629";
    String str16 = "2;197.00;206.00;1508325726;}NUN2U2NUN2U[A2U";
    String str15 = "2;162.25;164.04;3692044364;jkAFNAho2RM}rbUb:2;0.42;0.44;3897489093;Ag2jpt}ymgc_felr:2;0.14;0.17;1614258331;}XWRUVSNPILF4A";
    String str18 = "2;100.00;173.00;3737351720;}AKDG2DH2DKACKACAD2G2AGA2G2HGAGH";
    String str17 = "2;-0.01;0.01;2521393416;NVZ]_ojhpjrZ.c.}hcoMlsgAZVkem_ge:2;-0.01;0.01;2493138815;FRb}h]UJARPA_fIYPEIEH[X[Q`cd2FR.:2;-0.01;0.01;968258611;`S_lunMXfHbh.tdLJV}oYH.DUkyjVA[c:2;0.02;0.04;1949850514;OU2Y[mjfojqUY]W}jdoJhsjA[Shbo^jh:2;-0.08;-0.06;123839341;JR_}i_XNF2PA^gL^VJLBF2^_Te2g2N.e:2;-9.79;-9.77;798731051;eZcq}xS_lQejavhQNSzq_LaGXozjXAah:2;-0.08;0.08;37534592;AYeYe}eq2Se2SYSL2_q2_q}ke2S2q2eS:2;-0.09;0.06;606135540;kYSqe_}_wGMkekwYS_e2SAkAe2kSekwe:2;-0.12;0.15;758503966;_i[i_[Q[}KUA_[vobQNiQb[DU_il_bDQ";

    str4 = "-1,uaend,-1,2138,1080,1,100,1,zh,13,0,Pixel%205,r3-0.5-9825705,redfin,-1,id.dana,-1,-1,675a3151979cdc17,-1,0,1,REL,10753682,33,Google,redfin,release-keys,user,android-build,TQ3A.230901.001.C2,redfin,google,redfin,google/redfin/redfin:13/TQ3A.230901.001.C2/10753682:user/release-keys,abfarm-release-rbe-64-2004-0087,TQ3A.230901.001.C2,24251,1452811832,866309695840";
    str13 = "0,0,8601107245,20652576565,29253683810,5226,0,0,16,32,2000,97000,1,538415093425534208,1732619391681";
    str16 = "2;199.00;333.00;1045601098;}15A";
    str15 = "2;161.73;164.38;3938549094;PlPINa}`A.AYzWZX:2;0.42;0.43;828640393;AKQL^ixq|}xdUSHL:2;0.14;0.14;3833885034;mqhxRAGSNK2.^dp}";
    str18 = "2;51.00;191.00;2762039603;A}2WV.VY2W[WYWVWVWVYVYV5YV3Y";
    str17 = "2;-0.01;0.01;2320215201;kpd[XJUP[YXldRbfn]CB]ZoTJZnQq}AM:2;-0.01;0.01;3095260567;ebhef}eAkosdv[dvgmZq{^etH^mbpmbk:2;-0.01;0.01;3382244862;IG}W2V]HMeRAVeZEZXQfYVWVY^SEw[UQ:2;0.02;0.03;1172726032;moe[XKPKX2Se`KX`j[2A]UmSHXmSo}AK:2;-0.08;-0.06;2410362480;2a2gc}hAgnsauZauejXp{.arH.lc2lcn:2;-9.79;-9.77;3271721546;2D}X2V.FNeVATgZB2ZRi^_2^._RDuZTN:2;-0.08;0.09;2046954083;wFgQ2gFQ3.QlV.Ag.g}F.Vl2.2VQAgl:2;-0.12;0.08;1265490177;.2sjNe.a.X.Soxeo2aA.o.SE2eSxosS}:2;-0.11;0.12;1687603584;Y]Y]QYU]l]2EAeYUaIYlUI]EQuY}Ye2]";

    ArrayList<Pair<String, String>> arrayList = new ArrayList<>();
    arrayList.add(new Pair<>("", "3.3.0"));
    arrayList.add(new Pair<>("-70", ""));
    arrayList.add(new Pair<>("-80", ""));
    arrayList.add(new Pair<>("-100", str4));
    arrayList.add(new Pair<>("-101", "do_en,dm_en,t_en"));
    arrayList.add(new Pair<>("-102", ""));
    arrayList.add(new Pair<>("-103", ""));
    arrayList.add(new Pair<>("-108", ""));
    arrayList.add(new Pair<>("-112", getPerformance()));
    arrayList.add(new Pair<>("-115", str13));
    arrayList.add(new Pair<>("-117", ""));
    arrayList.add(new Pair<>("-120", ""));
    arrayList.add(new Pair<>("-121", ""));
    arrayList.add(new Pair<>("-144", str16));
    arrayList.add(new Pair<>("-142", str15));
    arrayList.add(new Pair<>("-145", str18));
    arrayList.add(new Pair<>("-143", str17));
    arrayList.add(new Pair<>("-150", "1,0"));


    AkaMaiUtils akaMaiUtils = new AkaMaiUtils();
    akaMaiUtils.initializeKeyN();
    akaMaiUtils.loadAcfSensorData(arrayList);
}

private static long getSystemUptimeMillis() {
    return System.nanoTime() / 1_000_000L;
}

public static String getPerformance() {
    int i;
    try {
        long uptimeMillis = getSystemUptimeMillis();
        int i2 = 1;
        int i3 = 0;
        int i4 = 0;
        while (true) {
            if (i2 >= 1000000) {
                break;
            }
            if (((4508713 % i2) * 11) % i2 == 0) {
                i3++;
            }
            if (i2 % 100 == 0 && getSystemUptimeMillis() - uptimeMillis > 2) {
                break;
            }
            i4++;
            i2++;
        }
        int i5 = i4 / 100;
        float f = 33.34f;
        long uptimeMillis2 = getSystemUptimeMillis();
        int i6 = 0;
        int i7 = 0;
        for (int i8 = 1; i8 < 1000000; i8++) {
            f += i8;
            if ((19.239f * f) / 3.56f < 10000.0f) {
                i6++;
            }
            if (i8 % 100 == 0 && getSystemUptimeMillis() - uptimeMillis2 > 2) {
                break;
            }
            i7++;
        }
        int i9 = i7 / 100;
        long uptimeMillis3 = getSystemUptimeMillis();
        int i10 = 0;
        int i11 = 0;
        for (double d = 1.0d; d < 1000000.0d; d += 1.0d) {
            if (Math.sqrt(d) > 30.0d) {
                i10++;
            }
            if (((int) d) % 100 == 0 && getSystemUptimeMillis() - uptimeMillis3 > 2) {
                break;
            }
            i11++;
        }
        int i12 = i10;
        int i13 = i11 / 100;
        long uptimeMillis4 = getSystemUptimeMillis();
        int i14 = 1;
        int i15 = 0;
        int i16 = 0;
        for (i = 1000000; i14 < i; i = 1000000) {
            long j = uptimeMillis4;
            if (Math.acos(i14 / i) + Math.asin(i14 / i) + Math.atan(i14 / 1000000) > 1.5d) {
                i15++;
            }
            if (i14 % 100 == 0 && getSystemUptimeMillis() - j > 2) {
                break;
            }
            i16++;
            i14++;
            uptimeMillis4 = j;
        }
        int i17 = i16 / 100;
        long uptimeMillis5 = getSystemUptimeMillis();
        int i18 = 0;
        for (int i19 = 1; i19 < 1000000 && getSystemUptimeMillis() - uptimeMillis5 <= 2; i19++) {
            i18++;
        }
        return i3 + "," + i5 + "," + i6 + "," + i9 + "," + i12 + "," + i13 + "," + i15 + "," + i17 + "," + i18;
    } catch (Exception e) {
        return "-1,-1,-1,-1,-1,-1,-1,-1,-1";
    }
}

private void destroy() throws IOException {
    emulator.close();
}

@Override
protected void tearDown() throws Exception {
    super.tearDown();
    destroy();
}

}

`

@maomao0122
Copy link

同求解决方法

@oybo
Copy link
Author

oybo commented Dec 13, 2024

同求解决方法

上面我发的问题,我自己琢磨出来了, 你可以把你的问题发出来。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants