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
7abdb41a
Commit
7abdb41a
authored
May 12, 2014
by
skylot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7 from bkerler/master
Add support for dx 1.8 library
parents
4e4b4975
14f6d2f3
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
79 additions
and
58 deletions
+79
-58
build.gradle
jadx-core/build.gradle
+1
-2
dx-1.8.jar
jadx-core/lib/dx-1.8.jar
+0
-0
FieldInfo.java
jadx-core/src/main/java/jadx/core/dex/info/FieldInfo.java
+1
-1
MethodInfo.java
jadx-core/src/main/java/jadx/core/dex/info/MethodInfo.java
+2
-2
InsnDecoder.java
...src/main/java/jadx/core/dex/instructions/InsnDecoder.java
+1
-1
ClassNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
+4
-4
DexNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/DexNode.java
+12
-12
FieldNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/FieldNode.java
+1
-1
MethodNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
+6
-6
AnnotationsParser.java
...in/java/jadx/core/dex/nodes/parser/AnnotationsParser.java
+6
-6
DebugInfoParser.java
...main/java/jadx/core/dex/nodes/parser/DebugInfoParser.java
+2
-2
EncValueParser.java
.../main/java/jadx/core/dex/nodes/parser/EncValueParser.java
+32
-10
StaticValuesParser.java
...n/java/jadx/core/dex/nodes/parser/StaticValuesParser.java
+4
-4
InputFile.java
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
+6
-6
version
version
+1
-1
No files found.
jadx-core/build.gradle
View file @
7abdb41a
ext
.
jadxClasspath
=
'clsp-data/android-4.3.jar'
dependencies
{
compile
'com.google.android.tools:dx:1.7'
compile
files
(
'lib/dx-1.8.jar'
)
runtime
files
(
jadxClasspath
)
}
jadx-core/lib/dx-1.8.jar
0 → 100644
View file @
7abdb41a
File added
jadx-core/src/main/java/jadx/core/dex/info/FieldInfo.java
View file @
7abdb41a
...
...
@@ -3,7 +3,7 @@ package jadx.core.dex.info;
import
jadx.core.dex.instructions.args.ArgType
;
import
jadx.core.dex.nodes.DexNode
;
import
com.android.d
x.io
.FieldId
;
import
com.android.d
ex
.FieldId
;
public
class
FieldInfo
{
...
...
jadx-core/src/main/java/jadx/core/dex/info/MethodInfo.java
View file @
7abdb41a
...
...
@@ -7,8 +7,8 @@ import jadx.core.utils.Utils;
import
java.util.List
;
import
com.android.d
x.io
.MethodId
;
import
com.android.d
x.io
.ProtoId
;
import
com.android.d
ex
.MethodId
;
import
com.android.d
ex
.ProtoId
;
public
final
class
MethodInfo
{
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/InsnDecoder.java
View file @
7abdb41a
...
...
@@ -14,7 +14,7 @@ import jadx.core.utils.exceptions.DecodeException;
import
java.io.EOFException
;
import
com.android.d
x.io
.Code
;
import
com.android.d
ex
.Code
;
import
com.android.dx.io.OpcodeInfo
;
import
com.android.dx.io.Opcodes
;
import
com.android.dx.io.instructions.DecodedInstruction
;
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
View file @
7abdb41a
...
...
@@ -31,10 +31,10 @@ import java.util.Map;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.android.d
x.io
.ClassData
;
import
com.android.d
x.io
.ClassData.Field
;
import
com.android.d
x.io
.ClassData.Method
;
import
com.android.d
x.io
.ClassDef
;
import
com.android.d
ex
.ClassData
;
import
com.android.d
ex
.ClassData.Field
;
import
com.android.d
ex
.ClassData.Method
;
import
com.android.d
ex
.ClassDef
;
public
class
ClassNode
extends
LineAttrNode
implements
ILoadable
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ClassNode
.
class
);
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/DexNode.java
View file @
7abdb41a
...
...
@@ -13,23 +13,23 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
com.android.d
x.io
.ClassData
;
import
com.android.d
x.io
.ClassData.Method
;
import
com.android.d
x.io
.ClassDef
;
import
com.android.d
x.io
.Code
;
import
com.android.d
x.io.DexBuffer
;
import
com.android.d
x.io.DexBuffer.Section
;
import
com.android.d
x.io.Fiel
dId
;
import
com.android.d
x.io.Method
Id
;
import
com.android.d
x.io.ProtoId
;
import
com.android.d
x.merge.TypeList
;
import
com.android.d
ex
.ClassData
;
import
com.android.d
ex
.ClassData.Method
;
import
com.android.d
ex
.ClassDef
;
import
com.android.d
ex
.Code
;
import
com.android.d
ex.Dex
;
import
com.android.d
ex.FieldId
;
import
com.android.d
ex.Metho
dId
;
import
com.android.d
ex.Proto
Id
;
import
com.android.d
ex.TypeList
;
import
com.android.d
ex.TableOfContents
;
public
class
DexNode
{
public
static
final
int
NO_INDEX
=
-
1
;
private
final
RootNode
root
;
private
final
Dex
Buffer
dexBuf
;
private
final
Dex
dexBuf
;
private
final
List
<
ClassNode
>
classes
=
new
ArrayList
<
ClassNode
>();
private
final
String
[]
strings
;
...
...
@@ -116,7 +116,7 @@ public class DexNode {
return
dexBuf
.
readCode
(
mth
);
}
public
Section
openSection
(
int
offset
)
{
public
Dex
.
Section
openSection
(
int
offset
)
{
return
dexBuf
.
open
(
offset
);
}
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/FieldNode.java
View file @
7abdb41a
...
...
@@ -6,7 +6,7 @@ import jadx.core.dex.info.AccessInfo.AFType;
import
jadx.core.dex.info.FieldInfo
;
import
jadx.core.dex.instructions.args.ArgType
;
import
com.android.d
x.io
.ClassData.Field
;
import
com.android.d
ex
.ClassData.Field
;
public
class
FieldNode
extends
LineAttrNode
{
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
View file @
7abdb41a
...
...
@@ -35,10 +35,10 @@ import java.util.Set;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.android.d
x.io
.ClassData.Method
;
import
com.android.d
x.io
.Code
;
import
com.android.d
x.io
.Code.CatchHandler
;
import
com.android.d
x.io
.Code.Try
;
import
com.android.d
ex
.ClassData.Method
;
import
com.android.d
ex
.Code
;
import
com.android.d
ex
.Code.CatchHandler
;
import
com.android.d
ex
.Code.Try
;
public
class
MethodNode
extends
LineAttrNode
implements
ILoadable
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
MethodNode
.
class
);
...
...
@@ -248,7 +248,7 @@ public class MethodNode extends LineAttrNode implements ILoadable {
// but in maven repository still old version
Set
<
Integer
>
handlerSet
=
new
HashSet
<
Integer
>(
tries
.
length
);
for
(
Try
aTry
:
tries
)
{
handlerSet
.
add
(
aTry
.
get
HandlerOffset
());
handlerSet
.
add
(
aTry
.
get
CatchHandlerIndex
());
}
List
<
Integer
>
handlerList
=
new
ArrayList
<
Integer
>(
catchBlocks
.
length
);
handlerList
.
addAll
(
handlerSet
);
...
...
@@ -306,7 +306,7 @@ public class MethodNode extends LineAttrNode implements ILoadable {
// attach TRY_ENTER, TRY_LEAVE attributes to instructions
for
(
Try
aTry
:
tries
)
{
int
catchNum
=
handlerList
.
indexOf
(
aTry
.
get
HandlerOffset
());
int
catchNum
=
handlerList
.
indexOf
(
aTry
.
get
CatchHandlerIndex
());
TryCatchBlock
block
=
catches
.
get
(
catchNum
);
int
offset
=
aTry
.
getStartAddress
();
int
end
=
offset
+
aTry
.
getInstructionCount
()
-
1
;
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/parser/AnnotationsParser.java
View file @
7abdb41a
...
...
@@ -16,7 +16,7 @@ import java.util.LinkedHashMap;
import
java.util.List
;
import
java.util.Map
;
import
com.android.d
x.io.DexBuffer.Section
;
import
com.android.d
ex.Dex
;
public
class
AnnotationsParser
{
...
...
@@ -35,7 +35,7 @@ public class AnnotationsParser {
}
public
void
parse
(
int
offset
)
throws
DecodeException
{
Section
section
=
dex
.
openSection
(
offset
);
Dex
.
Section
section
=
dex
.
openSection
(
offset
);
// TODO read as unsigned int
int
classAnnotationsOffset
=
section
.
readInt
();
...
...
@@ -60,7 +60,7 @@ public class AnnotationsParser {
for
(
int
i
=
0
;
i
<
annotatedParametersCount
;
i
++)
{
MethodNode
mth
=
cls
.
searchMethodById
(
section
.
readInt
());
// read annotation ref list
Section
ss
=
dex
.
openSection
(
section
.
readInt
());
Dex
.
Section
ss
=
dex
.
openSection
(
section
.
readInt
());
int
size
=
ss
.
readInt
();
MethodParameters
params
=
new
MethodParameters
(
size
);
for
(
int
j
=
0
;
j
<
size
;
j
++)
{
...
...
@@ -71,18 +71,18 @@ public class AnnotationsParser {
}
private
AnnotationsList
readAnnotationSet
(
int
offset
)
throws
DecodeException
{
Section
section
=
dex
.
openSection
(
offset
);
Dex
.
Section
section
=
dex
.
openSection
(
offset
);
int
size
=
section
.
readInt
();
List
<
Annotation
>
list
=
new
ArrayList
<
Annotation
>(
size
);
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
Section
anSection
=
dex
.
openSection
(
section
.
readInt
());
Dex
.
Section
anSection
=
dex
.
openSection
(
section
.
readInt
());
Annotation
a
=
readAnnotation
(
dex
,
anSection
,
true
);
list
.
add
(
a
);
}
return
new
AnnotationsList
(
list
);
}
public
static
Annotation
readAnnotation
(
DexNode
dex
,
Section
s
,
boolean
readVisibility
)
throws
DecodeException
{
public
static
Annotation
readAnnotation
(
DexNode
dex
,
Dex
.
Section
s
,
boolean
readVisibility
)
throws
DecodeException
{
EncValueParser
parser
=
new
EncValueParser
(
dex
,
s
);
Visibility
visibility
=
null
;
if
(
readVisibility
)
{
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/parser/DebugInfoParser.java
View file @
7abdb41a
...
...
@@ -10,7 +10,7 @@ import jadx.core.utils.exceptions.DecodeException;
import
java.util.List
;
import
com.android.d
x.io.DexBuffer.Section
;
import
com.android.d
ex.Dex
;
public
class
DebugInfoParser
{
...
...
@@ -33,7 +33,7 @@ public class DebugInfoParser {
private
static
final
int
DBG_LINE_RANGE
=
15
;
private
final
MethodNode
mth
;
private
final
Section
section
;
private
final
Dex
.
Section
section
;
private
final
DexNode
dex
;
private
final
LocalVar
[]
locals
;
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/parser/EncValueParser.java
View file @
7abdb41a
...
...
@@ -8,16 +8,38 @@ import jadx.core.utils.exceptions.DecodeException;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.android.dx.io.DexBuffer.Section
;
import
com.android.dx.io.EncodedValueReader
;
import
com.android.dx.util.Leb128Utils
;
public
class
EncValueParser
extends
EncodedValueReader
{
import
com.android.dex.Dex
;
import
com.android.dex.EncodedValue
;
import
com.android.dex.EncodedValueReader
;
import
com.android.dex.Leb128
;
import
com.android.dex.util.ByteInput
;
public
class
EncValueParser
{
public
static
final
int
ENCODED_BYTE
=
0x00
;
public
static
final
int
ENCODED_SHORT
=
0x02
;
public
static
final
int
ENCODED_CHAR
=
0x03
;
public
static
final
int
ENCODED_INT
=
0x04
;
public
static
final
int
ENCODED_LONG
=
0x06
;
public
static
final
int
ENCODED_FLOAT
=
0x10
;
public
static
final
int
ENCODED_DOUBLE
=
0x11
;
public
static
final
int
ENCODED_STRING
=
0x17
;
public
static
final
int
ENCODED_TYPE
=
0x18
;
public
static
final
int
ENCODED_FIELD
=
0x19
;
public
static
final
int
ENCODED_ENUM
=
0x1b
;
public
static
final
int
ENCODED_METHOD
=
0x1a
;
public
static
final
int
ENCODED_ARRAY
=
0x1c
;
public
static
final
int
ENCODED_ANNOTATION
=
0x1d
;
public
static
final
int
ENCODED_NULL
=
0x1e
;
public
static
final
int
ENCODED_BOOLEAN
=
0x1f
;
protected
final
Dex
.
Section
in
;
private
final
DexNode
dex
;
public
EncValueParser
(
DexNode
dex
,
Section
in
)
{
super
(
in
);
public
EncValueParser
(
DexNode
dex
,
Dex
.
Section
in
)
{
//super(in);
this
.
in
=
in
;
this
.
dex
=
dex
;
}
...
...
@@ -64,7 +86,7 @@ public class EncValueParser extends EncodedValueReader {
return
FieldInfo
.
fromDex
(
dex
,
parseUnsignedInt
(
size
));
case
ENCODED_ARRAY:
int
count
=
Leb128
Utils
.
readUnsignedLeb128
(
in
);
int
count
=
Leb128
.
readUnsignedLeb128
(
in
);
List
<
Object
>
values
=
new
ArrayList
<
Object
>(
count
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
values
.
add
(
parseValue
());
...
...
@@ -72,7 +94,7 @@ public class EncValueParser extends EncodedValueReader {
return
values
;
case
ENCODED_ANNOTATION:
return
AnnotationsParser
.
readAnnotation
(
dex
,
(
Section
)
in
,
false
);
return
AnnotationsParser
.
readAnnotation
(
dex
,
(
Dex
.
Section
)
in
,
false
);
}
throw
new
DecodeException
(
"Unknown encoded value type: 0x"
+
Integer
.
toHexString
(
type
));
}
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/parser/StaticValuesParser.java
View file @
7abdb41a
...
...
@@ -6,17 +6,17 @@ import jadx.core.utils.exceptions.DecodeException;
import
java.util.List
;
import
com.android.d
x.io.DexBuffer.Section
;
import
com.android.d
x.util.Leb128Utils
;
import
com.android.d
ex.Dex
;
import
com.android.d
ex.Leb128
;
public
class
StaticValuesParser
extends
EncValueParser
{
public
StaticValuesParser
(
DexNode
dex
,
Section
in
)
{
public
StaticValuesParser
(
DexNode
dex
,
Dex
.
Section
in
)
{
super
(
dex
,
in
);
}
public
int
processFields
(
List
<
FieldNode
>
fields
)
throws
DecodeException
{
int
count
=
Leb128
Utils
.
readUnsignedLeb128
(
in
);
int
count
=
Leb128
.
readUnsignedLeb128
(
in
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
Object
value
=
parseValue
();
fields
.
get
(
i
).
getAttributes
().
add
(
new
FieldValueAttr
(
value
));
...
...
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
View file @
7abdb41a
...
...
@@ -13,13 +13,13 @@ import java.util.zip.ZipFile;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.android.d
x.io.DexBuffer
;
import
com.android.d
ex.Dex
;
public
class
InputFile
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
InputFile
.
class
);
private
final
File
file
;
private
final
Dex
Buffer
dexBuf
;
private
final
Dex
dexBuf
;
public
InputFile
(
File
file
)
throws
IOException
,
DecodeException
{
this
.
file
=
file
;
...
...
@@ -29,9 +29,9 @@ public class InputFile {
String
fileName
=
file
.
getName
();
if
(
fileName
.
endsWith
(
".dex"
))
{
this
.
dexBuf
=
new
Dex
Buffer
(
file
);
this
.
dexBuf
=
new
Dex
(
file
);
}
else
if
(
fileName
.
endsWith
(
".apk"
))
{
this
.
dexBuf
=
new
Dex
Buffer
(
openDexFromApk
(
file
));
this
.
dexBuf
=
new
Dex
(
openDexFromApk
(
file
));
}
else
if
(
fileName
.
endsWith
(
".class"
)
||
fileName
.
endsWith
(
".jar"
))
{
try
{
LOG
.
info
(
"converting to dex: {} ..."
,
fileName
);
...
...
@@ -43,7 +43,7 @@ public class InputFile {
}
else
if
(
j2d
.
isError
())
{
LOG
.
warn
(
"dx message: "
+
j2d
.
getDxErrors
());
}
this
.
dexBuf
=
new
Dex
Buffer
(
ba
);
this
.
dexBuf
=
new
Dex
(
ba
);
}
catch
(
Throwable
e
)
{
throw
new
DecodeException
(
"java class to dex conversion error:\n "
+
e
.
getMessage
(),
e
);
...
...
@@ -76,7 +76,7 @@ public class InputFile {
return
file
;
}
public
Dex
Buffer
getDexBuffer
()
{
public
Dex
getDexBuffer
()
{
return
dexBuf
;
}
...
...
version
View file @
7abdb41a
0.5.
0
0.5.
1
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