Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Quincy379
jadx
提交
04246443
J
jadx
项目概览
Quincy379
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
04246443
编写于
11月 15, 2015
作者:
S
skylot
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #100 from netmaxt3r/master
multidex support for apk & zip
上级
7be37ff7
cf68e472
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
42 addition
and
7 deletion
+42
-7
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
+6
-1
jadx-core/src/main/java/jadx/core/clsp/ConvertToClsSet.java
jadx-core/src/main/java/jadx/core/clsp/ConvertToClsSet.java
+12
-2
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
+24
-4
未找到文件。
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
浏览文件 @
04246443
...
@@ -116,7 +116,12 @@ public final class JadxDecompiler {
...
@@ -116,7 +116,12 @@ public final class JadxDecompiler {
inputFiles
.
clear
();
inputFiles
.
clear
();
for
(
File
file
:
files
)
{
for
(
File
file
:
files
)
{
try
{
try
{
inputFiles
.
add
(
new
InputFile
(
file
));
InputFile
inputFile
=
new
InputFile
(
file
);
inputFiles
.
add
(
inputFile
);
while
(
inputFile
.
nextDexIndex
!=
-
1
)
{
inputFile
=
new
InputFile
(
file
,
inputFile
.
nextDexIndex
);
inputFiles
.
add
(
inputFile
);
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
JadxException
(
"Error load file: "
+
file
,
e
);
throw
new
JadxException
(
"Error load file: "
+
file
,
e
);
}
}
...
...
jadx-core/src/main/java/jadx/core/clsp/ConvertToClsSet.java
浏览文件 @
04246443
...
@@ -36,7 +36,12 @@ public class ConvertToClsSet {
...
@@ -36,7 +36,12 @@ public class ConvertToClsSet {
if
(
f
.
isDirectory
())
{
if
(
f
.
isDirectory
())
{
addFilesFromDirectory
(
f
,
inputFiles
);
addFilesFromDirectory
(
f
,
inputFiles
);
}
else
{
}
else
{
inputFiles
.
add
(
new
InputFile
(
f
));
InputFile
inputFile
=
new
InputFile
(
f
);
inputFiles
.
add
(
inputFile
);
while
(
inputFile
.
nextDexIndex
!=
-
1
)
{
inputFile
=
new
InputFile
(
f
,
inputFile
.
nextDexIndex
);
inputFiles
.
add
(
inputFile
);
}
}
}
}
}
for
(
InputFile
inputFile
:
inputFiles
)
{
for
(
InputFile
inputFile
:
inputFiles
)
{
...
@@ -67,7 +72,12 @@ public class ConvertToClsSet {
...
@@ -67,7 +72,12 @@ public class ConvertToClsSet {
if
(
fileName
.
endsWith
(
".dex"
)
if
(
fileName
.
endsWith
(
".dex"
)
||
fileName
.
endsWith
(
".jar"
)
||
fileName
.
endsWith
(
".jar"
)
||
fileName
.
endsWith
(
".apk"
))
{
||
fileName
.
endsWith
(
".apk"
))
{
inputFiles
.
add
(
new
InputFile
(
file
));
InputFile
inputFile
=
new
InputFile
(
file
);
inputFiles
.
add
(
inputFile
);
while
(
inputFile
.
nextDexIndex
!=
-
1
)
{
inputFile
=
new
InputFile
(
file
,
inputFile
.
nextDexIndex
);
inputFiles
.
add
(
inputFile
);
}
}
}
}
}
}
}
...
...
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
浏览文件 @
04246443
...
@@ -23,11 +23,18 @@ public class InputFile {
...
@@ -23,11 +23,18 @@ public class InputFile {
private
final
File
file
;
private
final
File
file
;
private
final
Dex
dexBuf
;
private
final
Dex
dexBuf
;
public
int
nextDexIndex
=
-
1
;
private
final
int
dexIndex
;
public
InputFile
(
File
file
)
throws
IOException
,
DecodeException
{
public
InputFile
(
File
file
)
throws
IOException
,
DecodeException
{
this
(
file
,
0
);
}
public
InputFile
(
File
file
,
int
dexIndex
)
throws
IOException
,
DecodeException
{
if
(!
file
.
exists
())
{
if
(!
file
.
exists
())
{
throw
new
IOException
(
"File not found: "
+
file
.
getAbsolutePath
());
throw
new
IOException
(
"File not found: "
+
file
.
getAbsolutePath
());
}
}
this
.
dexIndex
=
dexIndex
;
this
.
file
=
file
;
this
.
file
=
file
;
this
.
dexBuf
=
loadDexBuffer
();
this
.
dexBuf
=
loadDexBuffer
();
}
}
...
@@ -41,7 +48,7 @@ public class InputFile {
...
@@ -41,7 +48,7 @@ public class InputFile {
return
loadFromClassFile
(
file
);
return
loadFromClassFile
(
file
);
}
}
if
(
fileName
.
endsWith
(
".apk"
)
||
fileName
.
endsWith
(
".zip"
))
{
if
(
fileName
.
endsWith
(
".apk"
)
||
fileName
.
endsWith
(
".zip"
))
{
Dex
dex
=
loadFromZip
(
file
);
Dex
dex
=
loadFromZip
(
this
,
file
);
if
(
dex
==
null
)
{
if
(
dex
==
null
)
{
throw
new
IOException
(
"File 'classes.dex' not found in file: "
+
file
);
throw
new
IOException
(
"File 'classes.dex' not found in file: "
+
file
);
}
}
...
@@ -49,7 +56,7 @@ public class InputFile {
...
@@ -49,7 +56,7 @@ public class InputFile {
}
}
if
(
fileName
.
endsWith
(
".jar"
))
{
if
(
fileName
.
endsWith
(
".jar"
))
{
// check if jar contains 'classes.dex'
// check if jar contains 'classes.dex'
Dex
dex
=
loadFromZip
(
file
);
Dex
dex
=
loadFromZip
(
this
,
file
);
if
(
dex
!=
null
)
{
if
(
dex
!=
null
)
{
return
dex
;
return
dex
;
}
}
...
@@ -74,13 +81,26 @@ public class InputFile {
...
@@ -74,13 +81,26 @@ public class InputFile {
}
}
}
}
private
static
Dex
loadFromZip
(
File
file
)
throws
IOException
{
private
static
Dex
loadFromZip
(
InputFile
ipf
,
File
file
)
throws
IOException
{
ZipFile
zf
=
new
ZipFile
(
file
);
ZipFile
zf
=
new
ZipFile
(
file
);
ZipEntry
dex
=
zf
.
getEntry
(
"classes.dex"
);
String
dexName
=
"classes.dex"
;
String
futureDexName
=
"classes2.dex"
;
if
(
ipf
.
dexIndex
!=
0
)
{
dexName
=
"classes"
+
ipf
.
dexIndex
+
".dex"
;
futureDexName
=
"classes"
+
(
ipf
.
dexIndex
+
1
)
+
".dex"
;
}
ZipEntry
dex
=
zf
.
getEntry
(
dexName
);
if
(
dex
==
null
)
{
if
(
dex
==
null
)
{
zf
.
close
();
zf
.
close
();
return
null
;
return
null
;
}
}
try
{
ZipEntry
futureDex
=
zf
.
getEntry
(
futureDexName
);
if
(
futureDex
!=
null
)
{
ipf
.
nextDexIndex
=
ipf
.
dexIndex
==
0
?
2
:
ipf
.
dexIndex
+
1
;
}
}
catch
(
Exception
ex
)
{
}
ByteArrayOutputStream
bytesOut
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
bytesOut
=
new
ByteArrayOutputStream
();
InputStream
in
=
null
;
InputStream
in
=
null
;
try
{
try
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录