Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
极致猎手
jadx
提交
cab3f5da
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,发现更多精彩内容 >>
提交
cab3f5da
编写于
4月 25, 2019
作者:
A
Ahmed Ashour
提交者:
skylot
4月 25, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: always use FileUtils.createTempFile (PR #634)
上级
77cee15d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
26 deletion
+13
-26
jadx-core/src/main/java/jadx/core/clsp/ClsSet.java
jadx-core/src/main/java/jadx/core/clsp/ClsSet.java
+1
-3
jadx-core/src/main/java/jadx/core/utils/files/FileUtils.java
jadx-core/src/main/java/jadx/core/utils/files/FileUtils.java
+4
-15
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
+7
-7
jadx-core/src/test/java/jadx/api/JadxArgsValidatorOutDirsTest.java
.../src/test/java/jadx/api/JadxArgsValidatorOutDirsTest.java
+1
-1
未找到文件。
jadx-core/src/main/java/jadx/core/clsp/ClsSet.java
浏览文件 @
cab3f5da
...
...
@@ -168,7 +168,7 @@ public class ClsSet {
save
(
outputStream
);
}
}
else
if
(
outputName
.
endsWith
(
".jar"
))
{
Path
temp
=
File
s
.
createTempFile
(
"jadx"
,
".zip"
);
Path
temp
=
File
Utils
.
createTempFile
(
".zip"
);
Files
.
copy
(
path
,
temp
,
StandardCopyOption
.
REPLACE_EXISTING
);
try
(
ZipOutputStream
out
=
new
ZipOutputStream
(
Files
.
newOutputStream
(
path
));
...
...
@@ -185,8 +185,6 @@ public class ClsSet {
entry
=
in
.
getNextEntry
();
}
}
Files
.
delete
(
temp
);
}
else
{
throw
new
JadxRuntimeException
(
"Unknown file format: "
+
outputName
);
}
...
...
jadx-core/src/main/java/jadx/core/utils/files/FileUtils.java
浏览文件 @
cab3f5da
...
...
@@ -65,24 +65,13 @@ public class FileUtils {
}
}
public
static
File
createTempFile
(
String
suffix
)
{
File
temp
;
public
static
Path
createTempFile
(
String
suffix
)
{
try
{
temp
=
File
.
createTempFile
(
"jadx-tmp-"
,
System
.
nanoTime
()
+
'-'
+
suffix
);
temp
.
deleteOnExit
();
}
catch
(
IOException
e
)
{
throw
new
JadxRuntimeException
(
"Failed to create temp file with suffix: "
+
suffix
);
}
return
temp
;
}
public
static
File
createTempDir
(
String
suffix
)
{
try
{
Path
path
=
Files
.
createTempDirectory
(
"jadx-tmp-"
+
System
.
nanoTime
()
+
'-'
+
suffix
);
Path
path
=
Files
.
createTempFile
(
"jadx-tmp-"
,
suffix
);
path
.
toFile
().
deleteOnExit
();
return
path
.
toFile
()
;
return
path
;
}
catch
(
IOException
e
)
{
throw
new
JadxRuntimeException
(
"Failed to create temp
directory
with suffix: "
+
suffix
);
throw
new
JadxRuntimeException
(
"Failed to create temp
file
with suffix: "
+
suffix
);
}
}
...
...
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
浏览文件 @
cab3f5da
...
...
@@ -4,9 +4,9 @@ import static jadx.core.utils.files.FileUtils.isApkFile;
import
static
jadx
.
core
.
utils
.
files
.
FileUtils
.
isZipDexFile
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.StandardCopyOption
;
...
...
@@ -58,7 +58,7 @@ public class InputFile {
return
;
}
if
(
fileName
.
endsWith
(
".smali"
))
{
Path
output
=
File
s
.
createTempFile
(
"jadx"
,
".dex"
);
Path
output
=
File
Utils
.
createTempFile
(
".dex"
);
SmaliOptions
options
=
new
SmaliOptions
();
options
.
outputDexFile
=
output
.
toAbsolutePath
().
toString
();
Smali
.
assemble
(
options
,
file
.
getAbsolutePath
());
...
...
@@ -134,7 +134,7 @@ public class InputFile {
case
".jar"
:
index
++;
Path
jarFile
=
File
s
.
createTempFile
(
entryName
,
".jar"
);
Path
jarFile
=
File
Utils
.
createTempFile
(
entryName
);
Files
.
copy
(
inputStream
,
jarFile
,
StandardCopyOption
.
REPLACE_EXISTING
);
for
(
Dex
dex
:
loadFromJar
(
jarFile
))
{
addDexFile
(
entryName
,
dex
);
...
...
@@ -145,11 +145,11 @@ public class InputFile {
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"
);
try
(
FileOutputStream
fos
=
new
File
OutputStream
(
jarFile
))
{
Path
jarFile
=
FileUtils
.
createTempFile
(
"instant-run.zip"
);
try
(
OutputStream
fos
=
Files
.
new
OutputStream
(
jarFile
))
{
IOUtils
.
copy
(
inputStream
,
fos
);
}
InputFile
tempFile
=
new
InputFile
(
jarFile
);
InputFile
tempFile
=
new
InputFile
(
jarFile
.
toFile
()
);
tempFile
.
loadFromZip
(
ext
);
List
<
DexFile
>
dexFiles
=
tempFile
.
getDexFiles
();
if
(!
dexFiles
.
isEmpty
())
{
...
...
@@ -196,7 +196,7 @@ public class InputFile {
}
private
static
List
<
Dex
>
loadFromClassFile
(
File
file
)
throws
IOException
,
DecodeException
{
Path
outFile
=
File
s
.
createTempFile
(
"cls"
,
".jar"
);
Path
outFile
=
File
Utils
.
createTempFile
(
".jar"
);
try
(
JarOutputStream
jo
=
new
JarOutputStream
(
Files
.
newOutputStream
(
outFile
)))
{
String
clsName
=
AsmUtils
.
getNameFromClassFile
(
file
);
if
(
clsName
==
null
||
!
ZipSecurity
.
isValidZipEntryName
(
clsName
))
{
...
...
jadx-core/src/test/java/jadx/api/JadxArgsValidatorOutDirsTest.java
浏览文件 @
cab3f5da
...
...
@@ -66,7 +66,7 @@ public class JadxArgsValidatorOutDirsTest {
private
JadxArgs
makeArgs
()
{
JadxArgs
args
=
new
JadxArgs
();
args
.
getInputFiles
().
add
(
FileUtils
.
createTempFile
(
"some.apk"
));
args
.
getInputFiles
().
add
(
FileUtils
.
createTempFile
(
"some.apk"
)
.
toFile
()
);
return
args
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录