Skip to content

Commit

Permalink
Remove useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
chiteroman committed Aug 25, 2024
1 parent ca3c717 commit a96220b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 34 deletions.
45 changes: 13 additions & 32 deletions app/src/main/cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,26 @@ static void modify_callback(void *cookie, const char *name, const char *value, u

std::string_view prop(name);

bool print = false;

if (prop == "init.svc.adbd") {
value = "stopped";
if (!DEBUG) LOGD("[%s]: %s", name, value);
print = true;
} else if (prop == "sys.usb.state") {
value = "mtp";
if (!DEBUG) LOGD("[%s]: %s", name, value);
print = true;
} else if (prop.ends_with("api_level") && !DEVICE_INITIAL_SDK_INT.empty()) {
value = DEVICE_INITIAL_SDK_INT.c_str();
if (!DEBUG) LOGD("[%s]: %s", name, value);
print = true;
} else if (prop.ends_with(".security_patch") && !SECURITY_PATCH.empty()) {
value = SECURITY_PATCH.c_str();
if (!DEBUG) LOGD("[%s]: %s", name, value);
print = true;
} else if (prop.ends_with(".build.id") && !BUILD_ID.empty()) {
value = BUILD_ID.c_str();
if (!DEBUG) LOGD("[%s]: %s", name, value);
print = true;
}

if (DEBUG) LOGD("[%s]: %s", name, value);
if (print || DEBUG) LOGD("[%s]: %s", name, value);

return o_callback(cookie, name, value, serial);
}
Expand Down Expand Up @@ -184,8 +186,7 @@ class PlayIntegrityFix : public zygisk::ModuleBase {
parseJSON();

if (trickyStore) {
LOGD("TrickyStore module installed and enabled, disabling spoofBuild (Java), spoofProps and spoofProvider");
spoofBuild = false;
LOGD("TrickyStore module installed and enabled, disabling spoofProps and spoofProvider");
spoofProps = false;
spoofProvider = false;
}
Expand All @@ -194,14 +195,14 @@ class PlayIntegrityFix : public zygisk::ModuleBase {
void postAppSpecialize(const zygisk::AppSpecializeArgs *args) override {
if (dexVector.empty()) return;

if (spoofBuildZygisk) UpdateBuildFields();
UpdateBuildFields();

if (spoofProps) doHook();
else api->setOption(zygisk::DLCLOSE_MODULE_LIBRARY);

if (spoofBuild || spoofProvider || spoofSignature) injectDex();
if (spoofProvider || spoofSignature) injectDex();
else
LOGD("Don't inject dex: spoofBuild (Java), spoofProvider and spoofSignature are false");
LOGD("Dex file won't be injected due spoofProvider and spoofSignature are false");

cJSON_Delete(json);
dexVector.clear();
Expand All @@ -217,8 +218,6 @@ class PlayIntegrityFix : public zygisk::ModuleBase {
JNIEnv *env = nullptr;
std::vector<uint8_t> dexVector;
cJSON *json = nullptr;
bool spoofBuild = true;
bool spoofBuildZygisk = true;
bool spoofProps = true;
bool spoofProvider = true;
bool spoofSignature = false;
Expand All @@ -230,9 +229,6 @@ class PlayIntegrityFix : public zygisk::ModuleBase {
const cJSON *security_patch = cJSON_GetObjectItemCaseSensitive(json, "SECURITY_PATCH");
const cJSON *build_id = cJSON_GetObjectItemCaseSensitive(json, "ID");
const cJSON *isDebug = cJSON_GetObjectItemCaseSensitive(json, "DEBUG");
const cJSON *spoof_build = cJSON_GetObjectItemCaseSensitive(json, "spoofBuild");
const cJSON *spoof_build_zygisk = cJSON_GetObjectItemCaseSensitive(json,
"spoofBuildZygisk");
const cJSON *spoof_props = cJSON_GetObjectItemCaseSensitive(json, "spoofProps");
const cJSON *spoof_provider = cJSON_GetObjectItemCaseSensitive(json, "spoofProvider");
const cJSON *spoof_signature = cJSON_GetObjectItemCaseSensitive(json, "spoofSignature");
Expand All @@ -259,16 +255,6 @@ class PlayIntegrityFix : public zygisk::ModuleBase {
cJSON_DeleteItemFromObjectCaseSensitive(json, "DEBUG");
}

if (spoof_build && cJSON_IsBool(spoof_build)) {
spoofBuild = cJSON_IsTrue(spoof_build);
cJSON_DeleteItemFromObjectCaseSensitive(json, "spoofBuild");
}

if (spoof_build_zygisk && cJSON_IsBool(spoof_build_zygisk)) {
spoofBuildZygisk = cJSON_IsTrue(spoof_build_zygisk);
cJSON_DeleteItemFromObjectCaseSensitive(json, "spoofBuildZygisk");
}

if (spoof_props && cJSON_IsBool(spoof_props)) {
spoofProps = cJSON_IsTrue(spoof_props);
cJSON_DeleteItemFromObjectCaseSensitive(json, "spoofProps");
Expand Down Expand Up @@ -310,12 +296,7 @@ class PlayIntegrityFix : public zygisk::ModuleBase {

LOGD("call init");
auto entryInit = env->GetStaticMethodID(entryPointClass, "init", "(Ljava/lang/String;ZZ)V");
jstring jsonStr;
if (spoofBuild) {
jsonStr = env->NewStringUTF(cJSON_Print(json));
} else {
jsonStr = env->NewStringUTF("");
}
auto jsonStr = env->NewStringUTF(cJSON_Print(json));
env->CallStaticVoidMethod(entryPointClass, entryInit, jsonStr, spoofProvider,
spoofSignature);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ private static void spoofProvider() {

CustomKeyStoreSpi.keyStoreSpi = (KeyStoreSpi) keyStoreSpi.get(keyStore);

keyStoreSpi.setAccessible(false);

} catch (Throwable t) {
Log.e(TAG, "Couldn't get keyStoreSpi field!", t);
}
Expand Down
2 changes: 0 additions & 2 deletions module/pif.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"PRODUCT": "akita_beta",
"SECURITY_PATCH": "2024-08-05",
"DEVICE_INITIAL_SDK_INT": 21,
"spoofBuild": true,
"spoofBuildZygisk": true,
"spoofProps": true,
"spoofProvider": true,
"spoofSignature": false
Expand Down

0 comments on commit a96220b

Please sign in to comment.