Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Quincy379
jadx
提交
c9b781d5
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,发现更多精彩内容 >>
未验证
提交
c9b781d5
编写于
1月 02, 2018
作者:
S
skylot
提交者:
GitHub
1月 02, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #119 from ITMonkeys/master
support for Android InstantRun Apk
上级
0b49abf3
e53a72c5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
35 addition
and
17 deletion
+35
-17
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
+35
-17
未找到文件。
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
浏览文件 @
c9b781d5
...
...
@@ -10,6 +10,7 @@ import java.io.FileOutputStream;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.Enumeration
;
import
java.util.List
;
import
java.util.jar.JarOutputStream
;
import
java.util.zip.ZipEntry
;
...
...
@@ -84,36 +85,53 @@ public class InputFile {
private
boolean
loadFromZip
(
String
ext
)
throws
IOException
,
DecodeException
{
ZipFile
zf
=
new
ZipFile
(
file
);
// Input file could be .apk or .zip files
// we should consider the input file could contain only one single dex, multi-dex, or instantRun support dex for Android .apk files
String
instantRunDexSuffix
=
"classes"
+
ext
;
int
index
=
0
;
while
(
true
)
{
String
entryName
=
"classes"
+
(
index
==
0
?
""
:
index
)
+
ext
;
ZipEntry
entry
=
zf
.
getEntry
(
entryName
);
if
(
entry
==
null
)
{
break
;
}
for
(
Enumeration
<?
extends
ZipEntry
>
e
=
zf
.
entries
();
e
.
hasMoreElements
();
)
{
ZipEntry
entry
=
e
.
nextElement
();
String
entryName
=
entry
.
getName
();
InputStream
inputStream
=
zf
.
getInputStream
(
entry
);
try
{
if
(
ext
.
equals
(
".dex"
))
{
addDexFile
(
entryName
,
new
Dex
(
inputStream
));
}
else
if
(
ext
.
equals
(
".jar"
))
{
File
jarFile
=
FileUtils
.
createTempFile
(
entryName
);
if
((
entryName
.
startsWith
(
"classes"
)
&&
entryName
.
endsWith
(
ext
))
||
entryName
.
endsWith
(
instantRunDexSuffix
))
{
if
(
ext
.
equals
(
".dex"
))
{
index
++;
addDexFile
(
entryName
,
new
Dex
(
inputStream
));
}
else
if
(
ext
.
equals
(
".jar"
))
{
index
++;
File
jarFile
=
FileUtils
.
createTempFile
(
entryName
);
FileOutputStream
fos
=
new
FileOutputStream
(
jarFile
);
try
{
IOUtils
.
copy
(
inputStream
,
fos
);
}
finally
{
close
(
fos
);
}
addDexFile
(
entryName
,
loadFromJar
(
jarFile
));
}
else
{
throw
new
JadxRuntimeException
(
"Unexpected extension in zip: "
+
ext
);
}
}
else
if
(
entryName
.
equals
(
"instant-run.zip"
)
&&
ext
.
equals
(
".dex"
))
{
File
jarFile
=
FileUtils
.
createTempFile
(
"instant-run.zip"
);
FileOutputStream
fos
=
new
FileOutputStream
(
jarFile
);
try
{
IOUtils
.
copy
(
inputStream
,
fos
);
}
finally
{
close
(
fos
);
}
addDexFile
(
entryName
,
loadFromJar
(
jarFile
));
}
else
{
throw
new
JadxRuntimeException
(
"Unexpected extension in zip: "
+
ext
);
InputFile
tempFile
=
new
InputFile
(
jarFile
);
tempFile
.
loadFromZip
(
ext
);
List
<
DexFile
>
dexFiles
=
tempFile
.
getDexFiles
();
if
(!
dexFiles
.
isEmpty
())
{
index
+=
dexFiles
.
size
();
this
.
dexFiles
.
addAll
(
dexFiles
);
}
}
}
finally
{
close
(
inputStream
);
}
index
++;
if
(
index
==
1
)
{
index
=
2
;
}
}
zf
.
close
();
return
index
>
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录