removed anti cheat entirely

master
xerox 4 years ago
parent f9498c3dc5
commit 08b972db53

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -4,37 +4,44 @@ namespace ligma
{ {
namespace bypass 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) void init(const std::function<bool(std::uintptr_t, void*)>& callback)
{ {
ligma::utils::on_image_load("libil2cpp.so", 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( LOGI("libxlua.so base -> %p, module_handle -> %p", module_base, module_handle);
dlsym(dlopen("libxlua.so", RTLD_NOLOAD), "luaL_loadbufferx"), ligma::hook::make_hook(dlsym(module_handle, "luaL_loadbufferx"), &load_bufferx_hook);
reinterpret_cast<void*>(&load_bufferx_hook) LOGI("installed libxlua.so hooks!");
); return false;
LOGI("installed libxlua.so hooks!"); }
return false; );
});
// TODO: add more hooks on libtersafe.so with dlsym_hook... ligma::utils::on_image_load("libtersafe.so",
ligma::utils::on_image_load("libtersafe.so", [&](std::uintptr_t module_base, void* module_handle) -> bool [&](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);
return false;
}); // 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"); fopen_ptr = dlsym(dlopen("libc.so", RTLD_NOLOAD), "fopen");
system_prop_get = dlsym(dlopen("libc.so", RTLD_NOLOAD), "__system_property_get"); 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(fopen_ptr, reinterpret_cast<void*>(&fopen_hook));
ligma::hook::make_hook(system_prop_get, reinterpret_cast<void*>(&system_property_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! // dont let a single lua script load!
// //
@ -77,12 +84,12 @@ namespace ligma
system_prop_mutex.unlock(); 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 && if (!strcmp(name, "persist.sys.timezone") &&
strcmp(name, "ro.build.fingerprint") != 0 && !strcmp(name, "ro.build.fingerprint") &&
strcmp(name, "ro.revision") != 0 && !strcmp(name, "ro.revision") &&
strcmp(name, "ro.build.version.sdk") != 0) !strcmp(name, "ro.build.version.sdk"))
value = HWID_VALUE; value = HWID_VALUE;
return strlen(value); return strlen(value);

@ -19,6 +19,7 @@ namespace ligma
inline std::mutex system_prop_mutex; inline std::mutex system_prop_mutex;
void init(const std::function<bool(std::uintptr_t, void*)>& callback); void init(const std::function<bool(std::uintptr_t, void*)>& callback);
int null_sub();
FILE* fopen_hook(const char* path, const char* mode); FILE* fopen_hook(const char* path, const char* mode);
int system_property_hook(const char* name, char* value); int system_property_hook(const char* name, char* value);
int load_bufferx_hook(void* L, const char* buff, size_t sz, const char* name, const char* mode); int load_bufferx_hook(void* L, const char* buff, size_t sz, const char* name, const char* mode);

@ -1,5 +1,4 @@
#include "dlsym_hook.h" #include "dlsym_hook.h"
#include "../ligma.h"
namespace ligma namespace ligma
{ {
@ -26,24 +25,17 @@ namespace ligma
__attribute__((noinline)) __attribute__((noinline))
void* dlsym_handler(void* handle, const char* symbol) void* dlsym_handler(void* handle, const char* symbol)
{ {
LOGI("dlsym hook called! handle = %p, symbol = %s", handle, symbol); for (const auto& [map_handle, function_ptr] : *get_dlsym_hooks())
try if (map_handle.first == handle)
{ if(std::regex_match(symbol, std::regex(map_handle.second.data())))
return get_dlsym_hooks()->at({ handle, symbol }); return function_ptr;
}
catch (std::out_of_range& e)
{}
return dlsym_bypass(handle, symbol); return dlsym_bypass(handle, symbol);
} }
void dlsym_unhook(const std::pair<void*, const char*>& symbol_data) void dlsym_unhook(const std::pair<void*, std::string_view>& symbol_data)
{ {
try get_dlsym_hooks()->erase(symbol_data);
{
get_dlsym_hooks()->erase(symbol_data);
}
catch (std::out_of_range& e)
{}
} }
} }
} }

@ -3,6 +3,7 @@
#include <dlfcn.h> #include <dlfcn.h>
#include <string> #include <string>
#include <android/log.h> #include <android/log.h>
#include <regex>
#include "shithook.h" #include "shithook.h"
#define LOGI(...) ((void)__android_log_print(4, "ligma", __VA_ARGS__)) #define LOGI(...) ((void)__android_log_print(4, "ligma", __VA_ARGS__))
@ -18,7 +19,7 @@ namespace ligma
void* dlsym_bypass(void* handle, const char* symbol); void* dlsym_bypass(void* handle, const char* symbol);
void* dlsym_handler(void* handle, const char* symbol); void* dlsym_handler(void* handle, const char* symbol);
auto get_dlsym_hooks() -> std::map<std::pair<void*, std::string_view>, void*>*; auto get_dlsym_hooks() -> std::map<std::pair<void*, std::string_view>, void*>*;
void dlsym_unhook(const std::pair<void*, const char*>& symbol_data); void dlsym_unhook(const std::pair<void*, std::string_view>& symbol_data);
template <class T> template <class T>
inline void dlsym_hook(std::pair<void*, const char*> symbol_data, T* function_ptr) inline void dlsym_hook(std::pair<void*, const char*> symbol_data, T* function_ptr)
@ -35,7 +36,7 @@ namespace ligma
{ {
{ {
symbol_data.first, symbol_data.first,
std::string_view{ symbol_data.second } std::string_view{symbol_data.second}
}, },
reinterpret_cast<void*>(function_ptr) reinterpret_cast<void*>(function_ptr)
} }

Loading…
Cancel
Save