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 { externalNativeBuild {
cmake { cmake {
arguments += "-DANDROID_STL=none" arguments += "-DANDROID_STL=none"
arguments += "-DCMAKE_BUILD_TYPE=Release" arguments += "-DCMAKE_BUILD_TYPE=MinSizeRel"
cppFlags += "-std=c++20" cppFlags += "-std=c++20"
cppFlags += "-fno-exceptions" cppFlags += "-fno-exceptions"

View File

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

View File

@ -2,6 +2,8 @@ package es.chiteroman.playintegrityfix;
import java.security.Provider; import java.security.Provider;
import java.security.ProviderException; import java.security.ProviderException;
import java.util.Arrays;
import java.util.Locale;
public final class CustomProvider extends Provider { public final class CustomProvider extends Provider {
@ -14,7 +16,14 @@ public final class CustomProvider extends Provider {
public synchronized Service getService(String type, String algorithm) { public synchronized Service getService(String type, String algorithm) {
EntryPoint.spoofDevice(); 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); return super.getService(type, algorithm);
} }

View File

@ -31,8 +31,7 @@ public final class EntryPoint {
reader.endObject(); reader.endObject();
} catch (Exception e) { } catch (Exception e) {
LOG("Couldn't parse JSON from Zygisk lib: " + e); LOG("Couldn't parse JSON from Zygisk lib: " + e);
LOG("Using default values!"); LOG("Remove /data/adb/pif.json");
setDefValues();
} }
spoofDevice(); spoofDevice();
@ -47,16 +46,6 @@ public final class EntryPoint {
map.forEach(EntryPoint::setFieldValue); 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() { private static void spoofProvider() {
try { try {
Provider provider = Security.getProvider("AndroidKeyStore"); Provider provider = Security.getProvider("AndroidKeyStore");

View File

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

View File

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

View File

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