Skip to content

Instantly share code, notes, and snippets.

View khanhduytran0's full-sized avatar

Duy Tran Khanh khanhduytran0

View GitHub Profile
@khanhduytran0
khanhduytran0 / dlopen.cpp
Created August 23, 2020 00:10
Example of dlopening greylisted libraries or dlopening libraries with custom LD_LIBRARY_PATH. Android 5.0+
#include <dlfcn.h>
#include <cstring>
#include <android/dlext.h>
#include "log.h" // LOGE, LOGW, etc...
bool (*_android_init_namespaces)(const char* public_ns_sonames, const char* anon_ns_library_path) = nullptr;
bool __unused android_init_namespaces(const char* public_ns_sonames, const char* anon_ns_library_path) {
if (!_android_init_namespaces) {
void *libdl_handle;