MCPcopy Create free account
hub / github.com/axhlzy/Il2CppHookScripts / getApkInfo

Function getApkInfo

Il2cppHook/_Ufunc.js:7672–7737  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7670const fastest_levenshtein_1 = require("fastest-levenshtein");
7671const formart_1 = require("../utils/formart");
7672function getApkInfo() {
7673 Java.perform(() => {
7674 LOGO(getLine(100));
7675 let context = Java.use('android.app.ActivityThread').currentApplication().getApplicationContext();
7676 let pkgInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
7677 let appInfo = pkgInfo.applicationInfo.value;
7678 let labelRes = appInfo.labelRes.value;
7679 let strName = context.getResources().getString(labelRes);
7680 LOGD("[*]AppName\t\t" + strName + " (UID:" + appInfo.uid.value + ")\t ID:0x" + (appInfo.labelRes.value).toString(16));
7681 let flags = appInfo.flags.value;
7682 LOGZ("\t\t\tBackupable -> " + ((flags & 32768) != 0) + "\t" + "Debugable -> " + ((flags & 2) != 0));
7683 let str_pkgName = context.getPackageName();
7684 LOGD("\n[*]PkgName\t\t" + str_pkgName);
7685 let verName = pkgInfo.versionName.value;
7686 let verCode = pkgInfo.versionCode.value;
7687 let targetSdkVersion = pkgInfo.applicationInfo.value.targetSdkVersion.value;
7688 LOGD("\n[*]Verison\t\t{ " + verName + " / " + verCode + " }\t(targetSdkVersion:" + targetSdkVersion + ")");
7689 let appSize = Java.use("java.io.File").$new(appInfo.sourceDir.value).length();
7690 LOGD("\n[*]AppSize\t\t" + appSize + "\t(" + (appSize / 1024 / 1024).toFixed(2) + " MB)");
7691 LOGD("\n[*]Time\t\t\tInstallTime\t" + new Date(pkgInfo.firstInstallTime.value).toLocaleString());
7692 LOGD("\t\t\tUpdateTime\t" + new Date(pkgInfo.lastUpdateTime.value).toLocaleString());
7693 let ApkLocation = appInfo.sourceDir.value;
7694 let TempFile = appInfo.dataDir.value;
7695 LOGD("\n[*]Location\t\t" + ApkLocation + "\n\t\t\t" + getLibPath() + "\n\t\t\t" + TempFile);
7696 let pis = context.getPackageManager().getPackageInfo(str_pkgName, 0x00000040);
7697 let hexDigist = (pis.signatures.value)[0].toByteArray();
7698 LOGD("\n[*]Signatures\t\tMD5\t " + hexdigest(hexDigist, 'MD5') +
7699 "\n\t\t\tSHA-1\t " + hexdigest(hexDigist, 'SHA-1') +
7700 "\n\t\t\tSHA-256\t " + hexdigest(hexDigist, 'SHA-256'));
7701 LOGD("\n[*]unity.build-id\t" + getMetaData('unity.build-id'));
7702 LOGO(getLine(100));
7703 });
7704 function getMetaData(key) {
7705 let context = Java.use('android.app.ActivityThread').currentApplication().getApplicationContext();
7706 let appInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), 0x00000080);
7707 let metaData = appInfo.metaData.value;
7708 if (null != metaData) {
7709 return metaData.getString(key);
7710 }
7711 return "...";
7712 }
7713 function hexdigest(paramArrayOfByte, algorithm) {
7714 const hexDigits = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102];
7715 let localMessageDigest = Java.use("java.security.MessageDigest").getInstance(algorithm);
7716 localMessageDigest.update(paramArrayOfByte);
7717 let arrayOfByte = localMessageDigest.digest();
7718 let arrayOfChar = [];
7719 for (let i = 0, j = 0;; i++, j++) {
7720 let strLenth = algorithm == "MD5" ? 16 : (algorithm == "SHA-1" ? 20 : 32);
7721 if (i >= strLenth)
7722 return Java.use("java.lang.String").$new(arrayOfChar);
7723 let k = arrayOfByte[i];
7724 arrayOfChar[j] = hexDigits[(0xF & k >>> 4)];
7725 arrayOfChar[++j] = hexDigits[(k & 0xF)];
7726 }
7727 }
7728 function getLibPath(name = undefined) {
7729 let retStr = "";

Callers

nothing calls this directly

Calls 10

performMethod · 0.80
LOGOFunction · 0.70
getLineFunction · 0.70
LOGDFunction · 0.70
LOGZFunction · 0.70
getLibPathFunction · 0.70
hexdigestFunction · 0.70
getMetaDataFunction · 0.70
toStringMethod · 0.65
lengthMethod · 0.45

Tested by

no test coverage detected