Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colcode
jadx
提交
cc2ae80e
J
jadx
项目概览
colcode
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cc2ae80e
编写于
1月 15, 2018
作者:
U
unknown
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Issue #204
上级
b921f609
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
92 addition
and
9 deletion
+92
-9
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
+31
-0
jadx-core/src/main/java/jadx/api/IJadxArgs.java
jadx-core/src/main/java/jadx/api/IJadxArgs.java
+4
-0
jadx-core/src/main/java/jadx/api/JadxArgs.java
jadx-core/src/main/java/jadx/api/JadxArgs.java
+20
-0
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
+35
-8
jadx-core/src/test/java/jadx/tests/api/IntegrationTest.java
jadx-core/src/test/java/jadx/tests/api/IntegrationTest.java
+2
-1
未找到文件。
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
浏览文件 @
cc2ae80e
...
...
@@ -32,6 +32,12 @@ public class JadxCLIArgs implements IJadxArgs {
@Parameter
(
names
=
{
"-d"
,
"--output-dir"
},
description
=
"output directory"
)
protected
String
outDirName
;
@Parameter
(
names
=
{
"-ds"
,
"--output-dir-src"
},
description
=
"output directory for sources"
)
protected
String
outDirNameSrc
;
@Parameter
(
names
=
{
"-dr"
,
"--output-dir-res"
},
description
=
"output directory for resources"
)
protected
String
outDirNameRes
;
@Parameter
(
names
=
{
"-j"
,
"--threads-count"
},
description
=
"processing threads count"
)
protected
int
threadsCount
=
DEFAULT_THREADS_COUNT
;
...
...
@@ -90,6 +96,8 @@ public class JadxCLIArgs implements IJadxArgs {
private
final
List
<
File
>
input
=
new
ArrayList
<>(
1
);
private
File
outputDir
;
private
File
outputDirSrc
;
private
File
outputDirRes
;
public
boolean
processArgs
(
String
[]
args
)
{
return
parse
(
args
)
&&
process
();
...
...
@@ -128,9 +136,22 @@ public class JadxCLIArgs implements IJadxArgs {
if
(
input
.
size
()
>
1
)
{
throw
new
JadxException
(
"Only one input file is supported"
);
}
if
(
outDirNameSrc
!=
null
)
{
outputDirSrc
=
new
File
(
outDirNameSrc
);
}
if
(
outDirNameRes
!=
null
)
{
outputDirRes
=
new
File
(
outDirNameRes
);
}
if
(
outDirName
!=
null
)
{
outputDir
=
new
File
(
outDirName
);
if
(
outputDirSrc
==
null
)
{
outputDirSrc
=
new
File
(
outputDir
,
"source"
);
}
if
(
outputDirRes
==
null
)
{
outputDirRes
=
new
File
(
outputDir
,
"res"
);
}
}
if
(
isVerbose
())
{
ch
.
qos
.
logback
.
classic
.
Logger
rootLogger
=
(
ch
.
qos
.
logback
.
classic
.
Logger
)
LoggerFactory
.
getLogger
(
Logger
.
ROOT_LOGGER_NAME
);
...
...
@@ -207,6 +228,16 @@ public class JadxCLIArgs implements IJadxArgs {
return
outputDir
;
}
@Override
public
File
getOutDirSrc
()
{
return
outputDirSrc
;
}
@Override
public
File
getOutDirRes
()
{
return
outputDirRes
;
}
public
void
setOutputDir
(
File
outputDir
)
{
this
.
outputDir
=
outputDir
;
}
...
...
jadx-core/src/main/java/jadx/api/IJadxArgs.java
浏览文件 @
cc2ae80e
...
...
@@ -5,6 +5,10 @@ import java.io.File;
public
interface
IJadxArgs
{
File
getOutDir
();
File
getOutDirSrc
();
File
getOutDirRes
();
int
getThreadsCount
();
boolean
isCFGOutput
();
...
...
jadx-core/src/main/java/jadx/api/JadxArgs.java
浏览文件 @
cc2ae80e
...
...
@@ -5,6 +5,8 @@ import java.io.File;
public
class
JadxArgs
implements
IJadxArgs
{
private
File
outDir
=
new
File
(
"jadx-output"
);
private
File
outDirSrc
=
new
File
(
outDir
,
"source"
);
private
File
outDirRes
=
new
File
(
outDir
,
"res"
);
private
int
threadsCount
=
Math
.
max
(
1
,
Runtime
.
getRuntime
().
availableProcessors
()
-
1
);
private
boolean
cfgOutput
=
false
;
...
...
@@ -39,6 +41,24 @@ public class JadxArgs implements IJadxArgs {
this
.
outDir
=
outDir
;
}
@Override
public
File
getOutDirSrc
()
{
return
outDirSrc
;
}
public
void
setOutDirSrc
(
File
outDirSrc
)
{
this
.
outDirSrc
=
outDirSrc
;
}
@Override
public
File
getOutDirRes
()
{
return
outDirRes
;
}
public
void
setOutDirRes
(
File
outDirRes
)
{
this
.
outDirRes
=
outDirRes
;
}
@Override
public
int
getThreadsCount
()
{
return
threadsCount
;
...
...
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
浏览文件 @
cc2ae80e
...
...
@@ -11,7 +11,6 @@ import jadx.core.dex.nodes.RootNode;
import
jadx.core.dex.visitors.IDexTreeVisitor
;
import
jadx.core.dex.visitors.SaveCode
;
import
jadx.core.export.ExportGradleProject
;
import
jadx.core.utils.exceptions.DecodeException
;
import
jadx.core.utils.exceptions.JadxException
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
import
jadx.core.utils.files.InputFile
;
...
...
@@ -57,6 +56,8 @@ public final class JadxDecompiler {
private
final
List
<
InputFile
>
inputFiles
=
new
ArrayList
<>();
private
File
outDir
;
private
File
outDirRes
;
private
File
outDirSrc
;
private
RootNode
root
;
private
List
<
IDexTreeVisitor
>
passes
;
...
...
@@ -71,26 +72,52 @@ public final class JadxDecompiler {
private
Map
<
MethodNode
,
JavaMethod
>
methodsMap
=
new
ConcurrentHashMap
<>();
private
Map
<
FieldNode
,
JavaField
>
fieldsMap
=
new
ConcurrentHashMap
<>();
public
JadxDecompiler
()
{
public
JadxDecompiler
()
throws
JadxException
{
this
(
new
JadxArgs
());
}
public
JadxDecompiler
(
IJadxArgs
jadxArgs
)
{
public
JadxDecompiler
(
IJadxArgs
jadxArgs
)
throws
JadxException
{
this
.
args
=
jadxArgs
;
this
.
outDir
=
jadxArgs
.
getOutDir
();
this
.
outDirSrc
=
jadxArgs
.
getOutDirSrc
();
this
.
outDirRes
=
jadxArgs
.
getOutDirRes
();
reset
();
init
();
}
public
void
setOutputDir
(
File
outDir
)
{
public
void
setOutputDir
(
File
outDir
)
throws
JadxException
{
this
.
outDir
=
outDir
;
init
();
}
void
init
()
{
public
void
setOutputDirSrc
(
File
outDirSrc
)
throws
JadxException
{
this
.
outDirSrc
=
outDirSrc
;
init
();
}
public
void
setOutputDirRes
(
File
outDirRes
)
throws
JadxException
{
this
.
outDirRes
=
outDirRes
;
init
();
}
void
init
()
throws
JadxException
{
if
(
outDir
==
null
&&
outDirSrc
==
null
)
{
outDirSrc
=
new
JadxArgs
().
getOutDirSrc
();
}
if
(
outDir
==
null
&&
outDirRes
==
null
)
{
outDirRes
=
new
JadxArgs
().
getOutDirRes
();
}
if
(
outDir
==
null
)
{
outDir
=
new
JadxArgs
().
getOutDir
();
}
else
{
if
(
outDirSrc
==
null
&&
outDirRes
!=
null
&&
!
args
.
isSkipSources
())
{
throw
new
JadxException
(
"--output-dir-src must be specified"
);
}
if
(
outDirSrc
!=
null
&&
outDirRes
==
null
&&
!
args
.
isSkipResources
())
{
throw
new
JadxException
(
"--output-dir-res must be specified"
);
}
}
this
.
passes
=
Jadx
.
getPassesList
(
args
,
outDir
);
this
.
codeGen
=
new
CodeGen
(
args
);
}
...
...
@@ -172,8 +199,8 @@ public final class JadxDecompiler {
sourcesOutDir
=
export
.
getSrcOutDir
();
resOutDir
=
export
.
getResOutDir
();
}
else
{
sourcesOutDir
=
outDir
;
resOutDir
=
outDir
;
sourcesOutDir
=
outDir
Src
;
resOutDir
=
outDir
Res
;
}
if
(
saveSources
)
{
appendSourcesSave
(
executor
,
sourcesOutDir
);
...
...
@@ -267,7 +294,7 @@ public final class JadxDecompiler {
root
.
getErrorsCounter
().
printReport
();
}
void
parse
()
throws
Decode
Exception
{
void
parse
()
throws
Jadx
Exception
{
reset
();
init
();
...
...
jadx-core/src/test/java/jadx/tests/api/IntegrationTest.java
浏览文件 @
cc2ae80e
...
...
@@ -83,8 +83,9 @@ public abstract class IntegrationTest extends TestUtils {
}
public
ClassNode
getClassNodeFromFile
(
File
file
,
String
clsName
)
{
JadxDecompiler
d
=
n
ew
JadxDecompiler
(
args
)
;
JadxDecompiler
d
=
n
ull
;
try
{
d
=
new
JadxDecompiler
(
args
);
d
.
loadFile
(
file
);
}
catch
(
JadxException
e
)
{
e
.
printStackTrace
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录