Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SandHook
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
SandHook
Commits
11c29136
Commit
11c29136
authored
Jun 10, 2019
by
ganyao114
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[AndroidQ]fit for Apex build
parent
8fcf4c03
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
6 deletions
+48
-6
hide_api.cpp
hooklib/src/main/cpp/utils/hide_api.cpp
+24
-4
art_jni_trampoline.cpp
xposedcompat_new/src/main/cpp/art_jni_trampoline.cpp
+24
-2
No files found.
hooklib/src/main/cpp/utils/hide_api.cpp
View file @
11c29136
...
...
@@ -6,6 +6,7 @@
#include "../includes/elf_util.h"
#include "../includes/log.h"
#include "../includes/utils.h"
#include <fcntl.h>
extern
int
SDK_INT
;
...
...
@@ -34,16 +35,35 @@ extern "C" {
JavaVM
*
jvm
;
bool
fileExits
(
const
char
*
path
)
{
int
fd
=
open
(
path
,
O_RDONLY
);
if
(
fd
<
0
)
{
return
false
;
}
close
(
fd
);
return
true
;
}
void
initHideApi
(
JNIEnv
*
env
)
{
env
->
GetJavaVM
(
&
jvm
);
if
(
BYTE_POINT
==
8
)
{
art_lib_path
=
"/system/lib64/libart.so"
;
jit_lib_path
=
"/system/lib64/libart-compiler.so"
;
if
(
SDK_INT
>=
ANDROID_Q
&&
fileExits
(
"/apex/com.android.runtime/lib64/libart.so"
))
{
art_lib_path
=
"/apex/com.android.runtime/lib64/libart.so"
;
jit_lib_path
=
"/apex/com.android.runtime/lib64/libart-compiler.so"
;
}
else
{
art_lib_path
=
"/system/lib64/libart.so"
;
jit_lib_path
=
"/system/lib64/libart-compiler.so"
;
}
}
else
{
art_lib_path
=
"/system/lib/libart.so"
;
jit_lib_path
=
"/system/lib/libart-compiler.so"
;
if
(
SDK_INT
>=
ANDROID_Q
&&
fileExits
(
"/apex/com.android.runtime/lib/libart.so"
))
{
art_lib_path
=
"/apex/com.android.runtime/lib/libart.so"
;
jit_lib_path
=
"/apex/com.android.runtime/lib/libart-compiler.so"
;
}
else
{
art_lib_path
=
"/system/lib/libart.so"
;
jit_lib_path
=
"/system/lib/libart-compiler.so"
;
}
}
//init compile
...
...
xposedcompat_new/src/main/cpp/art_jni_trampoline.cpp
View file @
11c29136
...
...
@@ -3,6 +3,8 @@
//
#include <cstring>
#include <fcntl.h>
#include <unistd.h>
#include <utils/log.h>
#include "art_jni_trampoline.h"
#include "sandhook_native.h"
...
...
@@ -277,6 +279,14 @@ FFIClosure* BuildJniClosure(ArtHookParam *param) {
return
cif
->
CreateClosure
(
param
,
FFIJniDispatcher
);
}
bool
fileExits
(
const
char
*
path
)
{
int
fd
=
open
(
path
,
O_RDONLY
);
if
(
fd
<
0
)
{
return
false
;
}
close
(
fd
);
return
true
;
}
extern
"C"
JNIEXPORT
void
JNICALL
...
...
@@ -286,12 +296,24 @@ Java_com_swift_sandhook_xposedcompat_XposedCompat_init(JNIEnv *env, jclass type,
bridgeMethod
=
env
->
FromReflectedMethod
(
jbridgeMethod
);
env
->
GetJavaVM
(
&
javaVM
);
Types
::
Load
(
env
);
const
char
*
art_lib_path
;
if
(
sizeof
(
size_t
)
==
8
)
{
//Android Q Apex
if
(
fileExits
(
"/apex/com.android.runtime/lib64/libart.so"
))
{
art_lib_path
=
"/apex/com.android.runtime/lib64/libart.so"
;
}
else
{
art_lib_path
=
"/system/lib64/libart.so"
;
}
GetOatQuickMethodHeaderBackup
=
reinterpret_cast
<
void
*
(
*
)(
void
*
,
uintptr_t
)
>
(
SandInlineHookSym
(
"/system/lib64/libart.so"
,
"_ZN3art9ArtMethod23GetOatQuickMethodHeaderEm"
,
(
void
*
)
NewGetOatQuickMethodHeader
));
uintptr_t
)
>
(
SandInlineHookSym
(
art_lib_path
,
"_ZN3art9ArtMethod23GetOatQuickMethodHeaderEm"
,
(
void
*
)
NewGetOatQuickMethodHeader
));
}
else
{
if
(
fileExits
(
"/apex/com.android.runtime/lib/libart.so"
))
{
art_lib_path
=
"/apex/com.android.runtime/lib/libart.so"
;
}
else
{
art_lib_path
=
"/system/lib/libart.so"
;
}
GetOatQuickMethodHeaderBackup
=
reinterpret_cast
<
void
*
(
*
)(
void
*
,
uintptr_t
)
>
(
SandInlineHookSym
(
"/system/lib/libart.so"
,
"_ZN3art9ArtMethod23GetOatQuickMethodHeaderEj"
,
(
void
*
)
NewGetOatQuickMethodHeader
));
uintptr_t
)
>
(
SandInlineHookSym
(
art_lib_path
,
"_ZN3art9ArtMethod23GetOatQuickMethodHeaderEj"
,
(
void
*
)
NewGetOatQuickMethodHeader
));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment