Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
极致猎手
jadx
提交
00b48473
J
jadx
项目概览
极致猎手
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
00b48473
编写于
1月 30, 2022
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: add internal option to disable file save
上级
84facb13
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
13 deletion
+25
-13
jadx-core/src/main/java/jadx/api/JadxArgs.java
jadx-core/src/main/java/jadx/api/JadxArgs.java
+13
-0
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
+3
-0
jadx-core/src/main/java/jadx/core/dex/visitors/SaveCode.java
jadx-core/src/main/java/jadx/core/dex/visitors/SaveCode.java
+3
-0
jadx-core/src/test/java/jadx/tests/external/BaseExternalTest.java
...e/src/test/java/jadx/tests/external/BaseExternalTest.java
+6
-13
未找到文件。
jadx-core/src/main/java/jadx/api/JadxArgs.java
浏览文件 @
00b48473
...
...
@@ -93,6 +93,11 @@ public class JadxArgs {
private
UseKotlinMethodsForVarNames
useKotlinMethodsForVarNames
=
UseKotlinMethodsForVarNames
.
APPLY
;
/**
* Don't save files (can be using for performance testing)
*/
private
boolean
skipFilesSave
=
false
;
public
JadxArgs
()
{
// use default options
}
...
...
@@ -447,6 +452,14 @@ public class JadxArgs {
this
.
useKotlinMethodsForVarNames
=
useKotlinMethodsForVarNames
;
}
public
boolean
isSkipFilesSave
()
{
return
skipFilesSave
;
}
public
void
setSkipFilesSave
(
boolean
skipFilesSave
)
{
this
.
skipFilesSave
=
skipFilesSave
;
}
@Override
public
String
toString
()
{
return
"JadxArgs{"
+
"inputFiles="
+
inputFiles
...
...
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
浏览文件 @
00b48473
...
...
@@ -282,6 +282,9 @@ public final class JadxDecompiler implements Closeable {
}
private
void
appendResourcesSaveTasks
(
List
<
Runnable
>
tasks
,
File
outDir
)
{
if
(
args
.
isSkipFilesSave
())
{
return
;
}
Set
<
String
>
inputFileNames
=
args
.
getInputFiles
().
stream
().
map
(
File:
:
getAbsolutePath
).
collect
(
Collectors
.
toSet
());
for
(
ResourceFile
resourceFile
:
getResources
())
{
if
(
resourceFile
.
getType
()
!=
ResourceType
.
ARSC
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/SaveCode.java
浏览文件 @
00b48473
...
...
@@ -34,6 +34,9 @@ public class SaveCode {
if
(
codeStr
.
isEmpty
())
{
return
;
}
if
(
cls
.
root
().
getArgs
().
isSkipFilesSave
())
{
return
;
}
String
fileName
=
cls
.
getClassInfo
().
getAliasFullPath
()
+
getFileExtension
(
cls
);
save
(
codeStr
,
dir
,
fileName
);
}
...
...
jadx-core/src/test/java/jadx/tests/external/BaseExternalTest.java
浏览文件 @
00b48473
...
...
@@ -14,10 +14,10 @@ import jadx.api.ICodeWriter;
import
jadx.api.JadxArgs
;
import
jadx.api.JadxDecompiler
;
import
jadx.api.JadxInternalAccess
;
import
jadx.api.JavaClass
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.core.dex.nodes.MethodNode
;
import
jadx.core.dex.nodes.RootNode
;
import
jadx.core.utils.DebugChecks
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
import
jadx.tests.api.IntegrationTest
;
...
...
@@ -35,9 +35,13 @@ public abstract class BaseExternalTest extends IntegrationTest {
}
protected
JadxArgs
prepare
(
File
input
)
{
DebugChecks
.
checksEnabled
=
false
;
JadxArgs
args
=
new
JadxArgs
();
args
.
getInputFiles
().
add
(
input
);
args
.
setOutDir
(
new
File
(
"../jadx-external-tests-tmp"
));
args
.
setSkipFilesSave
(
true
);
args
.
setSkipResources
(
true
);
args
.
setShowInconsistentCode
(
true
);
return
args
;
}
...
...
@@ -54,8 +58,7 @@ public abstract class BaseExternalTest extends IntegrationTest {
jadx
.
load
();
if
(
clsPatternStr
==
null
)
{
processAll
(
jadx
);
// jadx.saveSources();
jadx
.
save
();
}
else
{
processByPatterns
(
jadx
,
clsPatternStr
,
mthPatternStr
);
}
...
...
@@ -63,16 +66,6 @@ public abstract class BaseExternalTest extends IntegrationTest {
return
jadx
;
}
private
void
processAll
(
JadxDecompiler
jadx
)
{
for
(
JavaClass
javaClass
:
jadx
.
getClasses
())
{
try
{
javaClass
.
decompile
();
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Failed to decompile class: {}"
,
javaClass
,
e
);
}
}
}
private
void
processByPatterns
(
JadxDecompiler
jadx
,
String
clsPattern
,
@Nullable
String
mthPattern
)
{
RootNode
root
=
JadxInternalAccess
.
getRoot
(
jadx
);
int
processed
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录