mirror of
https://github.com/chiteroman/PlayIntegrityFix.git
synced 2025-01-19 11:32:39 +02:00
Release v13.4
This commit is contained in:
parent
78dde206ee
commit
c31569f249
2
app/proguard-rules.pro
vendored
2
app/proguard-rules.pro
vendored
@ -1,3 +1,3 @@
|
|||||||
-keep class es.chiteroman.playintegrityfix.EntryPoint {init();}
|
-keep class es.chiteroman.playintegrityfix.EntryPoint {public <methods>;}
|
||||||
-keep class es.chiteroman.playintegrityfix.CustomProvider
|
-keep class es.chiteroman.playintegrityfix.CustomProvider
|
||||||
-keep class es.chiteroman.playintegrityfix.CustomKeyStoreSpi
|
-keep class es.chiteroman.playintegrityfix.CustomKeyStoreSpi
|
@ -4,16 +4,13 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <filesystem>
|
|
||||||
|
|
||||||
#include "zygisk.hpp"
|
#include "zygisk.hpp"
|
||||||
#include "dobby.h"
|
#include "dobby.h"
|
||||||
|
|
||||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "PIF/Native", __VA_ARGS__)
|
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "PIF/Native", __VA_ARGS__)
|
||||||
|
|
||||||
static std::string API_LEVEL;
|
static std::string SECURITY_PATCH, FIRST_API_LEVEL;
|
||||||
|
|
||||||
static std::string SECURITY_PATCH;
|
|
||||||
|
|
||||||
#define DEX_FILE_PATH "/data/adb/modules/playintegrityfix/classes.dex"
|
#define DEX_FILE_PATH "/data/adb/modules/playintegrityfix/classes.dex"
|
||||||
|
|
||||||
@ -32,10 +29,10 @@ 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("api_level")) {
|
if (prop.ends_with("api_level")) {
|
||||||
if (API_LEVEL.empty()) {
|
if (FIRST_API_LEVEL.empty()) {
|
||||||
value = nullptr;
|
value = nullptr;
|
||||||
} else {
|
} else {
|
||||||
value = API_LEVEL.c_str();
|
value = FIRST_API_LEVEL.c_str();
|
||||||
}
|
}
|
||||||
} else if (prop.ends_with("security_patch")) {
|
} else if (prop.ends_with("security_patch")) {
|
||||||
if (SECURITY_PATCH.empty()) {
|
if (SECURITY_PATCH.empty()) {
|
||||||
@ -62,49 +59,15 @@ my_system_property_read_callback(const prop_info *pi, T_Callback callback, void
|
|||||||
return o_system_property_read_callback(pi, modify_callback, cookie);
|
return o_system_property_read_callback(pi, modify_callback, cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parsePropsFile(const char *filename) {
|
static void doHook() {
|
||||||
LOGD("Proceed to parse '%s' file", filename);
|
void *handle = DobbySymbolResolver("libc.so", "__system_property_read_callback");
|
||||||
|
if (handle == nullptr) {
|
||||||
FILE *file = fopen(filename, "r");
|
LOGD("Couldn't find '__system_property_read_callback' handle. Report to @chiteroman");
|
||||||
|
return;
|
||||||
char line[256];
|
|
||||||
|
|
||||||
while (fgets(line, sizeof(line), file)) {
|
|
||||||
|
|
||||||
std::string key, value;
|
|
||||||
|
|
||||||
char *data = strtok(line, "=");
|
|
||||||
|
|
||||||
while (data) {
|
|
||||||
if (key.empty()) {
|
|
||||||
key = data;
|
|
||||||
} else {
|
|
||||||
value = data;
|
|
||||||
}
|
}
|
||||||
data = strtok(nullptr, "=");
|
LOGD("Found '__system_property_read_callback' handle at %p", handle);
|
||||||
}
|
DobbyHook(handle, (void *) my_system_property_read_callback,
|
||||||
|
(void **) &o_system_property_read_callback);
|
||||||
key.erase(std::remove_if(key.begin(), key.end(),
|
|
||||||
[](unsigned char x) { return std::isspace(x); }), key.end());
|
|
||||||
value.erase(std::remove_if(value.begin(), value.end(),
|
|
||||||
[](unsigned char x) { return std::isspace(x); }), value.end());
|
|
||||||
|
|
||||||
if (key == "SECURITY_PATCH") {
|
|
||||||
SECURITY_PATCH = value;
|
|
||||||
LOGD("Set SECURITY_PATCH to '%s'", value.c_str());
|
|
||||||
} else if (key == "FIRST_API_LEVEL") {
|
|
||||||
API_LEVEL = value;
|
|
||||||
LOGD("Set API_LEVEL to '%s'", value.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
key.clear();
|
|
||||||
key.shrink_to_fit();
|
|
||||||
|
|
||||||
value.clear();
|
|
||||||
value.shrink_to_fit();
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PlayIntegrityFix : public zygisk::ModuleBase {
|
class PlayIntegrityFix : public zygisk::ModuleBase {
|
||||||
@ -131,26 +94,26 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
callbacks.clear();
|
|
||||||
|
|
||||||
API_LEVEL.clear();
|
|
||||||
API_LEVEL.shrink_to_fit();
|
|
||||||
|
|
||||||
SECURITY_PATCH.clear();
|
|
||||||
SECURITY_PATCH.shrink_to_fit();
|
|
||||||
|
|
||||||
int fd = api->connectCompanion();
|
int fd = api->connectCompanion();
|
||||||
|
|
||||||
auto rawDir = env->GetStringUTFChars(args->app_data_dir, nullptr);
|
int mapSize;
|
||||||
propsFile = rawDir;
|
read(fd, &mapSize, sizeof(mapSize));
|
||||||
env->ReleaseStringUTFChars(args->app_data_dir, rawDir);
|
|
||||||
|
|
||||||
propsFile = propsFile + "/cache/pif.prop";
|
for (int i = 0; i < mapSize; ++i) {
|
||||||
|
int keyLenght, valueLenght;
|
||||||
|
std::string key, value;
|
||||||
|
|
||||||
int strSize = static_cast<int>(propsFile.size());
|
read(fd, &keyLenght, sizeof(keyLenght));
|
||||||
|
read(fd, &valueLenght, sizeof(valueLenght));
|
||||||
|
|
||||||
write(fd, &strSize, sizeof(strSize));
|
key.resize(keyLenght);
|
||||||
write(fd, propsFile.data(), strSize);
|
value.resize(valueLenght);
|
||||||
|
|
||||||
|
read(fd, key.data(), keyLenght);
|
||||||
|
read(fd, value.data(), valueLenght);
|
||||||
|
|
||||||
|
props.insert({key, value});
|
||||||
|
}
|
||||||
|
|
||||||
long size;
|
long size;
|
||||||
read(fd, &size, sizeof(size));
|
read(fd, &size, sizeof(size));
|
||||||
@ -161,6 +124,16 @@ public:
|
|||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
moduleDex.insert(moduleDex.end(), buffer, buffer + size);
|
moduleDex.insert(moduleDex.end(), buffer, buffer + size);
|
||||||
|
|
||||||
|
LOGD("Received from socket %d props!", static_cast<int>(props.size()));
|
||||||
|
|
||||||
|
for (const auto &item: props) {
|
||||||
|
if (item.first == "SECURITY_PATCH") {
|
||||||
|
SECURITY_PATCH = item.second;
|
||||||
|
} else if (item.first == "FIRST_API_LEVEL") {
|
||||||
|
FIRST_API_LEVEL = item.second;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void postAppSpecialize(const zygisk::AppSpecializeArgs *args) override {
|
void postAppSpecialize(const zygisk::AppSpecializeArgs *args) override {
|
||||||
@ -168,13 +141,12 @@ public:
|
|||||||
|
|
||||||
doHook();
|
doHook();
|
||||||
|
|
||||||
injectDex();
|
inject();
|
||||||
|
|
||||||
LOGD("clean");
|
LOGD("clean");
|
||||||
propsFile.clear();
|
|
||||||
propsFile.shrink_to_fit();
|
|
||||||
moduleDex.clear();
|
moduleDex.clear();
|
||||||
moduleDex.shrink_to_fit();
|
moduleDex.shrink_to_fit();
|
||||||
|
props.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void preServerSpecialize(zygisk::ServerSpecializeArgs *args) override {
|
void preServerSpecialize(zygisk::ServerSpecializeArgs *args) override {
|
||||||
@ -185,28 +157,20 @@ private:
|
|||||||
zygisk::Api *api = nullptr;
|
zygisk::Api *api = nullptr;
|
||||||
JNIEnv *env = nullptr;
|
JNIEnv *env = nullptr;
|
||||||
bool isGmsUnstable = false;
|
bool isGmsUnstable = false;
|
||||||
std::string propsFile;
|
std::map<std::string, std::string> props;
|
||||||
std::vector<char> moduleDex;
|
std::vector<char> moduleDex;
|
||||||
|
|
||||||
void doHook() {
|
void inject() {
|
||||||
if (!propsFile.empty()) parsePropsFile(propsFile.c_str());
|
|
||||||
|
|
||||||
void *handle = DobbySymbolResolver("libc.so", "__system_property_read_callback");
|
|
||||||
if (handle == nullptr) {
|
|
||||||
LOGD("Couldn't find '__system_property_read_callback' handle. Report to @chiteroman");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LOGD("Found '__system_property_read_callback' handle at %p", handle);
|
|
||||||
DobbyHook(handle, (void *) my_system_property_read_callback,
|
|
||||||
(void **) &o_system_property_read_callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
void injectDex() {
|
|
||||||
if (moduleDex.empty()) {
|
if (moduleDex.empty()) {
|
||||||
LOGD("Dex not loaded in memory");
|
LOGD("Dex not loaded in memory");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (props.empty()) {
|
||||||
|
LOGD("No props loaded in memory");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LOGD("Preparing to inject %d bytes to the process", static_cast<int>(moduleDex.size()));
|
LOGD("Preparing to inject %d bytes to the process", static_cast<int>(moduleDex.size()));
|
||||||
|
|
||||||
LOGD("get system classloader");
|
LOGD("get system classloader");
|
||||||
@ -229,28 +193,82 @@ private:
|
|||||||
auto entryClassName = env->NewStringUTF("es.chiteroman.playintegrityfix.EntryPoint");
|
auto entryClassName = env->NewStringUTF("es.chiteroman.playintegrityfix.EntryPoint");
|
||||||
auto entryClassObj = env->CallObjectMethod(dexCl, loadClass, entryClassName);
|
auto entryClassObj = env->CallObjectMethod(dexCl, loadClass, entryClassName);
|
||||||
|
|
||||||
LOGD("call init");
|
|
||||||
auto entryClass = (jclass) entryClassObj;
|
auto entryClass = (jclass) entryClassObj;
|
||||||
|
|
||||||
|
LOGD("call add prop");
|
||||||
|
auto addProp = env->GetStaticMethodID(entryClass, "addProp",
|
||||||
|
"(Ljava/lang/String;Ljava/lang/String;)V");
|
||||||
|
for (const auto &item: props) {
|
||||||
|
auto key = env->NewStringUTF(item.first.c_str());
|
||||||
|
auto value = env->NewStringUTF(item.second.c_str());
|
||||||
|
env->CallStaticVoidMethod(entryClass, addProp, key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGD("call init");
|
||||||
auto entryInit = env->GetStaticMethodID(entryClass, "init", "()V");
|
auto entryInit = env->GetStaticMethodID(entryClass, "init", "()V");
|
||||||
env->CallStaticVoidMethod(entryClass, entryInit);
|
env->CallStaticVoidMethod(entryClass, entryInit);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void parsePropsFile(int fd) {
|
||||||
|
LOGD("Proceed to parse '%s' file", PROP_FILE_PATH);
|
||||||
|
|
||||||
|
std::map<std::string, std::string> props;
|
||||||
|
|
||||||
|
FILE *file = fopen(PROP_FILE_PATH, "r");
|
||||||
|
|
||||||
|
char line[256];
|
||||||
|
|
||||||
|
while (fgets(line, sizeof(line), file)) {
|
||||||
|
|
||||||
|
std::string key, value;
|
||||||
|
|
||||||
|
char *data = strtok(line, "=");
|
||||||
|
|
||||||
|
while (data) {
|
||||||
|
if (key.empty()) {
|
||||||
|
key = data;
|
||||||
|
} else {
|
||||||
|
value = data;
|
||||||
|
}
|
||||||
|
data = strtok(nullptr, "=");
|
||||||
|
}
|
||||||
|
|
||||||
|
key.erase(std::remove_if(key.begin(), key.end(),
|
||||||
|
[](unsigned char x) { return std::isspace(x); }), key.end());
|
||||||
|
value.erase(std::remove(value.begin(), value.end(), '\n'), value.cend());
|
||||||
|
|
||||||
|
props.insert({key, value});
|
||||||
|
|
||||||
|
key.clear();
|
||||||
|
key.shrink_to_fit();
|
||||||
|
|
||||||
|
value.clear();
|
||||||
|
value.shrink_to_fit();
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(file);
|
||||||
|
|
||||||
|
int mapSize = static_cast<int>(props.size());
|
||||||
|
|
||||||
|
write(fd, &mapSize, sizeof(mapSize));
|
||||||
|
|
||||||
|
for (const auto &item: props) {
|
||||||
|
int keyLenght = static_cast<int>(item.first.size());
|
||||||
|
int valueLenght = static_cast<int>(item.second.size());
|
||||||
|
|
||||||
|
write(fd, &keyLenght, sizeof(keyLenght));
|
||||||
|
write(fd, &valueLenght, sizeof(valueLenght));
|
||||||
|
|
||||||
|
write(fd, item.first.data(), keyLenght);
|
||||||
|
write(fd, item.second.data(), valueLenght);
|
||||||
|
}
|
||||||
|
|
||||||
|
props.clear();
|
||||||
|
}
|
||||||
|
|
||||||
static void companion(int fd) {
|
static void companion(int fd) {
|
||||||
int strSize;
|
parsePropsFile(fd);
|
||||||
read(fd, &strSize, sizeof(strSize));
|
|
||||||
|
|
||||||
std::string propsFile;
|
|
||||||
|
|
||||||
propsFile.resize(strSize);
|
|
||||||
read(fd, propsFile.data(), strSize);
|
|
||||||
|
|
||||||
std::filesystem::copy_file(PROP_FILE_PATH, propsFile,
|
|
||||||
std::filesystem::copy_options::overwrite_existing);
|
|
||||||
std::filesystem::permissions(propsFile, std::filesystem::perms::all);
|
|
||||||
|
|
||||||
propsFile.clear();
|
|
||||||
propsFile.shrink_to_fit();
|
|
||||||
|
|
||||||
FILE *dex = fopen(DEX_FILE_PATH, "rb");
|
FILE *dex = fopen(DEX_FILE_PATH, "rb");
|
||||||
|
|
||||||
|
@ -3,33 +3,26 @@ package es.chiteroman.playintegrityfix;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.Reader;
|
|
||||||
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.Properties;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public final class EntryPoint {
|
public final class EntryPoint {
|
||||||
private static final Properties props = new Properties();
|
private static final Map<String, String> map = new HashMap<>();
|
||||||
private static final File file = new File("/data/data/com.google.android.gms/cache/pif.prop");
|
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
|
spoofProvider();
|
||||||
try (Reader reader = new FileReader(file)) {
|
spoofDevice();
|
||||||
props.load(reader);
|
|
||||||
LOG("Loaded " + props.size() + " fields!");
|
|
||||||
} catch (IOException e) {
|
|
||||||
LOG("Couldn't load pif.prop file: " + e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
spoofDevice();
|
public static void addProp(String key, String value) {
|
||||||
spoofProvider();
|
map.put(key, value);
|
||||||
|
LOG(String.format("Received from Zygisk lib: [%s] -> '%s'", key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void spoofProvider() {
|
private static void spoofProvider() {
|
||||||
@ -60,13 +53,13 @@ public final class EntryPoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void spoofDevice() {
|
public static void spoofDevice() {
|
||||||
setProp("PRODUCT", props.getProperty("PRODUCT", "bullhead"));
|
setProp("PRODUCT", map.get("PRODUCT"));
|
||||||
setProp("DEVICE", props.getProperty("DEVICE", "bullhead"));
|
setProp("DEVICE", map.get("DEVICE"));
|
||||||
setProp("MANUFACTURER", props.getProperty("MANUFACTURER", "LGE"));
|
setProp("MANUFACTURER", map.get("MANUFACTURER"));
|
||||||
setProp("BRAND", props.getProperty("BRAND", "google"));
|
setProp("BRAND", map.get("BRAND"));
|
||||||
setProp("MODEL", props.getProperty("MODEL", "Nexus 5X"));
|
setProp("MODEL", map.get("MODEL"));
|
||||||
setProp("FINGERPRINT", props.getProperty("FINGERPRINT", "google/bullhead/bullhead:8.0.0/OPR6.170623.013/4283548:user/release-keys"));
|
setProp("FINGERPRINT", map.get("FINGERPRINT"));
|
||||||
setVersionProp("SECURITY_PATCH", props.getProperty("SECURITY_PATCH", "2017-08-05"));
|
setVersionProp("SECURITY_PATCH", map.get("SECURITY_PATCH"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setProp(String name, String value) {
|
private static void setProp(String name, String value) {
|
||||||
|
@ -4,6 +4,11 @@ https://t.me/playintegrityfix
|
|||||||
|
|
||||||
Also, if Google blacklist the fingerprint (again), you can post your custom pif.prop and I will update the module.
|
Also, if Google blacklist the fingerprint (again), you can post your custom pif.prop and I will update the module.
|
||||||
|
|
||||||
# v13.3
|
# v13.4
|
||||||
|
|
||||||
- Spoof security patch and api level to DroidGuard.
|
- Custom resetprop utility! Thanks to @HuskyDG.
|
||||||
|
- Don't write in GMS folder, everything stored in memory. (Issue from @osm0sis :D)
|
||||||
|
- Downgrade to Zygisk API 2.
|
||||||
|
- Should fix crashes.
|
||||||
|
|
||||||
|
This build includes 'pif.prop', you can modify it and use your custom props to pass Device verdict.
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": "v13.3",
|
"version": "v13.4",
|
||||||
"versionCode": 133,
|
"versionCode": 134,
|
||||||
"zipUrl": "https://github.com/chiteroman/PlayIntegrityFix/releases/download/v13.3/PlayIntegrityFix_v13.3.zip",
|
"zipUrl": "https://github.com/chiteroman/PlayIntegrityFix/releases/download/v13.4/PlayIntegrityFix_v13.4.zip",
|
||||||
"changelog": "https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/changelog.md"
|
"changelog": "https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/changelog.md"
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user