You've already forked PlayIntegrityFork
mirror of
https://github.com/osm0sis/PlayIntegrityFork.git
synced 2025-09-06 06:37:06 +00:00
New version for custom spoof!
This commit is contained in:
@@ -45,20 +45,24 @@ android {
|
||||
}
|
||||
|
||||
tasks.register("copyFiles") {
|
||||
val moduleFolder = project.rootDir.resolve("module")
|
||||
val dexFile = project.buildDir.resolve("intermediates/dex/release/minifyReleaseWithR8/classes.dex")
|
||||
val soDir = project.buildDir.resolve("intermediates/stripped_native_libs/release/out/lib")
|
||||
doLast {
|
||||
val moduleFolder = project.rootDir.resolve("module")
|
||||
val dexFile = project.buildDir.resolve("intermediates/dex/release/minifyReleaseWithR8/classes.dex")
|
||||
val soDir = project.buildDir.resolve("intermediates/stripped_native_libs/release/out/lib")
|
||||
|
||||
dexFile.copyTo(moduleFolder.resolve("classes.dex"), overwrite = true)
|
||||
dexFile.copyTo(moduleFolder.resolve("classes.dex"), overwrite = true)
|
||||
|
||||
soDir.walk().filter { it.isFile && it.extension == "so" }.forEach { soFile ->
|
||||
val abiFolder = soFile.parentFile.name
|
||||
val destination = moduleFolder.resolve("zygisk/$abiFolder.so")
|
||||
soFile.copyTo(destination, overwrite = true)
|
||||
soDir.walk().filter { it.isFile && it.extension == "so" }.forEach { soFile ->
|
||||
val abiFolder = soFile.parentFile.name
|
||||
val destination = moduleFolder.resolve("zygisk/$abiFolder.so")
|
||||
soFile.copyTo(destination, overwrite = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register<Zip>("zip") {
|
||||
dependsOn("copyFiles")
|
||||
|
||||
archiveFileName.set("PlayIntegrityFix.zip")
|
||||
destinationDirectory.set(project.rootDir.resolve("out"))
|
||||
|
||||
@@ -66,7 +70,5 @@ tasks.register<Zip>("zip") {
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
tasks.named("assembleRelease") {
|
||||
dependsOn("copyFiles", "zip")
|
||||
}
|
||||
tasks["assembleRelease"].finalizedBy("copyFiles", "zip")
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <android/log.h>
|
||||
#include <sys/system_properties.h>
|
||||
#include <unistd.h>
|
||||
#include <fstream>
|
||||
|
||||
#include "zygisk.hpp"
|
||||
#include "shadowhook.h"
|
||||
@@ -79,15 +80,13 @@ public:
|
||||
}
|
||||
|
||||
void preAppSpecialize(zygisk::AppSpecializeArgs *args) override {
|
||||
bool isGms = false;
|
||||
bool isGmsUnstable = false;
|
||||
|
||||
auto rawProcess = env->GetStringUTFChars(args->nice_name, nullptr);
|
||||
if (rawProcess) {
|
||||
std::string_view process(rawProcess);
|
||||
isGms = process.starts_with("com.google.android.gms");
|
||||
isGmsUnstable = process.compare("com.google.android.gms.unstable") == 0;
|
||||
}
|
||||
|
||||
std::string_view process(rawProcess);
|
||||
|
||||
bool isGms = process.starts_with("com.google.android.gms");
|
||||
bool isGmsUnstable = process.compare("com.google.android.gms.unstable") == 0;
|
||||
|
||||
env->ReleaseStringUTFChars(args->nice_name, rawProcess);
|
||||
|
||||
if (!isGms) {
|
||||
@@ -102,56 +101,51 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
long size = 0;
|
||||
int dexSize = 0;
|
||||
int jsonSize = 0;
|
||||
|
||||
int fd = api->connectCompanion();
|
||||
|
||||
read(fd, &size, sizeof(long));
|
||||
read(fd, &dexSize, sizeof(int));
|
||||
read(fd, &jsonSize, sizeof(int));
|
||||
|
||||
if (size < 1) {
|
||||
if (dexSize < 1) {
|
||||
close(fd);
|
||||
LOGD("Couldn't read from file descriptor 'classes.dex' file!");
|
||||
LOGD("Couldn't read classes.dex");
|
||||
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) {
|
||||
if (jsonSize < 1) {
|
||||
close(fd);
|
||||
LOGD("Couldn't read from file descriptor 'pif.json' file!");
|
||||
LOGD("Couldn't read pif.json");
|
||||
api->setOption(zygisk::DLCLOSE_MODULE_LIBRARY);
|
||||
return;
|
||||
}
|
||||
|
||||
propVector.resize(size);
|
||||
dexVector.resize(dexSize);
|
||||
jsonVector.resize(jsonSize);
|
||||
|
||||
read(fd, propVector.data(), size);
|
||||
read(fd, dexVector.data(), dexSize);
|
||||
read(fd, jsonVector.data(), jsonSize);
|
||||
|
||||
close(fd);
|
||||
|
||||
LOGD("Read from file descriptor file 'classes.dex' -> %d bytes",
|
||||
static_cast<int>(dexVector.size()));
|
||||
LOGD("Read from file descriptor file 'pif.json' -> %d bytes",
|
||||
static_cast<int>(propVector.size()));
|
||||
LOGD("Read from file descriptor file 'classes.dex' -> %d bytes", dexSize);
|
||||
LOGD("Read from file descriptor file 'pif.json' -> %d bytes", jsonSize);
|
||||
}
|
||||
|
||||
void postAppSpecialize(const zygisk::AppSpecializeArgs *args) override {
|
||||
if (dexVector.empty() || propVector.empty()) return;
|
||||
if (dexVector.empty() || jsonVector.empty()) return;
|
||||
|
||||
readJson();
|
||||
|
||||
inject();
|
||||
|
||||
doHook();
|
||||
|
||||
inject();
|
||||
|
||||
dexVector.clear();
|
||||
propVector.clear();
|
||||
jsonVector.clear();
|
||||
}
|
||||
|
||||
void preServerSpecialize(zygisk::ServerSpecializeArgs *args) override {
|
||||
@@ -161,10 +155,10 @@ public:
|
||||
private:
|
||||
zygisk::Api *api = nullptr;
|
||||
JNIEnv *env = nullptr;
|
||||
std::vector<char> dexVector, propVector;
|
||||
std::vector<char> dexVector, jsonVector;
|
||||
|
||||
void readJson() {
|
||||
std::string data(propVector.cbegin(), propVector.cend());
|
||||
std::string data(jsonVector.cbegin(), jsonVector.cend());
|
||||
nlohmann::json json = nlohmann::json::parse(data, nullptr, false, true);
|
||||
|
||||
if (json.contains("SECURITY_PATCH")) {
|
||||
@@ -220,7 +214,7 @@ private:
|
||||
LOGD("read json");
|
||||
auto readProps = env->GetStaticMethodID(entryClass, "readJson",
|
||||
"(Ljava/lang/String;)V");
|
||||
std::string data(propVector.cbegin(), propVector.cend());
|
||||
std::string data(jsonVector.cbegin(), jsonVector.cend());
|
||||
auto javaStr = env->NewStringUTF(data.c_str());
|
||||
env->CallStaticVoidMethod(entryClass, readProps, javaStr);
|
||||
|
||||
@@ -231,46 +225,22 @@ private:
|
||||
};
|
||||
|
||||
static void companion(int fd) {
|
||||
long dexSize = 0;
|
||||
char *dexBuffer = nullptr;
|
||||
std::ifstream dex(DEX_FILE_PATH, std::ios::binary);
|
||||
std::ifstream json(JSON_FILE_PATH);
|
||||
|
||||
long jsonSize = 0;
|
||||
char *jsonBuffer = nullptr;
|
||||
std::vector<char> dexVector((std::istreambuf_iterator<char>(dex)),
|
||||
std::istreambuf_iterator<char>());
|
||||
std::vector<char> jsonVector((std::istreambuf_iterator<char>(json)),
|
||||
std::istreambuf_iterator<char>());
|
||||
|
||||
FILE *dex = fopen(DEX_FILE_PATH, "rb");
|
||||
int dexSize = static_cast<int>(dexVector.size());
|
||||
int jsonSize = static_cast<int>(jsonVector.size());
|
||||
|
||||
if (dex) {
|
||||
fseek(dex, 0, SEEK_END);
|
||||
dexSize = ftell(dex);
|
||||
fseek(dex, 0, SEEK_SET);
|
||||
write(fd, &dexSize, sizeof(int));
|
||||
write(fd, &jsonSize, sizeof(int));
|
||||
|
||||
dexBuffer = static_cast<char *>(calloc(1, dexSize));
|
||||
fread(dexBuffer, 1, dexSize, dex);
|
||||
|
||||
fclose(dex);
|
||||
}
|
||||
|
||||
FILE *json = fopen(JSON_FILE_PATH, "r");
|
||||
|
||||
if (json) {
|
||||
fseek(json, 0, SEEK_END);
|
||||
jsonSize = ftell(json);
|
||||
fseek(json, 0, SEEK_SET);
|
||||
|
||||
jsonBuffer = static_cast<char *>(calloc(1, jsonSize));
|
||||
fread(jsonBuffer, 1, jsonSize, json);
|
||||
|
||||
fclose(json);
|
||||
}
|
||||
|
||||
write(fd, &dexSize, sizeof(long));
|
||||
write(fd, dexBuffer, dexSize);
|
||||
|
||||
write(fd, &jsonSize, sizeof(long));
|
||||
write(fd, jsonBuffer, jsonSize);
|
||||
|
||||
free(dexBuffer);
|
||||
free(jsonBuffer);
|
||||
write(fd, dexVector.data(), dexSize);
|
||||
write(fd, jsonVector.data(), jsonSize);
|
||||
}
|
||||
|
||||
REGISTER_ZYGISK_MODULE(PlayIntegrityFix)
|
||||
|
||||
Reference in New Issue
Block a user