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
cf68e472
Commit
cf68e472
authored
Nov 11, 2015
by
Nizam Moidu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
multidex support for apk & zip
parent
7be37ff7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
7 deletions
+42
-7
JadxDecompiler.java
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
+6
-1
ConvertToClsSet.java
jadx-core/src/main/java/jadx/core/clsp/ConvertToClsSet.java
+12
-2
InputFile.java
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
+24
-4
No files found.
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
View file @
cf68e472
...
...
@@ -116,7 +116,12 @@ public final class JadxDecompiler {
inputFiles
.
clear
();
for
(
File
file
:
files
)
{
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
)
{
throw
new
JadxException
(
"Error load file: "
+
file
,
e
);
}
...
...
jadx-core/src/main/java/jadx/core/clsp/ConvertToClsSet.java
View file @
cf68e472
...
...
@@ -36,7 +36,12 @@ public class ConvertToClsSet {
if
(
f
.
isDirectory
())
{
addFilesFromDirectory
(
f
,
inputFiles
);
}
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
)
{
...
...
@@ -67,7 +72,12 @@ public class ConvertToClsSet {
if
(
fileName
.
endsWith
(
".dex"
)
||
fileName
.
endsWith
(
".jar"
)
||
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
View file @
cf68e472
...
...
@@ -23,11 +23,18 @@ public class InputFile {
private
final
File
file
;
private
final
Dex
dexBuf
;
public
int
nextDexIndex
=
-
1
;
private
final
int
dexIndex
;
public
InputFile
(
File
file
)
throws
IOException
,
DecodeException
{
this
(
file
,
0
);
}
public
InputFile
(
File
file
,
int
dexIndex
)
throws
IOException
,
DecodeException
{
if
(!
file
.
exists
())
{
throw
new
IOException
(
"File not found: "
+
file
.
getAbsolutePath
());
}
this
.
dexIndex
=
dexIndex
;
this
.
file
=
file
;
this
.
dexBuf
=
loadDexBuffer
();
}
...
...
@@ -41,7 +48,7 @@ public class InputFile {
return
loadFromClassFile
(
file
);
}
if
(
fileName
.
endsWith
(
".apk"
)
||
fileName
.
endsWith
(
".zip"
))
{
Dex
dex
=
loadFromZip
(
file
);
Dex
dex
=
loadFromZip
(
this
,
file
);
if
(
dex
==
null
)
{
throw
new
IOException
(
"File 'classes.dex' not found in file: "
+
file
);
}
...
...
@@ -49,7 +56,7 @@ public class InputFile {
}
if
(
fileName
.
endsWith
(
".jar"
))
{
// check if jar contains 'classes.dex'
Dex
dex
=
loadFromZip
(
file
);
Dex
dex
=
loadFromZip
(
this
,
file
);
if
(
dex
!=
null
)
{
return
dex
;
}
...
...
@@ -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
);
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
)
{
zf
.
close
();
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
();
InputStream
in
=
null
;
try
{
...
...
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