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
01661bfa
Commit
01661bfa
authored
May 14, 2019
by
swift_gan
Committed by
swift_gan
May 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update test case
parent
e46299fd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
6 deletions
+27
-6
sandhook_native.cpp
nativehook/src/main/cpp/sandhook_native.cpp
+11
-6
log.h
nativehook/src/main/cpp/utils/log.h
+16
-0
No files found.
nativehook/src/main/cpp/sandhook_native.cpp
View file @
01661bfa
...
...
@@ -8,12 +8,13 @@
#include "inst_arm64.h"
#include "decoder_arm64.h"
#include "hook.h"
#include "log.h"
using
namespace
SandHook
::
Asm
;
using
namespace
SandHook
::
Decoder
;
using
namespace
SandHook
::
Hook
;
void
(
*
dosth3Backup
)()
=
nullptr
;
void
(
*
dosth3Backup
)(
int
)
=
nullptr
;
bool
memUnprotect
(
Addr
addr
,
Addr
len
)
{
long
pagesize
=
4096
;
...
...
@@ -33,19 +34,23 @@ void do2() {
int
d
=
1
+
1
;
}
void
do3
()
{
void
do3
(
int
x
)
{
if
(
x
>
0
)
{
return
;
}
int
a
=
1
+
1
;
int
b
=
1
+
1
;
int
c
=
1
+
1
;
int
d
=
a
+
b
+
c
;
LOGE
(
"x = %d"
,
x
);
}
void
do3replace
()
{
void
do3replace
(
int
x
)
{
int
a
=
1
+
1
;
int
b
=
1
+
1
;
int
c
=
1
+
1
;
int
d
=
1
+
1
;
dosth3Backup
();
dosth3Backup
(
x
);
}
void
do1
()
{
...
...
@@ -100,10 +105,10 @@ Java_com_swift_sandhook_nativehook_NativeHook_test(JNIEnv *env, jclass jclass1)
InlineHookArm64Android
inlineHookArm64Android
=
InlineHookArm64Android
();
dosth3Backup
=
reinterpret_cast
<
void
(
*
)()
>
(
inlineHookArm64Android
.
inlineHook
(
dosth3Backup
=
reinterpret_cast
<
void
(
*
)(
int
)
>
(
inlineHookArm64Android
.
inlineHook
(
reinterpret_cast
<
void
*>
(
do3
),
reinterpret_cast
<
void
*>
(
do3replace
)));
do3
();
do3
(
3
);
}
\ No newline at end of file
nativehook/src/main/cpp/utils/log.h
0 → 100644
View file @
01661bfa
//
// Created by SwiftGan on 2019/2/15.
//
#ifndef SANDHOOK_LOG_H
#define SANDHOOK_LOG_H
#include "android/log.h"
#define TAG "SandHook-Native"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
#endif //SANDHOOK_LOG_H
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