mirror of
https://github.com/chiteroman/PlayIntegrityFix.git
synced 2025-01-19 11:32:39 +02:00
v13.8-beta
This commit is contained in:
parent
9b7b6f6712
commit
b72efd6f71
@ -1,7 +1,6 @@
|
|||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#include <sys/system_properties.h>
|
#include <sys/system_properties.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
#include "zygisk.hpp"
|
#include "zygisk.hpp"
|
||||||
#include "shadowhook.h"
|
#include "shadowhook.h"
|
||||||
@ -11,7 +10,7 @@
|
|||||||
|
|
||||||
#define DEX_FILE_PATH "/data/adb/modules/playintegrityfix/classes.dex"
|
#define DEX_FILE_PATH "/data/adb/modules/playintegrityfix/classes.dex"
|
||||||
|
|
||||||
#define PROP_FILE_PATH "/data/adb/modules/playintegrityfix/pif.json"
|
#define JSON_FILE_PATH "/data/adb/modules/playintegrityfix/pif.json"
|
||||||
|
|
||||||
static std::string FIRST_API_LEVEL, SECURITY_PATCH;
|
static std::string FIRST_API_LEVEL, SECURITY_PATCH;
|
||||||
|
|
||||||
@ -72,27 +71,6 @@ static void doHook() {
|
|||||||
LOGD("Found '__system_property_read_callback' handle at %p", handle);
|
LOGD("Found '__system_property_read_callback' handle at %p", handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sendVector(int fd, const std::vector<char> &vec) {
|
|
||||||
// Send the size of the vector
|
|
||||||
size_t size = vec.size();
|
|
||||||
write(fd, &size, sizeof(size_t));
|
|
||||||
|
|
||||||
// Send the vector data
|
|
||||||
write(fd, vec.data(), size);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<char> receiveVector(int fd) {
|
|
||||||
// Receive the size of the vector
|
|
||||||
size_t size;
|
|
||||||
read(fd, &size, sizeof(size_t));
|
|
||||||
|
|
||||||
// Receive the vector data
|
|
||||||
std::vector<char> vec(size);
|
|
||||||
read(fd, vec.data(), size);
|
|
||||||
|
|
||||||
return vec;
|
|
||||||
}
|
|
||||||
|
|
||||||
class PlayIntegrityFix : public zygisk::ModuleBase {
|
class PlayIntegrityFix : public zygisk::ModuleBase {
|
||||||
public:
|
public:
|
||||||
void onLoad(zygisk::Api *api, JNIEnv *env) override {
|
void onLoad(zygisk::Api *api, JNIEnv *env) override {
|
||||||
@ -124,10 +102,36 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long size = 0;
|
||||||
int fd = api->connectCompanion();
|
int fd = api->connectCompanion();
|
||||||
|
|
||||||
dexVector = receiveVector(fd);
|
read(fd, &size, sizeof(long));
|
||||||
propVector = receiveVector(fd);
|
|
||||||
|
if (size < 1) {
|
||||||
|
close(fd);
|
||||||
|
LOGD("Couldn't read from file descriptor 'classes.dex' file!");
|
||||||
|
api->setOption(zygisk::DLCLOSE_MODULE_LIBRARY);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dexVector.resize(size);
|
||||||
|
|
||||||
|
read(fd, dexVector.data(), size);
|
||||||
|
|
||||||
|
size = 0;
|
||||||
|
|
||||||
|
read(fd, &size, sizeof(long));
|
||||||
|
|
||||||
|
if (size < 1) {
|
||||||
|
close(fd);
|
||||||
|
LOGD("Couldn't read from file descriptor 'pif.json' file!");
|
||||||
|
api->setOption(zygisk::DLCLOSE_MODULE_LIBRARY);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
propVector.resize(size);
|
||||||
|
|
||||||
|
read(fd, propVector.data(), size);
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
@ -135,8 +139,6 @@ public:
|
|||||||
static_cast<int>(dexVector.size()));
|
static_cast<int>(dexVector.size()));
|
||||||
LOGD("Read from file descriptor file 'pif.json' -> %d bytes",
|
LOGD("Read from file descriptor file 'pif.json' -> %d bytes",
|
||||||
static_cast<int>(propVector.size()));
|
static_cast<int>(propVector.size()));
|
||||||
|
|
||||||
if (dexVector.empty() || propVector.empty()) api->setOption(zygisk::DLCLOSE_MODULE_LIBRARY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void postAppSpecialize(const zygisk::AppSpecializeArgs *args) override {
|
void postAppSpecialize(const zygisk::AppSpecializeArgs *args) override {
|
||||||
@ -211,24 +213,39 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void companion(int fd) {
|
static void companion(int fd) {
|
||||||
std::ifstream dex(DEX_FILE_PATH, std::ios::binary);
|
FILE *dex = fopen(DEX_FILE_PATH, "rb");
|
||||||
std::ifstream prop(PROP_FILE_PATH);
|
|
||||||
|
|
||||||
std::vector<char> dexVector((std::istreambuf_iterator<char>(dex)),
|
fseek(dex, 0, SEEK_END);
|
||||||
std::istreambuf_iterator<char>());
|
long dexSize = ftell(dex);
|
||||||
std::vector<char> propVector((std::istreambuf_iterator<char>(prop)),
|
fseek(dex, 0, SEEK_SET);
|
||||||
std::istreambuf_iterator<char>());
|
|
||||||
|
|
||||||
dex.close();
|
char dexBuffer[dexSize];
|
||||||
prop.close();
|
fread(dexBuffer, 1, dexSize, dex);
|
||||||
|
|
||||||
sendVector(fd, dexVector);
|
fclose(dex);
|
||||||
sendVector(fd, propVector);
|
|
||||||
|
|
||||||
dexVector.clear();
|
FILE *json = fopen(JSON_FILE_PATH, "r");
|
||||||
propVector.clear();
|
|
||||||
|
fseek(json, 0, SEEK_END);
|
||||||
|
long jsonSize = ftell(json);
|
||||||
|
fseek(json, 0, SEEK_SET);
|
||||||
|
|
||||||
|
char jsonBuffer[jsonSize];
|
||||||
|
fread(jsonBuffer, 1, jsonSize, json);
|
||||||
|
|
||||||
|
fclose(json);
|
||||||
|
|
||||||
|
dexBuffer[dexSize] = 0;
|
||||||
|
jsonBuffer[jsonSize] = 0;
|
||||||
|
|
||||||
|
write(fd, &dexSize, sizeof(long));
|
||||||
|
write(fd, dexBuffer, dexSize);
|
||||||
|
|
||||||
|
write(fd, &jsonSize, sizeof(long));
|
||||||
|
write(fd, jsonBuffer, jsonSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
REGISTER_ZYGISK_MODULE(PlayIntegrityFix)
|
REGISTER_ZYGISK_MODULE(PlayIntegrityFix)
|
||||||
|
|
||||||
REGISTER_ZYGISK_COMPANION(companion)
|
REGISTER_ZYGISK_COMPANION(companion)
|
Binary file not shown.
Binary file not shown.
@ -6,9 +6,13 @@ fi
|
|||||||
# safetynet-fix module is incompatible
|
# safetynet-fix module is incompatible
|
||||||
if [ -d "/data/adb/modules/safetynet-fix" ]; then
|
if [ -d "/data/adb/modules/safetynet-fix" ]; then
|
||||||
touch "/data/adb/modules/safetynet-fix/remove"
|
touch "/data/adb/modules/safetynet-fix/remove"
|
||||||
ui_print "!!! safetynet-fix module removed!"
|
ui_print "- 'safetynet-fix' module will be removed in next reboot."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# use our resetprop
|
# Use custom resetprop only in Android 10+
|
||||||
|
if [ "$API" -gt 28 ]; then
|
||||||
mv -f "$MODPATH/bin/$ABI/resetprop" "$MODPATH"
|
mv -f "$MODPATH/bin/$ABI/resetprop" "$MODPATH"
|
||||||
|
ui_print "- Using custom resetprop to avoid detections."
|
||||||
|
fi
|
||||||
|
|
||||||
rm -rf "$MODPATH/bin"
|
rm -rf "$MODPATH/bin"
|
@ -1,6 +1,7 @@
|
|||||||
id=playintegrityfix
|
id=playintegrityfix
|
||||||
name=Play Integrity Fix
|
name=Play Integrity Fix
|
||||||
version=v1.2-PROPS
|
version=v13.8-beta
|
||||||
versionCode=12
|
versionCode=137
|
||||||
author=chiteroman
|
author=chiteroman
|
||||||
description=Fix CTS profile (SafetyNet) and DEVICE verdict (Play Integrity).
|
description=Fix CTS profile (SafetyNet) and DEVICE verdict (Play Integrity).
|
||||||
|
updateJson=https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/update.json
|
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
RESETPROP="${0%/*}/resetprop"
|
RESETPROP="${0%/*}/resetprop"
|
||||||
|
|
||||||
|
if [ -x "$RESETPROP" ]; then
|
||||||
chmod 755 $RESETPROP
|
chmod 755 $RESETPROP
|
||||||
|
else
|
||||||
|
RESETPROP="resetprop"
|
||||||
|
fi
|
||||||
|
|
||||||
check_resetprop() {
|
check_resetprop() {
|
||||||
local NAME=$1
|
local NAME=$1
|
||||||
|
Loading…
Reference in New Issue
Block a user