New version!

This commit is contained in:
chiteroman 2023-12-05 18:07:32 +01:00
parent 692f342b29
commit 4bbbb169c9
No known key found for this signature in database
GPG Key ID: 19171A27D600CC72
5 changed files with 117 additions and 124 deletions

View File

@ -43,7 +43,7 @@ static void modify_callback(void *cookie, const char *name, const char *value, u
} }
} }
LOGD("[%s]: %s", name, value); if (!prop.starts_with("cache") && !prop.starts_with("debug")) LOGD("[%s]: %s", name, value);
return o_callback(cookie, name, value, serial); return o_callback(cookie, name, value, serial);
} }
@ -129,9 +129,7 @@ public:
LOGD("JSON contains %d keys!", static_cast<int>(json.size())); LOGD("JSON contains %d keys!", static_cast<int>(json.size()));
if (json.contains("SECURITY_PATCH")) { if (json.contains("SECURITY_PATCH")) {
if (json["SECURITY_PATCH"].is_null()) { if (json["SECURITY_PATCH"].is_string()) {
LOGD("Key SECURITY_PATCH is null!");
} else if (json["SECURITY_PATCH"].is_string()) {
SECURITY_PATCH = json["SECURITY_PATCH"].get<std::string>(); SECURITY_PATCH = json["SECURITY_PATCH"].get<std::string>();
} else { } else {
LOGD("Error parsing SECURITY_PATCH!"); LOGD("Error parsing SECURITY_PATCH!");
@ -141,9 +139,7 @@ public:
} }
if (json.contains("FIRST_API_LEVEL")) { if (json.contains("FIRST_API_LEVEL")) {
if (json["FIRST_API_LEVEL"].is_null()) { if (json["FIRST_API_LEVEL"].is_string()) {
LOGD("Key FIRST_API_LEVEL is null!");
} else if (json["FIRST_API_LEVEL"].is_string()) {
FIRST_API_LEVEL = json["FIRST_API_LEVEL"].get<std::string>(); FIRST_API_LEVEL = json["FIRST_API_LEVEL"].get<std::string>();
} else { } else {
LOGD("Error parsing FIRST_API_LEVEL!"); LOGD("Error parsing FIRST_API_LEVEL!");
@ -153,9 +149,7 @@ public:
} }
if (json.contains("BUILD_ID")) { if (json.contains("BUILD_ID")) {
if (json["BUILD_ID"].is_null()) { if (json["BUILD_ID"].is_string()) {
LOGD("Key BUILD_ID is null!");
} else if (json["BUILD_ID"].is_string()) {
BUILD_ID = json["BUILD_ID"].get<std::string>(); BUILD_ID = json["BUILD_ID"].get<std::string>();
} else { } else {
LOGD("Error parsing BUILD_ID!"); LOGD("Error parsing BUILD_ID!");
@ -165,9 +159,7 @@ public:
} }
if (json.contains("VNDK_VERSION")) { if (json.contains("VNDK_VERSION")) {
if (json["VNDK_VERSION"].is_null()) { if (json["VNDK_VERSION"].is_string()) {
LOGD("Key VNDK_VERSION is null!");
} else if (json["VNDK_VERSION"].is_string()) {
VNDK_VERSION = json["VNDK_VERSION"].get<std::string>(); VNDK_VERSION = json["VNDK_VERSION"].get<std::string>();
} else { } else {
LOGD("Error parsing VNDK_VERSION!"); LOGD("Error parsing VNDK_VERSION!");

View File

@ -1,110 +1,111 @@
package es.chiteroman.playintegrityfix; package es.chiteroman.playintegrityfix;
import android.os.Build; import android.os.Build;
import android.util.JsonReader; import android.util.JsonReader;
import android.util.Log; import android.util.Log;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.security.KeyStore; import java.security.KeyStore;
import java.security.KeyStoreException; import java.security.KeyStoreException;
import java.security.KeyStoreSpi; import java.security.KeyStoreSpi;
import java.security.Provider; import java.security.Provider;
import java.security.Security; import java.security.Security;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public final class EntryPoint { public final class EntryPoint {
private static final Map<String, String> map = new HashMap<>(); private static final Map<String, String> map = new HashMap<>();
public static void init(String data) { public static void init(String data) {
try (JsonReader reader = new JsonReader(new StringReader(data))) { try (JsonReader reader = new JsonReader(new StringReader(data))) {
reader.beginObject(); reader.beginObject();
while (reader.hasNext()) { while (reader.hasNext()) {
map.put(reader.nextName(), reader.nextString()); map.put(reader.nextName(), reader.nextString());
} }
reader.endObject(); reader.endObject();
} catch (IOException e) { } catch (IOException e) {
LOG("Couldn't read JSON from Zygisk: " + e); LOG("Couldn't read JSON from Zygisk: " + e);
return; return;
} }
spoofProvider(); spoofProvider();
spoofDevice(); spoofDevice();
} }
private static void spoofProvider() { private static void spoofProvider() {
final String KEYSTORE = "AndroidKeyStore"; final String KEYSTORE = "AndroidKeyStore";
try { try {
Provider provider = Security.getProvider(KEYSTORE); Provider provider = Security.getProvider(KEYSTORE);
KeyStore keyStore = KeyStore.getInstance(KEYSTORE); KeyStore keyStore = KeyStore.getInstance(KEYSTORE);
Field f = keyStore.getClass().getDeclaredField("keyStoreSpi"); Field f = keyStore.getClass().getDeclaredField("keyStoreSpi");
f.setAccessible(true); f.setAccessible(true);
CustomKeyStoreSpi.keyStoreSpi = (KeyStoreSpi) f.get(keyStore); CustomKeyStoreSpi.keyStoreSpi = (KeyStoreSpi) f.get(keyStore);
f.setAccessible(false); f.setAccessible(false);
CustomProvider customProvider = new CustomProvider(provider); CustomProvider customProvider = new CustomProvider(provider);
Security.removeProvider(KEYSTORE); Security.removeProvider(KEYSTORE);
Security.insertProviderAt(customProvider, 1); Security.insertProviderAt(customProvider, 1);
LOG("Spoof KeyStoreSpi and Provider done!"); LOG("Spoof KeyStoreSpi and Provider done!");
} catch (KeyStoreException e) { } catch (KeyStoreException e) {
LOG("Couldn't find KeyStore: " + e); LOG("Couldn't find KeyStore: " + e);
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
LOG("Couldn't find field: " + e); LOG("Couldn't find field: " + e);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
LOG("Couldn't change access of field: " + e); LOG("Couldn't change access of field: " + e);
} }
} }
static void spoofDevice() { static void spoofDevice() {
setProp("PRODUCT", map.get("PRODUCT")); setProp("PRODUCT", map.get("PRODUCT"));
setProp("DEVICE", map.get("DEVICE")); setProp("DEVICE", map.get("DEVICE"));
setProp("MANUFACTURER", map.get("MANUFACTURER")); setProp("MANUFACTURER", map.get("MANUFACTURER"));
setProp("BRAND", map.get("BRAND")); setProp("BRAND", map.get("BRAND"));
setProp("MODEL", map.get("MODEL")); setProp("MODEL", map.get("MODEL"));
setProp("FINGERPRINT", map.get("FINGERPRINT")); setProp("FINGERPRINT", map.get("FINGERPRINT"));
setVersionProp("SECURITY_PATCH", map.get("SECURITY_PATCH")); setProp("ID", map.get("BUILD_ID"));
} setVersionProp("SECURITY_PATCH", map.get("SECURITY_PATCH"));
}
private static void setProp(String name, String value) {
if (name == null || value == null || name.isEmpty() || value.isEmpty()) return; private static void setProp(String name, String value) {
try { if (name == null || value == null || name.isEmpty() || value.isEmpty()) return;
Field field = Build.class.getDeclaredField(name); try {
field.setAccessible(true); Field field = Build.class.getDeclaredField(name);
String oldValue = (String) field.get(null); field.setAccessible(true);
field.set(null, value); String oldValue = (String) field.get(null);
field.setAccessible(false); field.set(null, value);
if (value.equals(oldValue)) return; field.setAccessible(false);
LOG(String.format("[%s]: %s -> %s", name, oldValue, value)); if (value.equals(oldValue)) return;
} catch (NoSuchFieldException e) { LOG(String.format("[%s]: %s -> %s", name, oldValue, value));
LOG(String.format("Couldn't find '%s' field name.", name)); } catch (NoSuchFieldException e) {
} catch (IllegalAccessException e) { LOG(String.format("Couldn't find '%s' field name.", name));
LOG(String.format("Couldn't modify '%s' field value.", name)); } catch (IllegalAccessException e) {
} LOG(String.format("Couldn't modify '%s' field value.", name));
} }
}
private static void setVersionProp(String name, String value) {
if (name == null || value == null || name.isEmpty() || value.isEmpty()) return; private static void setVersionProp(String name, String value) {
try { if (name == null || value == null || name.isEmpty() || value.isEmpty()) return;
Field field = Build.VERSION.class.getDeclaredField(name); try {
field.setAccessible(true); Field field = Build.VERSION.class.getDeclaredField(name);
String oldValue = (String) field.get(null); field.setAccessible(true);
field.set(null, value); String oldValue = (String) field.get(null);
field.setAccessible(false); field.set(null, value);
if (value.equals(oldValue)) return; field.setAccessible(false);
LOG(String.format("[%s]: %s -> %s", name, oldValue, value)); if (value.equals(oldValue)) return;
} catch (NoSuchFieldException e) { LOG(String.format("[%s]: %s -> %s", name, oldValue, value));
LOG(String.format("Couldn't find '%s' field name.", name)); } catch (NoSuchFieldException e) {
} catch (IllegalAccessException e) { LOG(String.format("Couldn't find '%s' field name.", name));
LOG(String.format("Couldn't modify '%s' field value.", name)); } catch (IllegalAccessException e) {
} LOG(String.format("Couldn't modify '%s' field value.", name));
} }
}
static void LOG(String msg) {
Log.d("PIF/Java", msg); static void LOG(String msg) {
} Log.d("PIF/Java", msg);
}
} }

View File

@ -3,5 +3,5 @@ name=Play Integrity Fix (DEV)
version=v1 version=v1
versionCode=1 versionCode=1
author=chiteroman author=chiteroman
description=Fuck Play Integrity API for yourself. description=Fuck Play Integrity API by yourself.
updateJson=https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/dev/update.json updateJson=https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/dev/update.json

View File

@ -9,4 +9,4 @@
"FIRST_API_LEVEL": "", "FIRST_API_LEVEL": "",
"BUILD_ID": "", "BUILD_ID": "",
"VNDK_VERSION": "" "VNDK_VERSION": ""
} }

Binary file not shown.