Skip to content

Commit

Permalink
v15.9.9
Browse files Browse the repository at this point in the history
  • Loading branch information
chiteroman committed May 23, 2024
1 parent 41a0d6f commit a9ca4a0
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 58 deletions.
3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
47 changes: 26 additions & 21 deletions app/src/main/cpp/main.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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);

Expand All @@ -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);

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;
}
}
std::string_view prop(name);

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")) {
Expand Down Expand Up @@ -143,16 +138,13 @@ class PlayIntegrityFix : public zygisk::ModuleBase {
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();
Expand All @@ -168,6 +160,19 @@ class PlayIntegrityFix : public zygisk::ModuleBase {
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
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;
Expand All @@ -26,9 +25,10 @@ public Key engineGetKey(String alias, char[] password) throws NoSuchAlgorithmExc
@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!");
throw new UnsupportedOperationException();
for (StackTraceElement stackTraceElement : Thread.currentThread().getStackTrace()) {
if (stackTraceElement.getClassName().toLowerCase(Locale.US).contains("droidguard")) {
throw new UnsupportedOperationException();
}
}

return keyStoreSpi.engineGetCertificateChain(alias);
Expand Down
5 changes: 2 additions & 3 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 3 additions & 4 deletions module/customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
fi
mv -f "/data/adb/pif.json" "/data/adb/pif.json.old"
ui_print "- Backup old pif.json"
fi
4 changes: 2 additions & 2 deletions module/module.prop
Original file line number Diff line number Diff line change
@@ -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
29 changes: 11 additions & 18 deletions module/pif.json
Original file line number Diff line number Diff line change
@@ -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"
}
6 changes: 3 additions & 3 deletions update.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit a9ca4a0

Please sign in to comment.