Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
fe03c85b
Commit
fe03c85b
authored
Nov 08, 2016
by
chenzhong.cz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure a zip file by file content.
parent
c3386520
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
11 deletions
+30
-11
FileUtils.java
jadx-core/src/main/java/jadx/core/utils/files/FileUtils.java
+20
-0
InputFile.java
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
+10
-11
No files found.
jadx-core/src/main/java/jadx/core/utils/files/FileUtils.java
View file @
fe03c85b
...
...
@@ -11,6 +11,8 @@ import java.io.InputStream;
import
java.io.OutputStream
;
import
java.util.jar.JarEntry
;
import
java.util.jar.JarOutputStream
;
import
java.util.zip.ZipException
;
import
java.util.zip.ZipFile
;
import
org.jetbrains.annotations.NotNull
;
import
org.slf4j.Logger
;
...
...
@@ -100,4 +102,22 @@ public class FileUtils {
makeDirsForFile
(
file
);
return
file
;
}
public
static
boolean
isZipFile
(
final
File
file
)
throws
IOException
{
ZipFile
zipFile
=
null
;
try
{
zipFile
=
new
ZipFile
(
file
);
return
zipFile
.
entries
().
hasMoreElements
();
}
catch
(
ZipException
e
)
{
return
false
;
}
finally
{
if
(
zipFile
!=
null
)
{
try
{
zipFile
.
close
();
}
catch
(
IOException
e
)
{
LOG
.
error
(
e
.
getMessage
());
}
}
}
}
}
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
View file @
fe03c85b
...
...
@@ -52,20 +52,19 @@ public class InputFile {
addDexFile
(
loadFromClassFile
(
file
));
return
;
}
if
(
fileName
.
endsWith
(
".apk"
)
||
fileName
.
endsWith
(
".zip"
))
{
loadFromZip
(
".dex"
);
return
;
}
if
(
fileName
.
endsWith
(
".jar"
))
{
// check if jar contains '.dex' files
if
(
FileUtils
.
isZipFile
(
file
))
{
// check if zip contains '.dex' files
if
(
loadFromZip
(
".dex"
))
{
return
;
}
addDexFile
(
loadFromJar
(
file
));
return
;
}
if
(
fileName
.
endsWith
(
".aar"
))
{
loadFromZip
(
".jar"
);
if
(
fileName
.
endsWith
(
".jar"
))
{
addDexFile
(
loadFromJar
(
file
));
return
;
}
if
(
fileName
.
endsWith
(
".aar"
))
{
loadFromZip
(
".jar"
);
return
;
}
return
;
}
//throw new DecodeException("Unsupported input file format: " + file);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment