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
6ddb0036
Commit
6ddb0036
authored
Dec 22, 2014
by
YASME-Tim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added style decoding and a first decoding for data type 17.
parent
0f7ca8ce
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
4 deletions
+57
-4
build.gradle
build.gradle
+1
-0
JadxCLI.java
jadx-cli/src/main/java/jadx/cli/JadxCLI.java
+3
-1
BinaryXMLParser.java
...-core/src/main/java/jadx/core/xmlgen/BinaryXMLParser.java
+53
-3
No files found.
build.gradle
View file @
6ddb0036
...
...
@@ -41,6 +41,7 @@ subprojects {
}
dependencies
{
compile
'com.google.android:android:4.1.1.4'
compile
'org.slf4j:slf4j-api:1.7.7'
testCompile
'ch.qos.logback:logback-classic:1.1.2'
...
...
jadx-cli/src/main/java/jadx/cli/JadxCLI.java
View file @
6ddb0036
...
...
@@ -8,15 +8,17 @@ import java.io.File;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
jadx.core.xmlgen.BinaryXMLParser
;
//
import jadx.core.xmlgen.BinaryXMLParser;
public
class
JadxCLI
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
JadxCLI
.
class
);
public
static
void
main
(
String
[]
args
)
throws
JadxException
{
/*
BinaryXMLParser bxp = new BinaryXMLParser(args[0],args[1]);
bxp.parse();
System.exit(4);
*/
try
{
JadxCLIArgs
jadxArgs
=
new
JadxCLIArgs
();
if
(
processArgs
(
jadxArgs
,
args
))
{
...
...
jadx-core/src/main/java/jadx/core/xmlgen/BinaryXMLParser.java
View file @
6ddb0036
...
...
@@ -11,6 +11,14 @@ import java.io.IOException;
import
java.io.UnsupportedEncodingException
;
import
java.io.PrintWriter
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
import
java.util.Map
;
import
android.R.style
;
//import android.content.res.Resources;
public
class
BinaryXMLParser
{
private
byte
[]
bytes
;
private
String
[]
strings
;
...
...
@@ -21,6 +29,7 @@ public class BinaryXMLParser {
private
int
numtabs
=-
1
;
private
boolean
wasOneLiner
=
false
;
PrintWriter
writer
;
Map
<
Integer
,
String
>
styleMap
=
null
;
public
BinaryXMLParser
(
String
xmlfilepath
,
String
xmloutfilepath
)
{
//System.out.println(xmlfilepath);
try
{
...
...
@@ -48,6 +57,16 @@ public class BinaryXMLParser {
}
catch
(
FileNotFoundException
fnfe
)
{
die
(
"FILE NOT FOUND"
);
}
catch
(
IOException
ioe
)
{
die
(
"IOE"
);
}
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
()
{
...
...
@@ -182,7 +201,7 @@ public class BinaryXMLParser {
int
classIndex
=
cInt16
(
bytes
,
count
);
//System.out.println("startNS: classIndex: " + classIndex);
int
styleIndex
=
cInt16
(
bytes
,
count
);
//
System.out.println("startNS: styleIndex: " + styleIndex);
if
(
styleIndex
!=
0
)
System
.
out
.
println
(
"startNS: styleIndex: "
+
styleIndex
);
if
(
"manifest"
.
equals
(
strings
[
startNSName
]))
writer
.
print
(
" xmlns:\""
+
nsURI
+
"\""
);
if
(
attributeCount
>
0
)
writer
.
print
(
" "
);
for
(
int
i
=
0
;
i
<
attributeCount
;
i
++)
{
...
...
@@ -213,8 +232,39 @@ public class BinaryXMLParser {
if
(
attrValData
==
0
)
writer
.
print
(
"false"
);
else
if
(
attrValData
==
1
||
attrValData
==-
1
)
writer
.
print
(
"true"
);
else
writer
.
print
(
"UNKNOWN_BOOLEAN_TYPE"
);
}
else
if
(
attrValDataType
==
0x1
)
writer
.
print
(
"0x"
+
Integer
.
toHexString
(
attrValData
));
else
writer
.
print
(
"UNKNOWN_DATA_TYPE_"
+
attrValDataType
);
}
else
if
(
attrValDataType
==
0x1
)
{
if
(
attrValData
<
0x7f000000
)
{
//System.out.println("0x"+Integer.toHexString(attrValData));
//System.out.println(styleMap.get(attrValData));
//System.out.println(android.R.style.class);
writer
.
print
(
"@*"
);
if
(
attributeNS
!=
-
1
)
writer
.
print
(
nsPrefix
+
":"
);
writer
.
print
(
"style/"
+
styleMap
.
get
(
attrValData
).
replaceAll
(
"_"
,
"."
));
}
else
{
writer
.
print
(
"0x"
+
Integer
.
toHexString
(
attrValData
));
}
}
else
{
/*
//System.out.println("ai["+i+"] ns: " + attributeNS);
//if(attributeNS!=-1) System.out.println("ai["+i+"] Sns: " + strings[attributeNS]);
//System.out.println("ai["+i+"] name: " + attributeName);
if(attributeName!=-1) System.out.println("ai["+i+"] Sns: " + strings[attributeName]);
System.out.println("ai["+i+"] rawval: " + attributeRawValue);
if(attributeRawValue!=-1) System.out.println("ai["+i+"] Sns: " + strings[attributeRawValue]);
System.out.println("ai["+i+"] dt: " + attrValDataType);
System.out.println("ai["+i+"] d: " + attrValData);
*/
if
(
"configChanges"
.
equals
(
strings
[
attributeName
]))
{
if
(
attrValData
==
1152
)
writer
.
print
(
"orientation"
);
else
if
(
attrValData
==
4016
)
writer
.
print
(
"keyboard|keyboardHidden|orientation|screenLayout|uiMode"
);
else
if
(
attrValData
==
176
)
writer
.
print
(
"keyboard|keyboardHidden|orientation"
);
else
if
(
attrValData
==
160
)
writer
.
print
(
"keyboardHidden|orientation"
);
else
writer
.
print
(
"UNKNOWN_DATA_"
+
Integer
.
toHexString
(
attrValData
));
}
else
{
writer
.
print
(
"UNKNOWN_DATA_TYPE_"
+
attrValDataType
);
}
}
writer
.
print
(
"\""
);
if
((
i
+
1
)<
attributeCount
)
writer
.
print
(
" "
);
}
...
...
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