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
aacb8329
Commit
aacb8329
authored
Dec 22, 2014
by
YASME-Tim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added option flag to make androidmanifest.xml decompiling optional.
parent
ddab4c26
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
1 deletion
+70
-1
JadxCLIArgs.java
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
+8
-0
DefaultJadxArgs.java
jadx-core/src/main/java/jadx/api/DefaultJadxArgs.java
+5
-0
IJadxArgs.java
jadx-core/src/main/java/jadx/api/IJadxArgs.java
+2
-0
JadxDecompiler.java
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
+11
-0
InputFile.java
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
+23
-0
BinaryXMLParser.java
...-core/src/main/java/jadx/core/xmlgen/BinaryXMLParser.java
+21
-1
No files found.
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
View file @
aacb8329
...
...
@@ -47,6 +47,9 @@ public final class JadxCLIArgs implements IJadxArgs {
@Parameter
(
names
=
{
"-h"
,
"--help"
},
description
=
"print this help"
,
help
=
true
)
protected
boolean
printHelp
=
false
;
@Parameter
(
names
=
{
"-x"
,
"--xml"
},
description
=
"try to decode the AndroidManifest.xml, save at current dir"
)
protected
boolean
xmlTest
=
false
;
private
final
List
<
File
>
input
=
new
ArrayList
<
File
>(
1
);
private
File
outputDir
;
...
...
@@ -165,6 +168,11 @@ public final class JadxCLIArgs implements IJadxArgs {
}
@Override
public
boolean
isXMLTest
()
{
return
xmlTest
;
}
@Override
public
int
getThreadsCount
()
{
return
threadsCount
;
}
...
...
jadx-core/src/main/java/jadx/api/DefaultJadxArgs.java
View file @
aacb8329
...
...
@@ -38,4 +38,9 @@ public class DefaultJadxArgs implements IJadxArgs {
public
boolean
isVerbose
()
{
return
false
;
}
@Override
public
boolean
isXMLTest
()
{
return
false
;
}
}
jadx-core/src/main/java/jadx/api/IJadxArgs.java
View file @
aacb8329
...
...
@@ -16,4 +16,6 @@ public interface IJadxArgs {
boolean
isShowInconsistentCode
();
boolean
isVerbose
();
boolean
isXMLTest
();
}
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
View file @
aacb8329
...
...
@@ -11,6 +11,7 @@ import jadx.core.utils.exceptions.DecodeException;
import
jadx.core.utils.exceptions.JadxException
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
import
jadx.core.utils.files.InputFile
;
import
jadx.core.xmlgen.BinaryXMLParser
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -202,6 +203,16 @@ public final class JadxDecompiler {
reset
();
root
=
new
RootNode
();
LOG
.
info
(
"loading ..."
);
if
(
this
.
args
.
isXMLTest
())
{
InputFile
inf
=
inputFiles
.
get
(
0
);
try
{
BinaryXMLParser
bxp
=
new
BinaryXMLParser
(
InputFile
.
loadXMLBuffer
(
inf
.
getFile
()),
"./AndroidManifest.xml"
);
//BinaryXMLParser bxp = new BinaryXMLParser(InputFile.loadXMLBuffer(inf.getFile()), "AndroidManifest.xml");
bxp
.
parse
();
}
catch
(
IOException
ioe
)
{
LOG
.
info
(
"Decompiling AndroidManifest.xml failed!"
);
}
}
root
.
load
(
inputFiles
);
}
...
...
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
View file @
aacb8329
...
...
@@ -74,6 +74,29 @@ public class InputFile {
}
}
public
static
byte
[]
loadXMLBuffer
(
File
file
)
throws
IOException
{
// FIXME: Public.. Please fix
ZipFile
zf
=
new
ZipFile
(
file
);
ZipEntry
xml
=
zf
.
getEntry
(
"AndroidManifest.xml"
);
if
(
null
==
xml
)
{
zf
.
close
();
return
null
;
}
ByteArrayOutputStream
bytesOut
=
new
ByteArrayOutputStream
();
InputStream
in
=
null
;
try
{
in
=
zf
.
getInputStream
(
xml
);
byte
[]
buffer
=
new
byte
[(
int
)
xml
.
getSize
()];
// FIXME: long->int conversion loss
int
count
;
while
((
count
=
in
.
read
(
buffer
))
!=
-
1
)
{
bytesOut
.
write
(
buffer
,
0
,
count
);
}
}
finally
{
if
(
null
!=
in
)
in
.
close
();
zf
.
close
();
}
return
bytesOut
.
toByteArray
();
}
private
static
Dex
loadFromZip
(
File
file
)
throws
IOException
{
ZipFile
zf
=
new
ZipFile
(
file
);
ZipEntry
dex
=
zf
.
getEntry
(
"classes.dex"
);
...
...
jadx-core/src/main/java/jadx/core/xmlgen/BinaryXMLParser.java
View file @
aacb8329
...
...
@@ -76,7 +76,27 @@ public class BinaryXMLParser {
die
(
"IAE"
);
}
}
}
public
BinaryXMLParser
(
byte
[]
xmlfilebytes
,
String
xmloutfilepath
)
{
System
.
out
.
println
(
"XMLOUTFILEPATH: "
+
xmloutfilepath
);
try
{
writer
=
new
PrintWriter
(
xmloutfilepath
,
"UTF-8"
);
}
catch
(
FileNotFoundException
fnfe
)
{
die
(
"FNFE"
);
}
catch
(
UnsupportedEncodingException
uee
)
{
die
(
"UEE"
);
}
if
(
null
==
writer
)
die
(
"null==writer"
);
writer
.
println
(
"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
);
bytes
=
xmlfilebytes
;
count
=
0
;
styleMap
=
new
HashMap
<
Integer
,
String
>();
if
(
null
==
styleMap
)
die
(
"null==styleMap"
);
for
(
Field
f
:
android
.
R
.
style
.
class
.
getFields
())
{
try
{
styleMap
.
put
(
f
.
getInt
(
f
.
getType
()),
f
.
getName
());
}
catch
(
IllegalAccessException
iae
)
{
die
(
"IAE"
);
}
}
}
public
void
parse
()
{
...
...
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