This commit is contained in:
chiteroman 2024-05-23 11:21:43 +02:00
parent 41a0d6fa61
commit a9ca4a0395
9 changed files with 54 additions and 57 deletions

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="temurin-21" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="corretto-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -16,8 +16,8 @@ android {
applicationId = "es.chiteroman.playintegrityfix"
minSdk = 26
targetSdk = 34
versionCode = 15980
versionName = "v15.9.8"
versionCode = 15990
versionName = "v15.9.9"
multiDexEnabled = false
packaging {

View File

@ -1,7 +1,6 @@
#include <android/log.h>
#include <sys/system_properties.h>
#include <unistd.h>
#include <regex>
#include "dobby.h"
#include "json.hpp"
#include "zygisk.hpp"
@ -14,7 +13,7 @@
#define PIF_JSON_DEFAULT "/data/adb/modules/playintegrityfix/pif.json"
static nlohmann::json PROPS;
static std::string DEVICE_INITIAL_SDK_INT, SECURITY_PATCH, ID;
typedef void (*T_Callback)(void *, const char *, const char *, uint32_t);
@ -24,20 +23,16 @@ static void modify_callback(void *cookie, const char *name, const char *value, u
if (cookie == nullptr || name == nullptr || value == nullptr || o_callback == nullptr) return;
std::string prop(name);
std::string_view prop(name);
for (auto &[key, val]: PROPS.items()) {
if (key.starts_with('*')) {
if (prop.ends_with(key.substr(1))) {
value = val.get<std::string>().c_str();
break;
}
} else {
if (prop == key) {
value = val.get<std::string>().c_str();
break;
}
}
if (prop.ends_with("api_level") && !DEVICE_INITIAL_SDK_INT.empty()) {
value = DEVICE_INITIAL_SDK_INT.c_str();
} else if (prop.ends_with(".security_patch") && !SECURITY_PATCH.empty()) {
value = SECURITY_PATCH.c_str();
} else if (prop.ends_with(".id") && !ID.empty()) {
value = ID.c_str();
} else if (prop == "sys.usb.state") {
value = "none";
}
if (!prop.starts_with("persist") && !prop.starts_with("cache") && !prop.starts_with("debug")) {
@ -143,16 +138,13 @@ public:
close(fd);
json = nlohmann::json::parse(jsonVector, nullptr, false, true);
if (json.contains("PROPS")) {
PROPS = json["PROPS"];
json.erase("PROPS");
}
}
void postAppSpecialize(const zygisk::AppSpecializeArgs *args) override {
if (dexVector.empty() || json.empty()) return;
parseJson();
injectDex();
doHook();
@ -168,6 +160,19 @@ private:
std::vector<uint8_t> dexVector;
nlohmann::json json;
void parseJson() {
if (json.contains("DEVICE_INITIAL_SDK_INT")) {
DEVICE_INITIAL_SDK_INT = json["DEVICE_INITIAL_SDK_INT"].get<std::string>();
json.erase("DEVICE_INITIAL_SDK_INT"); // You can't modify field value
}
if (json.contains("SECURITY_PATCH")) {
SECURITY_PATCH = json["SECURITY_PATCH"].get<std::string>();
}
if (json.contains("ID")) {
ID = json["ID"].get<std::string>();
}
}
void injectDex() {
LOGD("get system classloader");
auto clClass = env->FindClass("java/lang/ClassLoader");

View File

@ -10,7 +10,6 @@ import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.util.Arrays;
import java.util.Date;
import java.util.Enumeration;
import java.util.Locale;
@ -26,10 +25,11 @@ public final class CustomKeyStoreSpi extends KeyStoreSpi {
@Override
public Certificate[] engineGetCertificateChain(String alias) {
if (Arrays.stream(Thread.currentThread().getStackTrace()).anyMatch(e -> e.getClassName().toLowerCase(Locale.US).contains("droidguard"))) {
EntryPoint.LOG("DroidGuard call detected. Throw exception!");
for (StackTraceElement stackTraceElement : Thread.currentThread().getStackTrace()) {
if (stackTraceElement.getClassName().toLowerCase(Locale.US).contains("droidguard")) {
throw new UnsupportedOperationException();
}
}
return keyStoreSpi.engineGetCertificateChain(alias);
}

View File

@ -7,8 +7,7 @@ If not, try removing /data/adb/pif.json file.
Donations:
https://www.paypal.com/paypalme/chiteroman
# v15.9.8
# v15.9.9
- MEETS_DEVICE_INTEGRITY is green again ✅
- Refine code
- You can define your own native props in pif.json!
- Refine code logic

View File

@ -17,7 +17,6 @@ fi
# Check custom fingerprint
if [ -f "/data/adb/pif.json" ]; then
ui_print "- You are using custom fingerprint!"
ui_print "- If you fail DEVICE verdict, remove /data/adb/pif.json file"
ui_print "- If pif.json file doesn't exist, module will use default one"
mv -f "/data/adb/pif.json" "/data/adb/pif.json.old"
ui_print "- Backup old pif.json"
fi

View File

@ -1,7 +1,7 @@
id=playintegrityfix
name=Play Integrity Fix
version=v15.9.8
versionCode=15980
version=v15.9.9
versionCode=15990
author=chiteroman
description=Universal modular fix for Play Integrity (and SafetyNet) on devices running Android 8-14.
updateJson=https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/update.json

View File

@ -1,22 +1,15 @@
{
"MANUFACTURER": "motorola",
"MODEL": "XT1575",
"FINGERPRINT": "motorola/clark_retus/clark:6.0/MPHS24.49-18-8/4:user/release-keys",
"BRAND": "motorola",
"PRODUCT": "clark_retus",
"DEVICE": "clark",
"RELEASE": "6.0",
"ID": "MPHS24.49-18-8",
"INCREMENTAL": "4",
"MANUFACTURER": "Google",
"MODEL": "Pixel",
"FINGERPRINT": "google/sailfish/sailfish:8.1.0/OPM1.171019.011/4448085:user/release-keys",
"BRAND": "google",
"PRODUCT": "sailfish",
"DEVICE": "sailfish",
"RELEASE": "8.1.0",
"ID": "OPM1.171019.011",
"INCREMENTAL": "4448085",
"TYPE": "user",
"TAGS": "release-keys",
"SECURITY_PATCH": "2016-09-01",
"PROPS": {
"*api_level": "25",
"*.security_patch": "2016-09-01",
"*.build.id": "MPHS24.49-18-8",
"*.fingerprint": "motorola/clark_retus/clark:6.0/MPHS24.49-18-8/4:user/release-keys",
"sys.usb.state": "none",
"ro.secureboot.lockstate": "locked"
}
"SECURITY_PATCH": "2017-12-05",
"DEVICE_INITIAL_SDK_INT": "25"
}

View File

@ -1,6 +1,6 @@
{
"version": "v15.9.8",
"versionCode": 15980,
"zipUrl": "https://github.com/chiteroman/PlayIntegrityFix/releases/download/v15.9.8/PlayIntegrityFix_v15.9.8.zip",
"version": "v15.9.9",
"versionCode": 15990,
"zipUrl": "https://github.com/chiteroman/PlayIntegrityFix/releases/download/v15.9.9/PlayIntegrityFix_v15.9.9.zip",
"changelog": "https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/changelog.md"
}