|
|
|
@ -4,37 +4,44 @@ namespace ligma
|
|
|
|
|
{
|
|
|
|
|
namespace bypass
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// do not call anything that will call dlopen inside of callback....
|
|
|
|
|
//
|
|
|
|
|
__attribute__((noinline))
|
|
|
|
|
void init(const std::function<bool(std::uintptr_t, void*)>& callback)
|
|
|
|
|
{
|
|
|
|
|
ligma::utils::on_image_load("libil2cpp.so", callback);
|
|
|
|
|
ligma::utils::on_image_load("libxlua.so", [&](std::uintptr_t module_base, void* module_handle) -> bool
|
|
|
|
|
ligma::utils::on_image_load("libxlua.so",
|
|
|
|
|
[&](std::uintptr_t module_base, void* module_handle) -> bool
|
|
|
|
|
{
|
|
|
|
|
LOGI("libxlua.so base = %p", module_base);
|
|
|
|
|
ligma::hook::make_hook(
|
|
|
|
|
dlsym(dlopen("libxlua.so", RTLD_NOLOAD), "luaL_loadbufferx"),
|
|
|
|
|
reinterpret_cast<void*>(&load_bufferx_hook)
|
|
|
|
|
);
|
|
|
|
|
LOGI("libxlua.so base -> %p, module_handle -> %p", module_base, module_handle);
|
|
|
|
|
ligma::hook::make_hook(dlsym(module_handle, "luaL_loadbufferx"), &load_bufferx_hook);
|
|
|
|
|
LOGI("installed libxlua.so hooks!");
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// TODO: add more hooks on libtersafe.so with dlsym_hook...
|
|
|
|
|
ligma::utils::on_image_load("libtersafe.so", [&](std::uintptr_t module_base, void* module_handle) -> bool
|
|
|
|
|
ligma::utils::on_image_load("libtersafe.so",
|
|
|
|
|
[&](std::uintptr_t module_base, void* module_handle) -> bool
|
|
|
|
|
{
|
|
|
|
|
LOGI("libtersafe.so = %p", module_base);
|
|
|
|
|
LOGI("libtersafe.so -> %p, module_handle -> %p", module_base, module_handle);
|
|
|
|
|
|
|
|
|
|
// all imports just return null now....
|
|
|
|
|
ligma::hook::dlsym_hook({ module_handle, "^.*" }, &null_sub);
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
fopen_ptr = dlsym(dlopen("libc.so", RTLD_NOLOAD), "fopen");
|
|
|
|
|
system_prop_get = dlsym(dlopen("libc.so", RTLD_NOLOAD), "__system_property_get");
|
|
|
|
|
|
|
|
|
|
ligma::hook::make_hook(fopen_ptr, reinterpret_cast<void*>(&fopen_hook));
|
|
|
|
|
ligma::hook::make_hook(system_prop_get, reinterpret_cast<void*>(&system_property_hook));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
__attribute__((noinline))
|
|
|
|
|
int null_sub()
|
|
|
|
|
{
|
|
|
|
|
LOGI("null_sub called, return -> null....");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// dont let a single lua script load!
|
|
|
|
|
//
|
|
|
|
@ -77,12 +84,12 @@ namespace ligma
|
|
|
|
|
system_prop_mutex.unlock();
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// dont spoof persist.sys.timezone or these other ones.
|
|
|
|
|
// few things we dont spoof...
|
|
|
|
|
//
|
|
|
|
|
if (strcmp(name, "persist.sys.timezone") != 0 &&
|
|
|
|
|
strcmp(name, "ro.build.fingerprint") != 0 &&
|
|
|
|
|
strcmp(name, "ro.revision") != 0 &&
|
|
|
|
|
strcmp(name, "ro.build.version.sdk") != 0)
|
|
|
|
|
if (!strcmp(name, "persist.sys.timezone") &&
|
|
|
|
|
!strcmp(name, "ro.build.fingerprint") &&
|
|
|
|
|
!strcmp(name, "ro.revision") &&
|
|
|
|
|
!strcmp(name, "ro.build.version.sdk"))
|
|
|
|
|
value = HWID_VALUE;
|
|
|
|
|
|
|
|
|
|
return strlen(value);
|
|
|
|
|