|
|
|
@ -21,25 +21,37 @@ namespace ligma
|
|
|
|
|
[&](std::uintptr_t module_base, void* module_handle) -> bool
|
|
|
|
|
{
|
|
|
|
|
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");
|
|
|
|
|
strcat_ptr = dlsym(dlopen("libc.so", RTLD_NOLOAD), "strcat");
|
|
|
|
|
|
|
|
|
|
ligma::hook::make_hook(fopen_ptr, reinterpret_cast<void*>(&fopen_hook));
|
|
|
|
|
ligma::hook::make_hook(system_prop_get, reinterpret_cast<void*>(&system_property_hook));
|
|
|
|
|
ligma::hook::make_hook(strcat_ptr, &strcat_hook);
|
|
|
|
|
ligma::hook::make_hook(fopen_ptr, &fopen_hook);
|
|
|
|
|
ligma::hook::make_hook(system_prop_get, &system_property_hook);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
__attribute__((noinline))
|
|
|
|
|
int null_sub()
|
|
|
|
|
char* strcat_hook(char* destination, const char* source)
|
|
|
|
|
{
|
|
|
|
|
LOGI("null_sub called, return -> null....");
|
|
|
|
|
return NULL;
|
|
|
|
|
if (!destination || !source)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
if (!strncmp(destination, "retval=1", strlen("retval=1")))
|
|
|
|
|
{
|
|
|
|
|
destination[strlen("retval=1") - 1] = '0';
|
|
|
|
|
memset(destination + strlen("retval=1"), NULL, strlen("|emulator_name="));
|
|
|
|
|
LOGI("destination string after -> %s", destination);
|
|
|
|
|
return destination;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
strcat_mutex.lock();
|
|
|
|
|
ligma::hook::disable(strcat_ptr);
|
|
|
|
|
const auto result = std::strcat(destination, source);
|
|
|
|
|
ligma::hook::enable(strcat_ptr);
|
|
|
|
|
strcat_mutex.unlock();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|