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
42543579
Commit
42543579
authored
Jan 23, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 5.1, jni need fix
parent
b8775fba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
ActivityHooker.java
...src/main/java/com/swift/sandhook/test/ActivityHooker.java
+19
-2
CustmizeHooker.java
...src/main/java/com/swift/sandhook/test/CustmizeHooker.java
+6
-1
No files found.
app/src/main/java/com/swift/sandhook/test/ActivityHooker.java
View file @
42543579
...
@@ -9,14 +9,27 @@ import com.swift.sandhook.wrapper.HookMethod;
...
@@ -9,14 +9,27 @@ import com.swift.sandhook.wrapper.HookMethod;
import
com.swift.sandhook.wrapper.HookMethodBackup
;
import
com.swift.sandhook.wrapper.HookMethodBackup
;
import
com.swift.sandhook.wrapper.MethodParams
;
import
com.swift.sandhook.wrapper.MethodParams
;
import
java.lang.reflect.Method
;
@HookClass
(
Activity
.
class
)
@HookClass
(
Activity
.
class
)
public
class
ActivityHooker
{
public
class
ActivityHooker
{
@HookMethodBackup
(
"onCreate"
)
@MethodParams
(
Bundle
.
class
)
static
Method
onCreateBackup
;
@HookMethodBackup
(
"onPause"
)
static
Method
onPauseBackup
;
@HookMethod
(
"onCreate"
)
@HookMethod
(
"onCreate"
)
@MethodParams
(
Bundle
.
class
)
@MethodParams
(
Bundle
.
class
)
public
static
void
onCreate
(
Activity
thiz
,
Bundle
bundle
)
{
public
static
void
onCreate
(
Activity
thiz
,
Bundle
bundle
)
{
Log
.
e
(
"ActivityHooker"
,
"hooked onCreate success "
+
thiz
);
Log
.
e
(
"ActivityHooker"
,
"hooked onCreate success "
+
thiz
);
onCreateBackup
(
thiz
,
bundle
);
try
{
onCreateBackup
.
invoke
(
thiz
,
bundle
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
@HookMethodBackup
(
"onCreate"
)
@HookMethodBackup
(
"onCreate"
)
...
@@ -28,7 +41,11 @@ public class ActivityHooker {
...
@@ -28,7 +41,11 @@ public class ActivityHooker {
@HookMethod
(
"onPause"
)
@HookMethod
(
"onPause"
)
public
static
void
onPause
(
Activity
thiz
)
{
public
static
void
onPause
(
Activity
thiz
)
{
Log
.
e
(
"ActivityHooker"
,
"hooked onPause success "
+
thiz
);
Log
.
e
(
"ActivityHooker"
,
"hooked onPause success "
+
thiz
);
onPauseBackup
(
thiz
);
try
{
onPauseBackup
.
invoke
(
thiz
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
@HookMethodBackup
(
"onPause"
)
@HookMethodBackup
(
"onPause"
)
...
...
app/src/main/java/com/swift/sandhook/test/CustmizeHooker.java
View file @
42543579
...
@@ -21,7 +21,12 @@ public class CustmizeHooker {
...
@@ -21,7 +21,12 @@ public class CustmizeHooker {
@MethodParams
({
int
.
class
,
int
.
class
})
@MethodParams
({
int
.
class
,
int
.
class
})
public
static
int
staticMethodHooked
(
int
a
,
int
b
)
{
public
static
int
staticMethodHooked
(
int
a
,
int
b
)
{
Log
.
e
(
"CustmizeHooker"
,
"methodBeHooked be hooked"
);
Log
.
e
(
"CustmizeHooker"
,
"methodBeHooked be hooked"
);
return
staticMethodHookedBackup
(
a
,
b
);
try
{
return
(
int
)
backup
.
invoke
(
null
,
a
,
b
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
0
;
}
}
@HookMethodBackup
(
"methodBeHooked"
)
@HookMethodBackup
(
"methodBeHooked"
)
...
...
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