mirror of
https://github.com/chiteroman/PlayIntegrityFix.git
synced 2025-01-19 03:22:39 +02:00
Improve code, remove libcxx, use system STL
This commit is contained in:
parent
d3a11e348e
commit
08986d312e
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
||||
[submodule "app/src/main/cpp/libcxx"]
|
||||
path = app/src/main/cpp/libcxx
|
||||
url = https://github.com/topjohnwu/libcxx.git
|
3
.idea/.gitignore
vendored
Normal file
3
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
1
.idea/.name
Normal file
1
.idea/.name
Normal file
@ -0,0 +1 @@
|
||||
PlayIntegrityFix
|
6
.idea/compiler.xml
Normal file
6
.idea/compiler.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="17" />
|
||||
</component>
|
||||
</project>
|
10
.idea/deploymentTargetDropDown.xml
Normal file
10
.idea/deploymentTargetDropDown.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<value>
|
||||
<entry key="app">
|
||||
<State />
|
||||
</entry>
|
||||
</value>
|
||||
</component>
|
||||
</project>
|
18
.idea/gradle.xml
Normal file
18
.idea/gradle.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveExternalAnnotations" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
6
.idea/inspectionProfiles/Project_Default.xml
Normal file
6
.idea/inspectionProfiles/Project_Default.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>
|
10
.idea/migrations.xml
Normal file
10
.idea/migrations.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectMigrations">
|
||||
<option name="MigrateToGradleLocalJavaHome">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
9
.idea/misc.xml
Normal file
9
.idea/misc.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -42,4 +42,33 @@ android {
|
||||
path = file("src/main/cpp/Android.mk")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("copyFiles") {
|
||||
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)
|
||||
|
||||
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"))
|
||||
|
||||
from(project.rootDir.resolve("module"))
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
tasks["assembleRelease"].finalizedBy("copyFiles", "zip")
|
||||
}
|
@ -26,8 +26,5 @@ ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/shadowhook/arch/arm64
|
||||
endif
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := libcxx
|
||||
LOCAL_LDLIBS := -llog
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
include $(LOCAL_PATH)/libcxx/Android.mk
|
||||
include $(BUILD_SHARED_LIBRARY)
|
@ -1,4 +1,3 @@
|
||||
APP_STL := none
|
||||
APP_STL := system
|
||||
APP_CFLAGS := -Oz -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden
|
||||
APP_CPPFLAGS := -std=c++20
|
||||
APP_LDFLAGS := -Oz
|
||||
APP_CPPFLAGS := -std=c++20
|
@ -1 +0,0 @@
|
||||
Subproject commit 12c8f4e93f196a700137e983dcceeac43cf807f2
|
@ -1,17 +1,17 @@
|
||||
#include <android/log.h>
|
||||
#include <sys/system_properties.h>
|
||||
#include <map>
|
||||
#include <unistd.h>
|
||||
#include <string_view>
|
||||
#include <map>
|
||||
|
||||
#include "zygisk.hpp"
|
||||
#include "shadowhook.h"
|
||||
#include "classes_dex.h"
|
||||
|
||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "PIF/Native", __VA_ARGS__)
|
||||
|
||||
#define FIRST_API_LEVEL "25"
|
||||
#define FIRST_API_LEVEL "23"
|
||||
|
||||
#define SECURITY_PATCH "2018-07-05"
|
||||
#define SECURITY_PATCH "2018-01-05"
|
||||
|
||||
typedef void (*T_Callback)(void *, const char *, const char *, uint32_t);
|
||||
|
||||
@ -70,28 +70,53 @@ public:
|
||||
}
|
||||
|
||||
void preAppSpecialize(zygisk::AppSpecializeArgs *args) override {
|
||||
bool isGms = false, isGmsUnstable = false;
|
||||
|
||||
auto rawProcess = env->GetStringUTFChars(args->nice_name, nullptr);
|
||||
|
||||
std::string_view process(rawProcess);
|
||||
if (rawProcess) {
|
||||
std::string_view process(rawProcess);
|
||||
|
||||
bool isGms = process.starts_with("com.google.android.gms");
|
||||
isGmsUnstable = process.compare("com.google.android.gms.unstable") == 0;
|
||||
isGms = process.starts_with("com.google.android.gms");
|
||||
isGmsUnstable = process.compare("com.google.android.gms.unstable") == 0;
|
||||
}
|
||||
|
||||
env->ReleaseStringUTFChars(args->nice_name, rawProcess);
|
||||
|
||||
if (isGms) api->setOption(zygisk::FORCE_DENYLIST_UNMOUNT);
|
||||
|
||||
if (isGmsUnstable) return;
|
||||
if (isGmsUnstable) {
|
||||
long size = 0;
|
||||
int fd = api->connectCompanion();
|
||||
|
||||
read(fd, &size, sizeof(long));
|
||||
|
||||
if (size > 0) {
|
||||
vector.resize(size);
|
||||
read(fd, vector.data(), size);
|
||||
LOGD("Read %ld bytes from fd!", size);
|
||||
} else {
|
||||
LOGD("Couldn't read classes.dex from fd!");
|
||||
api->setOption(zygisk::DLCLOSE_MODULE_LIBRARY);
|
||||
return;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
api->setOption(zygisk::DLCLOSE_MODULE_LIBRARY);
|
||||
}
|
||||
|
||||
void postAppSpecialize(const zygisk::AppSpecializeArgs *args) override {
|
||||
if (!isGmsUnstable) return;
|
||||
if (vector.empty()) return;
|
||||
|
||||
doHook();
|
||||
|
||||
inject();
|
||||
|
||||
vector.clear();
|
||||
}
|
||||
|
||||
void preServerSpecialize(zygisk::ServerSpecializeArgs *args) override {
|
||||
@ -101,7 +126,7 @@ public:
|
||||
private:
|
||||
zygisk::Api *api = nullptr;
|
||||
JNIEnv *env = nullptr;
|
||||
bool isGmsUnstable = false;
|
||||
std::vector<char> vector;
|
||||
|
||||
void inject() {
|
||||
LOGD("get system classloader");
|
||||
@ -114,7 +139,7 @@ private:
|
||||
auto dexClClass = env->FindClass("dalvik/system/InMemoryDexClassLoader");
|
||||
auto dexClInit = env->GetMethodID(dexClClass, "<init>",
|
||||
"(Ljava/nio/ByteBuffer;Ljava/lang/ClassLoader;)V");
|
||||
auto buffer = env->NewDirectByteBuffer(classes_dex, classes_dex_len);
|
||||
auto buffer = env->NewDirectByteBuffer(vector.data(), static_cast<jlong>(vector.size()));
|
||||
auto dexCl = env->NewObject(dexClClass, dexClInit, buffer, systemClassLoader);
|
||||
|
||||
LOGD("load class");
|
||||
@ -131,4 +156,27 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_ZYGISK_MODULE(PlayIntegrityFix)
|
||||
static void companion(int fd) {
|
||||
long size = 0;
|
||||
std::vector<char> vector;
|
||||
|
||||
FILE *file = fopen("/data/adb/modules/playintegrityfix/classes.dex", "rb");
|
||||
|
||||
if (file) {
|
||||
fseek(file, 0, SEEK_END);
|
||||
size = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
|
||||
vector.resize(size);
|
||||
fread(vector.data(), 1, size, file);
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
write(fd, &size, sizeof(long));
|
||||
write(fd, vector.data(), size);
|
||||
}
|
||||
|
||||
REGISTER_ZYGISK_MODULE(PlayIntegrityFix)
|
||||
|
||||
REGISTER_ZYGISK_COMPANION(companion)
|
@ -11,13 +11,13 @@ import java.security.Provider;
|
||||
import java.security.Security;
|
||||
|
||||
public final class EntryPoint {
|
||||
private static final String PRODUCT = "sailfish";
|
||||
private static final String DEVICE = "sailfish";
|
||||
private static final String MANUFACTURER = "Google";
|
||||
private static final String BRAND = "google";
|
||||
private static final String MODEL = "Pixel";
|
||||
private static final String FINGERPRINT = "google/sailfish/sailfish:8.1.0/OPM4.171019.021.P1/4820305:user/release-keys";
|
||||
private static final String SECURITY_PATCH = "2018-07-05";
|
||||
private static final String PRODUCT = "foster_e";
|
||||
private static final String DEVICE = "foster";
|
||||
private static final String MANUFACTURER = "NVIDIA";
|
||||
private static final String BRAND = "NVIDIA";
|
||||
private static final String MODEL = "SHIELD Android TV";
|
||||
private static final String FINGERPRINT = "NVIDIA/foster_e/foster:7.0/NRD90M/2427173_1038.2788:user/release-keys";
|
||||
private static final String SECURITY_PATCH = "2018-01-05";
|
||||
|
||||
public static void init() {
|
||||
spoofProvider();
|
||||
|
@ -11,4 +11,4 @@ fi
|
||||
|
||||
# Clean up any leftover files from previous deprecated methods
|
||||
rm -f /data/data/com.google.android.gms/cache/pif.prop /data/data/com.google.android.gms/pif.prop
|
||||
rm -f /data/data/com.google.android.gms/cache/pif.json /data/data/com.google.android.gms/pif.json
|
||||
rm -f /data/data/com.google.android.gms/cache/pif.json /data/data/com.google.android.gms/pif.json
|
@ -1,7 +1,7 @@
|
||||
id=playintegrityfix
|
||||
name=Play Integrity Fix
|
||||
version=v13.8
|
||||
versionCode=138
|
||||
version=v13.9
|
||||
versionCode=139
|
||||
author=chiteroman
|
||||
description=Fix CTS profile (SafetyNet) and DEVICE verdict (Play Integrity).
|
||||
updateJson=https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/update.json
|
@ -6,4 +6,4 @@ fi
|
||||
# Remove safetynet-fix module if installed
|
||||
if [ -d /data/adb/modules/safetynet-fix ]; then
|
||||
touch /data/adb/modules/safetynet-fix/remove
|
||||
fi
|
||||
fi
|
@ -38,7 +38,10 @@ resetprop_if_match ro.boot.mode recovery unknown
|
||||
resetprop_if_match vendor.boot.mode recovery unknown
|
||||
|
||||
# SELinux
|
||||
resetprop --delete ro.build.selinux
|
||||
if [ -n "$(getprop ro.build.selinux)" ]; then
|
||||
resetprop --delete ro.build.selinux
|
||||
fi
|
||||
|
||||
# use toybox to protect *stat* access time reading
|
||||
if [ "$(toybox cat /sys/fs/selinux/enforce)" == "0" ]; then
|
||||
chmod 640 /sys/fs/selinux/enforce
|
||||
|
Loading…
Reference in New Issue
Block a user