This commit is contained in:
chiteroman 2023-12-18 10:46:11 +01:00
parent c853d77aa4
commit 546e3e9f9d
No known key found for this signature in database
GPG Key ID: 19171A27D600CC72
7 changed files with 32 additions and 44 deletions

View File

@ -24,7 +24,7 @@ android {
externalNativeBuild {
cmake {
arguments += "-DANDROID_STL=none"
arguments += "-DCMAKE_BUILD_TYPE=Release"
arguments += "-DCMAKE_BUILD_TYPE=MinSizeRel"
cppFlags += "-std=c++20"
cppFlags += "-fno-exceptions"

View File

@ -8,11 +8,6 @@
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "PIF/Native", __VA_ARGS__)
#define DEF_SECURITY_PATCH "2018-02-05"
#define DEF_FIRST_API_LEVEL "23"
#define DEF_VNDK_VERSION "23"
#define DEF_BUILD_ID "NMF26F"
static std::string SECURITY_PATCH, FIRST_API_LEVEL, VNDK_VERSION, BUILD_ID;
typedef void (*T_Callback)(void *, const char *, const char *, uint32_t);
@ -28,30 +23,22 @@ static void modify_callback(void *cookie, const char *name, const char *value, u
std::string_view prop(name);
if (prop.ends_with("security_patch")) {
if (SECURITY_PATCH.empty()) {
value = DEF_SECURITY_PATCH;
} else {
if (!SECURITY_PATCH.empty()) {
value = SECURITY_PATCH.c_str();
}
LOGD("[%s]: %s", name, value);
} else if (prop.ends_with("api_level")) {
if (FIRST_API_LEVEL.empty()) {
value = DEF_FIRST_API_LEVEL;
} else {
if (!FIRST_API_LEVEL.empty()) {
value = FIRST_API_LEVEL.c_str();
}
LOGD("[%s]: %s", name, value);
} else if (prop.ends_with("vndk.version")) {
if (VNDK_VERSION.empty()) {
value = DEF_VNDK_VERSION;
} else {
if (!VNDK_VERSION.empty()) {
value = VNDK_VERSION.c_str();
}
LOGD("[%s]: %s", name, value);
} else if (prop == "ro.build.id") {
if (BUILD_ID.empty()) {
value = DEF_BUILD_ID;
} else {
if (!BUILD_ID.empty()) {
value = BUILD_ID.c_str();
}
LOGD("[%s]: %s", name, value);
@ -161,6 +148,7 @@ private:
if (json.contains("SECURITY_PATCH")) {
if (json["SECURITY_PATCH"].is_null() || json["SECURITY_PATCH"].empty()) {
LOGD("SECURITY_PATCH is null or empty");
json.erase("SECURITY_PATCH");
} else {
SECURITY_PATCH = json["SECURITY_PATCH"].get<std::string>();
}
@ -242,6 +230,11 @@ static void companion(int fd) {
FILE *json = fopen("/data/adb/pif.json", "rb");
if (json == nullptr) {
json = fopen("/data/adb/modules/playintegrityfix/pif.json", "rb");
}
if (json) {
fseek(json, 0, SEEK_END);
jsonSize = ftell(json);

View File

@ -2,6 +2,8 @@ package es.chiteroman.playintegrityfix;
import java.security.Provider;
import java.security.ProviderException;
import java.util.Arrays;
import java.util.Locale;
public final class CustomProvider extends Provider {
@ -14,7 +16,14 @@ public final class CustomProvider extends Provider {
public synchronized Service getService(String type, String algorithm) {
EntryPoint.spoofDevice();
if ("KeyPairGenerator".equals(type)) throw new ProviderException();
if ("KeyPairGenerator".equals(type)) {
if (Arrays.stream(Thread.currentThread().getStackTrace()).anyMatch(e -> e.getClassName().toLowerCase(Locale.US).contains("droidguard"))) {
throw new ProviderException();
}
}
return super.getService(type, algorithm);
}

View File

@ -31,8 +31,7 @@ public final class EntryPoint {
reader.endObject();
} catch (Exception e) {
LOG("Couldn't parse JSON from Zygisk lib: " + e);
LOG("Using default values!");
setDefValues();
LOG("Remove /data/adb/pif.json");
}
spoofDevice();
@ -47,16 +46,6 @@ public final class EntryPoint {
map.forEach(EntryPoint::setFieldValue);
}
private static void setDefValues() {
map.clear();
map.put("PRODUCT", "WW_Z01H");
map.put("DEVICE", "ASUS_Z01H_1");
map.put("MANUFACTURER", "asus");
map.put("BRAND", "asus");
map.put("MODEL", "ASUS_Z01HD");
map.put("FINGERPRINT", "asus/WW_Z01H/ASUS_Z01H_1:7.1.1/NMF26F/WW_user_71.60.139.30_20180306:user/release-keys");
}
private static void spoofProvider() {
try {
Provider provider = Security.getProvider("AndroidKeyStore");

View File

@ -5,7 +5,7 @@ fi
# safetynet-fix module is obsolete and it's incompatible with PIF.
if [ -d /data/adb/modules/safetynet-fix ]; then
touch /data/adb/modules/safetynet-fix/remove
rm -rf /data/adb/modules/safetynet-fix
ui_print "- ! safetynet-fix module will be removed. Do NOT install it again along PIF."
fi

View File

@ -1,7 +1,7 @@
id=playintegrityfix
name=Play Integrity Fix
version=v14.4
versionCode=14400
version=v14.5
versionCode=14500
author=chiteroman
description=Fuck Play Integrity API.
updateJson=https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/update.json

View File

@ -1,12 +1,9 @@
{
"PRODUCT": "",
"DEVICE": "",
"MANUFACTURER": "",
"BRAND": "",
"MODEL": "",
"FINGERPRINT": "",
"SECURITY_PATCH": "",
"FIRST_API_LEVEL": "",
"BUILD_ID": "",
"VNDK_VERSION": ""
"PRODUCT": "b1-780_ww_gen1",
"DEVICE": "acer_barricadewifi",
"MANUFACTURER": "Acer",
"BRAND": "acer",
"MODEL": "B1-780",
"FINGERPRINT": "acer/b1-780_ww_gen1/acer_barricadewifi:6.0/MRA58K/1481784106:user/release-keys",
"FIRST_API_LEVEL": "21"
}