Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
R
RatelApi
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
ratel
RatelApi
Commits
5088e9af
Commit
5088e9af
authored
Sep 30, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加更多api
parent
f8c40934
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
1 deletion
+56
-1
UnPackerToolKit.java
src/main/java/com/virjar/ratel/api/UnPackerToolKit.java
+56
-1
No files found.
src/main/java/com/virjar/ratel/api/UnPackerToolKit.java
View file @
5088e9af
...
...
@@ -14,6 +14,7 @@ import java.lang.reflect.Constructor;
import
java.lang.reflect.Method
;
import
java.util.Enumeration
;
import
java.util.List
;
import
java.util.Random
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.zip.ZipEntry
;
...
...
@@ -60,6 +61,29 @@ public class UnPackerToolKit {
autoEnable
(
false
);
}
public
interface
UnpackEvent
{
void
onFinish
(
File
file
);
}
public
static
void
unpack
(
UnpackEvent
unpackEvent
)
{
autoEnable
();
new
Thread
(
"construct-unpack"
)
{
@Override
public
void
run
()
{
try
{
Thread
.
sleep
(
30
*
1000
+
new
Random
().
nextInt
(
2000
));
File
apkFile
=
constructUnpackedApkInternal
();
if
(
apkFile
==
null
)
{
return
;
}
unpackEvent
.
onFinish
(
apkFile
);
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG_UNPACK
,
"unpack error"
,
e
);
}
}
}.
start
();
}
/**
* 自动开启脱壳组件
*
...
...
@@ -69,7 +93,7 @@ public class UnPackerToolKit {
if
(
RatelToolKit
.
processName
.
equals
(
RatelToolKit
.
packageName
))
{
RposedHelpers
.
findAndHookMethod
(
Activity
.
class
,
"onResume"
,
new
RC_MethodHook
()
{
@Override
protected
void
afterHookedMethod
(
MethodHookParam
param
)
throws
Throwable
{
protected
void
afterHookedMethod
(
MethodHookParam
param
)
{
RatelToolKit
.
ratelUnpack
.
enableUnPack
(
new
File
(
RatelToolKit
.
sContext
.
getFilesDir
(),
"ratel_unpack"
),
dumpMethod
...
...
@@ -174,4 +198,35 @@ public class UnPackerToolKit {
}
return
target
;
}
/**
* 给定任意class,获取改class的dex数据
*
* @param clazz 任意class
* @return dex内容
*/
public
byte
[]
dumpDex
(
Class
<?>
clazz
)
{
Method
[]
declaredMethods
=
clazz
.
getDeclaredMethods
();
if
(
declaredMethods
.
length
>
0
)
{
return
RatelToolKit
.
ratelUnpack
.
methodDex
(
declaredMethods
[
0
]);
}
Constructor
<?>[]
declaredConstructors
=
clazz
.
getDeclaredConstructors
();
if
(
declaredConstructors
.
length
>
0
)
{
return
RatelToolKit
.
ratelUnpack
.
methodDex
(
declaredConstructors
[
0
]);
}
return
null
;
}
/**
* 根据一个class名称,搜索对应的dex文件
*
* @param className class名称
* @return 存在重复类的情况下,可能有多条;搜索结果为空的情况下,返回空List
*/
public
List
<
byte
[]>
searchDex
(
String
className
)
{
return
RatelToolKit
.
ratelUnpack
.
findDumpedDex
(
className
);
}
}
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