diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..03a5ecb
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,16 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+/.idea
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7560fe5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,39 @@
+
+### 简介
+
+在Android7.0以及以上的版本中,dlfcn.h头文件中dlopen, dlsym函数已经无法在系统库上使用。
+比较常见的规避方法是,先通过maps文件找到so文件对应起始地址,然后通过解析elf 文件,得到函数的偏移量,起始地址加上偏移量就算出函数的真实地址。
+具体实现方式是:[Nougat_dlfunctions](https://github.com/avs333/Nougat_dlfunctions)。不过,这种方法偶尔会不太靠谱,要么是起始地址计算错误,要么是偏移量计算不准确。
+
+这里,通过修改入口函数的LR寄存器的值,欺骗系统这是从系统库里发起调用的,从而实现绕过调用的限制。
+
+### 支持版本
+
+Android 4,5,6,7,8,9,10,11
+
+### 使用
+在cmake文件中引入:
+```
+set(bypass_dlfcn_root_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../../../lib)
+add_subdirectory(${bypass_dlfcn_root_dir} bypasss_dlfcn)
+include_directories(${bypass_dlfcn_root_dir}/include/)
+target_link_libraries(
+ your_lib
+ bypass_dlfcn)
+```
+在代码中导入头文件:
+```
+#include "bypass_dlfcn.h"
+```
+使用头文件中的接口代替dlfcn.h中的接口:
+```
+void *bp_dlopen(const char *filename, int flag);
+int bp_dlclose(void *handle);
+const char *bp_dlerror(void);
+void *bp_dlsym(void *handle, const char *symbol);
+int bp_dladdr(const void *ddr, Dl_info *info);
+```
+
+### 致谢
+
+1. [Nougat_dlfunctions](https://github.com/avs333/Nougat_dlfunctions)
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..3b3ce8b
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,59 @@
+plugins {
+ id 'com.android.application'
+ id 'kotlin-android'
+}
+
+android {
+ compileSdk 30
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ applicationId "com.example.bypass.dlfunctions"
+ minSdk 21
+ targetSdk 30
+ versionCode 1
+ versionName "1.0"
+
+ externalNativeBuild {
+ cmake {
+ cppFlags ''
+ }
+ }
+
+ ndk {
+ abiFilter("armeabi-v7a")
+// abiFilter("arm64-v8a")
+ }
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
+ externalNativeBuild {
+ cmake {
+ path file('src/main/cpp/CMakeLists.txt')
+ version '3.10.2'
+ }
+ }
+ buildFeatures {
+ viewBinding true
+ }
+}
+
+dependencies {
+
+ implementation 'androidx.core:core-ktx:1.3.2'
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'com.google.android.material:material:1.2.1'
+ implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..98b22e6
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/cpp/CMakeLists.txt b/app/src/main/cpp/CMakeLists.txt
new file mode 100644
index 0000000..344ebfe
--- /dev/null
+++ b/app/src/main/cpp/CMakeLists.txt
@@ -0,0 +1,26 @@
+cmake_minimum_required(VERSION 3.10.2)
+
+project("bypass_dlfunctions_sample")
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-stack-protector")
+
+set(bypass_dlfcn_root_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../../../lib)
+add_subdirectory(${bypass_dlfcn_root_dir} bypasss_dlfcn)
+
+include_directories(
+ ${bypass_dlfcn_root_dir}/include/
+)
+
+add_library(
+ bypass_dlfunctions_sample
+ SHARED
+ sample.cpp)
+
+find_library(
+ log-lib
+ log)
+
+target_link_libraries(
+ bypass_dlfunctions_sample
+ bypass_dlfcn
+ ${log-lib})
\ No newline at end of file
diff --git a/app/src/main/cpp/sample.cpp b/app/src/main/cpp/sample.cpp
new file mode 100644
index 0000000..d000392
--- /dev/null
+++ b/app/src/main/cpp/sample.cpp
@@ -0,0 +1,51 @@
+#include
+#include
+#include
+#include
+#include "bypass_dlfcn.h"
+
+#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "Test_DlFunctions", __VA_ARGS__)
+
+template
+inline std::string format_string(const char *format, Args... args) {
+ constexpr size_t oldlen = BUFSIZ;
+ char buffer[oldlen];
+ size_t newlen = snprintf(&buffer[0], oldlen, format, args...);
+ newlen++;
+ if (newlen > oldlen) {
+ std::vector newbuffer(newlen);
+ snprintf(newbuffer.data(), newlen, format, args...);
+ return std::string(newbuffer.data());
+ }
+ return buffer;
+}
+
+extern "C" JNIEXPORT jstring JNICALL
+Java_com_example_bypass_dlfunctions_MainActivity_test_1bypass_1dlfcn(
+ JNIEnv *env, jclass clazz) {
+
+ std::string so_file_name = "libart.so";
+ std::string target_function_name = "_ZN3art10ObjectLockINS_6mirror6ObjectEED2Ev";
+
+ void *handle = bp_dlopen(so_file_name.c_str(), RTLD_NOW);
+
+ void *func_address = bp_dlsym(handle, target_function_name.c_str());
+
+ LOGD(" bypass dlopen, dlopen result: %p, dlsym result: %p", handle, func_address);
+
+ Dl_info info;
+ bp_dladdr(func_address, &info);
+
+ std::string result;
+ result += info.dli_fname;
+ result += format_string(" dlopen result: %p", handle);
+ result += "\n";
+ result += "function name: ";
+ result += info.dli_sname;
+ result += "\n";
+ result += format_string(" dlsym result: %p", func_address);
+
+ LOGD(" result: \n %s", result.c_str());
+
+ return env->NewStringUTF(result.c_str());
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/bypass/dlfunctions/MainActivity.kt b/app/src/main/java/com/example/bypass/dlfunctions/MainActivity.kt
new file mode 100644
index 0000000..9aab9ad
--- /dev/null
+++ b/app/src/main/java/com/example/bypass/dlfunctions/MainActivity.kt
@@ -0,0 +1,36 @@
+package com.example.bypass.dlfunctions
+
+import androidx.appcompat.app.AppCompatActivity
+import android.os.Bundle
+import android.view.View
+import android.widget.Toast
+import androidx.annotation.Keep
+import com.example.bypass.dlfunctions.databinding.ActivityMainBinding
+
+@Keep
+class MainActivity : AppCompatActivity() {
+
+ private lateinit var binding: ActivityMainBinding
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ binding = ActivityMainBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+ }
+
+
+ fun clickedBtn(view: View) {
+ val result = test_bypass_dlfcn()
+ Toast.makeText(this, result, Toast.LENGTH_LONG).show()
+ }
+
+ companion object {
+ init {
+ System.loadLibrary("bypass_dlfunctions_sample")
+ }
+
+ @JvmStatic
+ @Keep
+ external fun test_bypass_dlfcn(): String
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 0000000..2b068d1
--- /dev/null
+++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..07d5da9
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..3e8fd97
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp
new file mode 100644
index 0000000..c209e78
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..b2dfe3d
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp
new file mode 100644
index 0000000..4f0f1d6
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..62b611d
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
new file mode 100644
index 0000000..948a307
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..1b9a695
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..28d4b77
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..9287f50
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..aa7d642
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..9126ae3
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml
new file mode 100644
index 0000000..bfe9519
--- /dev/null
+++ b/app/src/main/res/values-night/themes.xml
@@ -0,0 +1,16 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..f8c6127
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,10 @@
+
+
+ #FFBB86FC
+ #FF6200EE
+ #FF3700B3
+ #FF03DAC5
+ #FF018786
+ #FF000000
+ #FFFFFFFF
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..0e18dbb
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ bypass_dlfunctions
+
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
new file mode 100644
index 0000000..a8f00ef
--- /dev/null
+++ b/app/src/main/res/values/themes.xml
@@ -0,0 +1,16 @@
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..e5b5627
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,18 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+buildscript {
+ repositories {
+ google()
+ mavenCentral()
+ }
+ dependencies {
+ classpath "com.android.tools.build:gradle:7.0.0-alpha14"
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32"
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..98bed16
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,21 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app"s APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=true
+# Kotlin code style for this project: "official" or "obsolete":
+kotlin.code.style=official
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..f6b961f
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..54f7109
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Apr 28 22:42:40 CST 2021
+distributionBase=GRADLE_USER_HOME
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-rc-1-bin.zip
+distributionPath=wrapper/dists
+zipStorePath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..cccdd3d
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..e95643d
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
new file mode 100644
index 0000000..70c9a37
--- /dev/null
+++ b/lib/CMakeLists.txt
@@ -0,0 +1,30 @@
+cmake_minimum_required(VERSION 3.10.2)
+
+project("bypass_dlfcn")
+
+enable_language(ASM)
+
+if (${ANDROID_ABI} STREQUAL "armeabi-v7a")
+ set(dlfcn_trampoline_asm ${CMAKE_CURRENT_SOURCE_DIR}/dlfcn_trampoline32.S)
+elseif (${ANDROID_ABI} STREQUAL "arm64-v8a")
+ set(dlfcn_trampoline_asm ${CMAKE_CURRENT_SOURCE_DIR}/dlfcn_trampoline64.S)
+endif ()
+
+set(bypass_dlfcn_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/bypass_dlfcn.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/efl_parser.c)
+
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/
+)
+
+add_library(
+ bypass_dlfcn
+ STATIC # You can change it to SHARED, to build an seperate so into the apk
+ ${dlfcn_trampoline_asm}
+ ${bypass_dlfcn_sources}
+)
+
+target_link_libraries(
+ bypass_dlfcn
+ log)
\ No newline at end of file
diff --git a/lib/bypass_dlfcn.c b/lib/bypass_dlfcn.c
new file mode 100644
index 0000000..70f0a5f
--- /dev/null
+++ b/lib/bypass_dlfcn.c
@@ -0,0 +1,160 @@
+// MIT License
+// Copyright (c) 2021 Windysha
+// https://github.com/WindySha/bypass_dlfunctions
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+#include
+#include
+#include
+#include
+#include "dlfcn_trampoline.h"
+#include "bypass_dlfcn.h"
+#include "efl_parser.h"
+
+#define ANDROID_KITKAT 19
+#define ANDROID_KITKAT_WATCH 20
+#define ANDROID_LOLLIPOP 21
+#define ANDROID_LOLLIPOP_MR1 22
+#define ANDROID_M 23
+#define ANDROID_N 24
+#define ANDROID_N_MR1 25
+#define ANDROID_O 26
+#define ANDROID_O_MR1 27
+#define ANDROID_P 28
+#define ANDROID_Q 29
+#define ANDROID_R 30
+
+#ifdef __LP64__
+static const char *const kSystemLibDir = "/system/lib64/";
+static const char *const kOdmLibDir = "/odm/lib64/";
+static const char *const kVendorLibDir = "/vendor/lib64/";
+static const char *const kApexLibDir = "/apex/com.android.runtime/lib64/";
+static const char *const kApexArtNsLibDir = "/apex/com.android.art/lib64/";
+#else
+static const char *const kSystemLibDir = "/system/lib/";
+static const char *const kOdmLibDir = "/odm/lib/";
+static const char *const kVendorLibDir = "/vendor/lib/";
+static const char *const kApexLibDir = "/apex/com.android.runtime/lib/";
+static const char *const kApexArtNsLibDir = "/apex/com.android.art/lib/";
+#endif
+
+static int api_level = -1;
+static inline int32_t get_android_api_level() {
+ if (api_level < 0) {
+ char api[PROP_VALUE_MAX];
+ __system_property_get("ro.build.version.sdk", api);
+ api_level = atoi(api);
+ }
+ return api_level;
+}
+
+static void *trampoline_address_from_system_lib = NULL;
+static void *get_trampoline_address() {
+ if (trampoline_address_from_system_lib == NULL) {
+ // choose an address in the libnativebridge.so, beacasue libnativebridge.so is very small.
+ const char *nativeBridge_name = "libnativebridge.so";
+ const char *so_prefix;
+ if (get_android_api_level() >= ANDROID_R) {
+ so_prefix = kApexArtNsLibDir;
+ } else if (get_android_api_level() == ANDROID_Q) {
+ so_prefix = kApexLibDir;
+ } else {
+ so_prefix = kSystemLibDir;
+ }
+ char target_so_path[512];
+ memset(target_so_path, 0, sizeof(target_so_path));
+ sprintf(target_so_path, "%s%s", so_prefix, nativeBridge_name);
+
+#ifdef __LP64__
+ const ASM_Instruction instruction[2] = {
+ 0xA8C17BFD, // ldp x29, x30, [sp],#16
+ 0xD65F03C0 // ret
+ };
+ trampoline_address_from_system_lib =
+ getInstructionAddressFromElf(target_so_path, &instruction, 2);
+#else
+ const ASM_Instruction instruction = 0xBD10; // pop {r4, pc}
+ trampoline_address_from_system_lib =
+ getInstructionAddressFromElf(target_so_path, &instruction, 1) + 1; // This is thumb instruction, need +1 here !!
+#endif
+ LOGI("get trampoline_address_from_system_lib result : %p ", trampoline_address_from_system_lib);
+ }
+ return trampoline_address_from_system_lib;
+}
+
+static inline void *bp_dlopen_with_fullpath(const char *filename, int flag) {
+ if (get_android_api_level() < ANDROID_N) {
+ return dlopen(filename, flag);
+ }
+ return dlfcn_trampoline(filename, (void *) flag, get_trampoline_address(), dlopen);
+}
+
+void *JNIEXPORT bp_dlopen(const char *filename, int flag) {
+ void *handle = NULL;
+ if (strlen(filename) > 0 && filename[0] == '/') {
+ handle = bp_dlopen_with_fullpath(filename, flag);
+ }
+ if (handle)
+ return handle;
+
+ const char *file_path_prefix[] =
+ {kApexArtNsLibDir, kApexLibDir, kSystemLibDir, kVendorLibDir, kOdmLibDir};
+ int size = 5;
+ char full_name[512] = {0};
+
+ for (int i = 0; i < size; i++) {
+ const char *prefix = file_path_prefix[i];
+ memset(full_name, 0, sizeof(full_name));
+ sprintf(full_name, "%s%s", prefix, filename);
+
+ handle = bp_dlopen_with_fullpath(full_name, flag);
+ if (handle)
+ return handle;
+ }
+ return NULL;
+}
+
+int JNIEXPORT bp_dlclose(void *handle) {
+ if (get_android_api_level() < ANDROID_N) {
+ return dlclose(handle);
+ }
+ return (int) dlfcn_trampoline(handle, NULL, get_trampoline_address(), dlclose);
+}
+
+const char *JNIEXPORT bp_dlerror(void) {
+ if (get_android_api_level() < ANDROID_N) {
+ return dlerror();
+ }
+ return dlfcn_trampoline(NULL, NULL, get_trampoline_address(), dlerror);
+}
+
+void *JNIEXPORT bp_dlsym(void *handle, const char *symbol) {
+ if (get_android_api_level() < ANDROID_N) {
+ return dlsym(handle, symbol);
+ }
+ return dlfcn_trampoline(handle, symbol, get_trampoline_address(), dlsym);
+}
+
+int JNIEXPORT bp_dladdr(const void *ddr, Dl_info *info) {
+ if (get_android_api_level() < ANDROID_N) {
+ return dladdr(ddr, info);
+ }
+ return (int) dlfcn_trampoline(ddr, info, get_trampoline_address(), dladdr);
+}
\ No newline at end of file
diff --git a/lib/dlfcn_trampoline.h b/lib/dlfcn_trampoline.h
new file mode 100644
index 0000000..2e2c6b0
--- /dev/null
+++ b/lib/dlfcn_trampoline.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// this is the bridge function, jump to dl functions:
+// 1. save original lr address to the stack
+// 2. store fake_lr_address to the lr address
+// 3. jump to execute real_function
+// so the dl functions will use the fake_lr_address as the lr address, and allow this execution.
+void *dlfcn_trampoline(const void *arg0, const void *arg1,
+ const void *fake_lr_address, const void *real_function);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/lib/dlfcn_trampoline32.S b/lib/dlfcn_trampoline32.S
new file mode 100644
index 0000000..38fc3e2
--- /dev/null
+++ b/lib/dlfcn_trampoline32.S
@@ -0,0 +1,11 @@
+.text
+.align 4
+.code 16
+
+.globl dlfcn_trampoline
+.type dlfcn_trampoline, %function
+
+dlfcn_trampoline:
+ push {r4, lr}
+ mov lr, r2
+ mov pc, r3
\ No newline at end of file
diff --git a/lib/dlfcn_trampoline64.S b/lib/dlfcn_trampoline64.S
new file mode 100644
index 0000000..c252385
--- /dev/null
+++ b/lib/dlfcn_trampoline64.S
@@ -0,0 +1,11 @@
+.text
+.align 4
+
+.globl dlfcn_trampoline
+.type dlfcn_trampoline, %function
+
+dlfcn_trampoline:
+ stp x29, x30, [sp, #-16]!
+ mov x29, sp
+ mov x30, x2
+ br x3
\ No newline at end of file
diff --git a/lib/efl_parser.c b/lib/efl_parser.c
new file mode 100644
index 0000000..9a1a106
--- /dev/null
+++ b/lib/efl_parser.c
@@ -0,0 +1,139 @@
+// MIT License
+// Copyright (c) 2021 Windysha
+// https://github.com/WindySha/bypass_dlfunctions
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "efl_parser.h"
+
+static void *getBaseAddressFromMaps(const char *file_name) {
+ FILE *maps;
+ char buff[256];
+ off_t load_addr;
+ maps = fopen("/proc/self/maps", "r");
+ int result = 0;
+ while (fgets(buff, sizeof(buff), maps)) {
+ if ((strstr(buff, "r-xp") || strstr(buff, "r--p")) && strstr(buff, file_name)) {
+ result = sscanf(buff, "%lx", &load_addr);
+ break;
+ }
+ }
+ fclose(maps);
+ if (result != 1) {
+ LOGE("failed to read loaded eld address for %s", file_name);
+ return NULL;
+ }
+
+ LOGD("get elf base %s: %p", file_name, load_addr);
+ return (void *) load_addr;
+}
+
+// parse the elf file's .text section, find the address which instruction equals to instruction_addr
+void *getInstructionAddressFromElf(const char *elf_file, const ASM_Instruction* instruction_addr, size_t instruction_legnth) {
+
+ //load the elf file
+ int fd = open(elf_file, O_RDONLY);
+ if (fd < 0) {
+ LOGE("failed to open file -> %s", elf_file);
+ return NULL;
+ }
+
+ off_t size = lseek(fd, 0, SEEK_END);
+ if (size <= 0) {
+ LOGE("lseek() failed for file -> %s", elf_file);
+ }
+
+ Elf_Ehdr *elf_header = (Elf_Ehdr *) mmap(0, size, PROT_READ, MAP_SHARED, fd, 0);
+ close(fd);
+
+ if (elf_header == MAP_FAILED) {
+ LOGE("mmap() failed for file %s", elf_file);
+ return NULL;
+ }
+
+ off_t bias = -4096;
+ Elf_Shdr *progbits_section = NULL;
+
+ // find the section header, according to the section header offset in the head
+ Elf_Shdr *section_header = (Elf_Shdr *) (((size_t) elf_header) + elf_header->e_shoff);
+ size_t section_header_ptr_size =
+ elf_header->e_shentsize; //this number equals to: sizeof(Elf_Shdr)
+
+ // find the string table offset by the section string offset in the header
+ Elf_Off sec_str_off = section_header[elf_header->e_shstrndx].sh_offset;
+ char *section_str = (char *) (((size_t) elf_header) + sec_str_off);
+
+ size_t iterate_sec_h = (size_t) section_header;
+ for (int i = 0; i < elf_header->e_shnum;
+ i++, iterate_sec_h += section_header_ptr_size) {
+ Elf_Shdr *sec_h = (Elf_Shdr *) iterate_sec_h;
+ if (sec_h->sh_type == SHT_PROGBITS) {
+
+ if (bias == -4096) {
+ bias = (off_t) sec_h->sh_addr - (off_t) sec_h->sh_offset;
+ }
+
+ //sh_name is the name offset in the section string table
+ char *section_header_name = sec_h->sh_name + section_str;
+
+ if (strcmp(section_header_name, ".text") == 0) {
+ progbits_section = sec_h;
+ break;
+ }
+ }
+ }
+
+ if (progbits_section == NULL) {
+ LOGE("cannot find the .text section part in file %s", elf_file);
+ goto error_exit;
+ }
+
+ void *base_address = getBaseAddressFromMaps(elf_file);
+
+ ASM_Instruction* instr_start = (ASM_Instruction *) (((size_t) elf_header) + progbits_section->sh_offset);
+ size_t instr_code_size = sizeof(ASM_Instruction);
+ size_t instruc_offset = 0;
+ for (int i = 0; i < progbits_section->sh_size; i+=instr_code_size, instr_start++) {
+ bool instruction_matched = true;
+ for (int j = 0; j < instruction_legnth; j++) {
+ if (*(instr_start + j) != *(instruction_addr + j)) {
+ instruction_matched = false;
+ break;
+ }
+ }
+ if (instruction_matched) {
+ instruc_offset = i;
+ break;
+ }
+ }
+ off_t off = progbits_section->sh_addr + instruc_offset;
+ return (void *) ((size_t) base_address + off - bias);
+
+ error_exit:
+ if (elf_header != MAP_FAILED)
+ munmap(elf_header, size);
+ return NULL;
+}
\ No newline at end of file
diff --git a/lib/efl_parser.h b/lib/efl_parser.h
new file mode 100644
index 0000000..18ab237
--- /dev/null
+++ b/lib/efl_parser.h
@@ -0,0 +1,57 @@
+// MIT License
+// Copyright (c) 2021 Windysha
+// https://github.com/WindySha/bypass_dlfunctions
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+#pragma once
+
+#include
+#include
+#include
+
+#if defined(__LP64__)
+typedef Elf64_Ehdr Elf_Ehdr;
+typedef Elf64_Shdr Elf_Shdr;
+typedef Elf64_Off Elf_Off;
+typedef Elf32_Addr ASM_Instruction;
+
+#else
+
+typedef Elf32_Ehdr Elf_Ehdr;
+typedef Elf32_Shdr Elf_Shdr;
+typedef Elf32_Off Elf_Off;
+typedef Elf32_Half ASM_Instruction;
+
+#endif
+
+#define LOG_TAG "Bypass_DlFunctions"
+#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
+#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
+#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void *getInstructionAddressFromElf(const char *elf_file, const ASM_Instruction* instruction_addr, size_t instruction_legnt);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/lib/include/bypass_dlfcn.h b/lib/include/bypass_dlfcn.h
new file mode 100644
index 0000000..a9b6ff3
--- /dev/null
+++ b/lib/include/bypass_dlfcn.h
@@ -0,0 +1,39 @@
+// MIT License
+// Copyright (c) 2021 Windysha
+// https://github.com/WindySha/bypass_dlfunctions
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+#pragma once
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void *bp_dlopen(const char *filename, int flag);
+int bp_dlclose(void *handle);
+const char *bp_dlerror(void);
+void *bp_dlsym(void *handle, const char *symbol);
+int bp_dladdr(const void *ddr, Dl_info *info);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..2d35227
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,10 @@
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ google()
+ mavenCentral()
+ jcenter() // Warning: this repository is going to shut down soon
+ }
+}
+rootProject.name = "bypass_dlfunctions"
+include ':app'