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
0edd3087
Commit
0edd3087
authored
Mar 15, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add pass reflection on Android Q
parent
de263333
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
ReflectionUtils.java
...c/main/java/com/swift/sandhook/utils/ReflectionUtils.java
+38
-0
No files found.
hooklib/src/main/java/com/swift/sandhook/utils/ReflectionUtils.java
0 → 100644
View file @
0edd3087
package
com
.
swift
.
sandhook
.
utils
;
import
android.util.Log
;
import
java.lang.reflect.Method
;
//
// Created by Swift Gan on 2019/3/15.
//
public
class
ReflectionUtils
{
public
static
Method
forNameMethod
;
public
static
Method
getMethodMethod
;
static
Class
vmRuntimeClass
;
static
Method
addWhiteListMethod
;
static
Object
vmRuntime
;
static
{
try
{
getMethodMethod
=
Class
.
class
.
getDeclaredMethod
(
"getDeclaredMethod"
,
String
.
class
,
Class
[].
class
);
forNameMethod
=
Class
.
class
.
getDeclaredMethod
(
"forName"
,
String
.
class
);
vmRuntimeClass
=
(
Class
)
forNameMethod
.
invoke
(
null
,
"dalvik.system.VMRuntime"
);
addWhiteListMethod
=
(
Method
)
getMethodMethod
.
invoke
(
vmRuntimeClass
,
"setHiddenApiExemptions"
,
new
Class
[]{
String
[].
class
});
Method
getVMRuntimeMethod
=
(
Method
)
getMethodMethod
.
invoke
(
vmRuntimeClass
,
"getRuntime"
,
null
);
vmRuntime
=
getVMRuntimeMethod
.
invoke
(
null
);
}
catch
(
Exception
e
)
{
Log
.
e
(
"ReflectionUtils"
,
"error get methods"
,
e
);
}
}
//className like Lcom/swift/sandhook/utils/ReflectionUtils
public
static
void
addReflectionWhiteList
(
String
...
classNames
)
throws
Throwable
{
addWhiteListMethod
.
invoke
(
vmRuntime
,
new
Object
[]
{
classNames
});
}
}
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