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
6348b1d4
Commit
6348b1d4
authored
Apr 12, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
skip dex2oat SandHooker
parent
51d6ef6c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
native_hook.cpp
hooklib/src/main/cpp/nativehook/native_hook.cpp
+17
-2
No files found.
hooklib/src/main/cpp/nativehook/native_hook.cpp
View file @
6348b1d4
...
...
@@ -20,6 +20,19 @@ int inline getArrayItemCount(char *const array[]) {
return
i
;
}
bool
isSandHooker
(
char
*
const
args
[])
{
int
orig_arg_count
=
getArrayItemCount
(
args
);
for
(
int
i
=
0
;
i
<
orig_arg_count
;
i
++
)
{
if
(
SDK_INT
>=
ANDROID_N
&&
strstr
(
args
[
i
],
"SandHooker"
))
{
LOGE
(
"skip dex2oat hooker!"
);
return
true
;
}
}
return
false
;
}
char
**
build_new_env
(
char
*
const
envp
[])
{
char
*
provided_ld_preload
=
NULL
;
int
provided_ld_preload_index
=
-
1
;
...
...
@@ -58,8 +71,11 @@ char **build_new_env(char *const envp[]) {
}
extern
"C"
int
fake_execve_disable_inline
(
const
char
*
pathname
,
char
*
argv
[],
char
*
const
envp
[])
{
LOGE
(
"dex2oat by disable inline!"
);
if
(
strstr
(
pathname
,
"dex2oat"
))
{
if
(
SDK_INT
>=
ANDROID_N
&&
isSandHooker
(
argv
))
{
LOGE
(
"skip dex2oat!"
);
return
-
1
;
}
char
**
new_envp
=
build_new_env
(
envp
);
LOGE
(
"dex2oat by disable inline!"
);
int
ret
=
static_cast
<
int
>
(
syscall
(
__NR_execve
,
pathname
,
argv
,
new_envp
));
...
...
@@ -71,7 +87,6 @@ extern "C" int fake_execve_disable_inline(const char *pathname, char *argv[], ch
}
extern
"C"
int
fake_execve_disable_oat
(
const
char
*
pathname
,
char
*
argv
[],
char
*
const
envp
[])
{
LOGE
(
"skip dex2oat!"
);
if
(
strstr
(
pathname
,
"dex2oat"
))
{
LOGE
(
"skip dex2oat!"
);
return
-
1
;
...
...
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