You've already forked PlayIntegrityFork
mirror of
https://github.com/osm0sis/PlayIntegrityFork.git
synced 2025-09-06 06:37:06 +00:00
Revert "Hook uname to spoof kernel release version string"
This reverts commit 7997954f74.
Hook wasn't functional for intercepting the uname call despite many attempted methods, both on .gms and .gms.unstable
See: https://github.com/chiteroman/PlayIntegrityFix/issues/236
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#include <sys/system_properties.h>
|
#include <sys/system_properties.h>
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "zygisk.hpp"
|
#include "zygisk.hpp"
|
||||||
@@ -18,8 +17,6 @@ static int verboseLogs = 0;
|
|||||||
|
|
||||||
static std::map<std::string, std::string> jsonProps;
|
static std::map<std::string, std::string> jsonProps;
|
||||||
|
|
||||||
static std::string unameRelease;
|
|
||||||
|
|
||||||
typedef void (*T_Callback)(void *, const char *, const char *, uint32_t);
|
typedef void (*T_Callback)(void *, const char *, const char *, uint32_t);
|
||||||
|
|
||||||
static std::map<void *, T_Callback> callbacks;
|
static std::map<void *, T_Callback> callbacks;
|
||||||
@@ -70,27 +67,7 @@ static void my_system_property_read_callback(const prop_info *pi, T_Callback cal
|
|||||||
return o_system_property_read_callback(pi, modify_callback, cookie);
|
return o_system_property_read_callback(pi, modify_callback, cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int (*o_uname_callback)(struct utsname *);
|
static void doHook() {
|
||||||
|
|
||||||
static int my_uname_callback(struct utsname *buf) {
|
|
||||||
auto ret = o_uname_callback(buf);
|
|
||||||
|
|
||||||
if (buf && ret == 0) {
|
|
||||||
const char *value = unameRelease.c_str();
|
|
||||||
const char *oldValue = buf->release;
|
|
||||||
|
|
||||||
if (unameRelease.empty() || oldValue == value) {
|
|
||||||
if (verboseLogs > 2) LOGD("[uname_release]: %s (unchanged)", oldValue);
|
|
||||||
} else if (unameRelease.size() < SYS_NMLN) {
|
|
||||||
LOGD("[uname_release]: %s -> %s", oldValue, value);
|
|
||||||
strncpy(buf->release, value, unameRelease.size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void doPropHook() {
|
|
||||||
void *handle = DobbySymbolResolver(nullptr, "__system_property_read_callback");
|
void *handle = DobbySymbolResolver(nullptr, "__system_property_read_callback");
|
||||||
if (handle == nullptr) {
|
if (handle == nullptr) {
|
||||||
LOGD("Couldn't find '__system_property_read_callback' handle");
|
LOGD("Couldn't find '__system_property_read_callback' handle");
|
||||||
@@ -101,17 +78,6 @@ static void doPropHook() {
|
|||||||
reinterpret_cast<dobby_dummy_func_t *>(&o_system_property_read_callback));
|
reinterpret_cast<dobby_dummy_func_t *>(&o_system_property_read_callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void doUnameHook() {
|
|
||||||
void *handle = DobbySymbolResolver(nullptr, "uname");
|
|
||||||
if (handle == nullptr) {
|
|
||||||
LOGD("Couldn't find 'uname' handle");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LOGD("Found 'uname' handle at %p", handle);
|
|
||||||
DobbyHook(handle, reinterpret_cast<dobby_dummy_func_t>(my_uname_callback),
|
|
||||||
reinterpret_cast<dobby_dummy_func_t *>(&o_uname_callback));
|
|
||||||
}
|
|
||||||
|
|
||||||
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 {
|
||||||
@@ -198,8 +164,7 @@ public:
|
|||||||
if (dexVector.empty() || json.empty()) return;
|
if (dexVector.empty() || json.empty()) return;
|
||||||
|
|
||||||
readJson();
|
readJson();
|
||||||
doPropHook();
|
doHook();
|
||||||
doUnameHook();
|
|
||||||
inject();
|
inject();
|
||||||
|
|
||||||
dexVector.clear();
|
dexVector.clear();
|
||||||
@@ -230,17 +195,6 @@ private:
|
|||||||
json.erase("verbose_logs");
|
json.erase("verbose_logs");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse kernel uname release string as a special case (neither field or property)
|
|
||||||
if (json.contains("uname_release")) {
|
|
||||||
if (verboseLogs > 1) LOGD("Parsing uname_release");
|
|
||||||
if (!json["uname_release"].is_null() && json["uname_release"].is_string() && json["uname_release"] != "") {
|
|
||||||
unameRelease = json["uname_release"].get<std::string>();
|
|
||||||
} else {
|
|
||||||
LOGD("Error parsing uname_release!");
|
|
||||||
}
|
|
||||||
json.erase("uname_release");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> eraseKeys;
|
std::vector<std::string> eraseKeys;
|
||||||
for (auto &jsonList: json.items()) {
|
for (auto &jsonList: json.items()) {
|
||||||
if (verboseLogs > 1) LOGD("Parsing %s", jsonList.key().c_str());
|
if (verboseLogs > 1) LOGD("Parsing %s", jsonList.key().c_str());
|
||||||
|
|||||||
Reference in New Issue
Block a user