Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_76393173
jadx
提交
ab593e3c
J
jadx
项目概览
2301_76393173
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ab593e3c
编写于
1月 03, 2014
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor some classes
上级
4a0aacf1
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
69 addition
and
58 deletion
+69
-58
jadx-core/src/main/java/jadx/core/dex/attributes/AttributesList.java
...rc/main/java/jadx/core/dex/attributes/AttributesList.java
+2
-1
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
+52
-39
jadx-core/src/main/java/jadx/core/dex/nodes/InsnContainer.java
...core/src/main/java/jadx/core/dex/nodes/InsnContainer.java
+1
-1
jadx-core/src/main/java/jadx/core/dex/nodes/parser/StaticValuesParser.java
...n/java/jadx/core/dex/nodes/parser/StaticValuesParser.java
+4
-5
jadx-core/src/main/java/jadx/core/dex/visitors/BlockProcessingHelper.java
...in/java/jadx/core/dex/visitors/BlockProcessingHelper.java
+0
-4
jadx-core/src/main/java/jadx/core/utils/BlockUtils.java
jadx-core/src/main/java/jadx/core/utils/BlockUtils.java
+3
-3
jadx-gui/src/main/java/jadx/gui/MainWindow.java
jadx-gui/src/main/java/jadx/gui/MainWindow.java
+4
-2
jadx-gui/src/main/java/jadx/gui/treemodel/JClass.java
jadx-gui/src/main/java/jadx/gui/treemodel/JClass.java
+1
-1
jadx-gui/src/main/java/jadx/gui/treemodel/JPackage.java
jadx-gui/src/main/java/jadx/gui/treemodel/JPackage.java
+2
-2
未找到文件。
jadx-core/src/main/java/jadx/core/dex/attributes/AttributesList.java
浏览文件 @
ab593e3c
...
...
@@ -10,6 +10,7 @@ import java.util.Collections;
import
java.util.EnumMap
;
import
java.util.EnumSet
;
import
java.util.Iterator
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
...
...
@@ -30,7 +31,7 @@ public final class AttributesList {
public
AttributesList
()
{
flags
=
EnumSet
.
noneOf
(
AttributeFlag
.
class
);
uniqAttr
=
new
EnumMap
<
AttributeType
,
IAttribute
>(
AttributeType
.
class
);
attributes
=
new
ArrayList
<
IAttribute
>(
0
);
attributes
=
new
LinkedList
<
IAttribute
>(
);
attrCount
=
new
int
[
AttributeType
.
getNotUniqCount
()];
}
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
浏览文件 @
ab593e3c
...
...
@@ -22,7 +22,7 @@ import jadx.core.utils.exceptions.DecodeException;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.
Linked
HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -39,49 +39,56 @@ public class ClassNode extends LineAttrNode implements ILoadable {
private
final
DexNode
dex
;
private
final
ClassInfo
clsInfo
;
private
final
AccessInfo
accessFlags
;
private
ClassInfo
superClass
;
private
List
<
ClassInfo
>
interfaces
;
private
Map
<
ArgType
,
List
<
ArgType
>>
genericMap
;
private
final
List
<
MethodNode
>
methods
=
new
ArrayList
<
MethodNode
>();
private
final
List
<
FieldNode
>
fields
=
new
ArrayList
<
FieldNode
>();
private
final
AccessInfo
accessFlags
;
private
final
List
<
MethodNode
>
methods
;
private
final
List
<
FieldNode
>
fields
;
private
Map
<
Object
,
FieldNode
>
constFields
=
Collections
.
emptyMap
();
private
List
<
ClassNode
>
innerClasses
=
Collections
.
emptyList
();
private
final
Map
<
Object
,
FieldNode
>
constFields
=
new
HashMap
<
Object
,
FieldNode
>();
private
CodeWriter
code
;
// generated code
public
ClassNode
(
DexNode
dex
,
ClassDef
cls
)
throws
DecodeException
{
this
.
dex
=
dex
;
this
.
clsInfo
=
ClassInfo
.
fromDex
(
dex
,
cls
.
getTypeIndex
());
try
{
this
.
superClass
=
cls
.
getSupertypeIndex
()
==
DexNode
.
NO_INDEX
?
null
:
ClassInfo
.
fromDex
(
dex
,
cls
.
getSupertypeIndex
());
if
(
cls
.
getSupertypeIndex
()
==
DexNode
.
NO_INDEX
)
{
this
.
superClass
=
null
;
}
else
{
this
.
superClass
=
ClassInfo
.
fromDex
(
dex
,
cls
.
getSupertypeIndex
());
}
this
.
interfaces
=
new
ArrayList
<
ClassInfo
>(
cls
.
getInterfaces
().
length
);
for
(
short
interfaceIdx
:
cls
.
getInterfaces
())
{
this
.
interfaces
.
add
(
ClassInfo
.
fromDex
(
dex
,
interfaceIdx
));
}
if
(
cls
.
getClassDataOffset
()
!=
0
)
{
ClassData
clsData
=
dex
.
readClassData
(
cls
);
int
mthsCount
=
clsData
.
getDirectMethods
().
length
+
clsData
.
getVirtualMethods
().
length
;
int
fieldsCount
=
clsData
.
getStaticFields
().
length
+
clsData
.
getInstanceFields
().
length
;
for
(
Method
mth
:
clsData
.
getDirectMethods
())
methods
.
add
(
new
MethodNode
(
this
,
mth
)
);
methods
=
new
ArrayList
<
MethodNode
>(
mthsCount
);
fields
=
new
ArrayList
<
FieldNode
>(
fieldsCount
);
for
(
Method
mth
:
clsData
.
getVirtualMethods
())
for
(
Method
mth
:
clsData
.
getDirectMethods
())
{
methods
.
add
(
new
MethodNode
(
this
,
mth
));
}
for
(
Method
mth
:
clsData
.
getVirtualMethods
())
{
methods
.
add
(
new
MethodNode
(
this
,
mth
));
}
for
(
Field
f
:
clsData
.
getStaticFields
())
for
(
Field
f
:
clsData
.
getStaticFields
())
{
fields
.
add
(
new
FieldNode
(
this
,
f
));
}
loadStaticValues
(
cls
,
fields
);
for
(
Field
f
:
clsData
.
getInstanceFields
())
for
(
Field
f
:
clsData
.
getInstanceFields
())
{
fields
.
add
(
new
FieldNode
(
this
,
f
));
}
}
else
{
methods
=
Collections
.
emptyList
();
fields
=
Collections
.
emptyList
();
}
loadAnnotations
(
cls
);
...
...
@@ -98,13 +105,14 @@ public class ClassNode extends LineAttrNode implements ILoadable {
}
}
// restore original access flags from dalvik annotation if present
int
accFlagsValue
;
Annotation
a
=
getAttributes
().
getAnnotation
(
Consts
.
DALVIK_INNER_CLASS
);
if
(
a
!=
null
)
if
(
a
!=
null
)
{
accFlagsValue
=
(
Integer
)
a
.
getValues
().
get
(
"accessFlags"
);
else
}
else
{
accFlagsValue
=
cls
.
getAccessFlags
();
}
this
.
accessFlags
=
new
AccessInfo
(
accFlagsValue
,
AFType
.
CLASS
);
}
catch
(
Exception
e
)
{
...
...
@@ -134,8 +142,8 @@ public class ClassNode extends LineAttrNode implements ILoadable {
int
offset
=
cls
.
getStaticValuesOffset
();
if
(
offset
!=
0
)
{
StaticValuesParser
parser
=
new
StaticValuesParser
(
dex
,
dex
.
openSection
(
offset
));
parser
.
processFields
(
staticFields
);
int
count
=
parser
.
processFields
(
staticFields
);
constFields
=
new
LinkedHashMap
<
Object
,
FieldNode
>(
count
);
for
(
FieldNode
f
:
staticFields
)
{
AccessInfo
accFlags
=
f
.
getAccessFlags
();
if
(
accFlags
.
isStatic
()
&&
accFlags
.
isFinal
())
{
...
...
@@ -154,9 +162,9 @@ public class ClassNode extends LineAttrNode implements ILoadable {
@SuppressWarnings
(
"unchecked"
)
private
void
parseClassSignature
()
{
Annotation
a
=
this
.
getAttributes
().
getAnnotation
(
Consts
.
DALVIK_SIGNATURE
);
if
(
a
==
null
)
if
(
a
==
null
)
{
return
;
}
String
sign
=
Utils
.
mergeSignature
((
List
<
String
>)
a
.
getDefaultValue
());
// parse generic map
int
end
=
Utils
.
getGenericEnd
(
sign
);
...
...
@@ -188,13 +196,13 @@ public class ClassNode extends LineAttrNode implements ILoadable {
private
void
setFieldsTypesFromSignature
()
{
for
(
FieldNode
field
:
fields
)
{
Annotation
a
=
field
.
getAttributes
().
getAnnotation
(
Consts
.
DALVIK_SIGNATURE
);
if
(
a
==
null
)
continue
;
String
sign
=
Utils
.
mergeSignature
((
List
<
String
>)
a
.
getDefaultValue
());
ArgType
gType
=
ArgType
.
parseSignature
(
sign
);
if
(
gType
!=
null
)
field
.
setType
(
gType
);
if
(
a
!=
null
)
{
String
sign
=
Utils
.
mergeSignature
((
List
<
String
>)
a
.
getDefaultValue
())
;
ArgType
gType
=
ArgType
.
parseSignature
(
sign
);
if
(
gType
!=
null
)
{
field
.
setType
(
gType
);
}
}
}
}
...
...
@@ -288,8 +296,9 @@ public class ClassNode extends LineAttrNode implements ILoadable {
public
FieldNode
searchFieldById
(
int
id
)
{
String
name
=
FieldInfo
.
getNameById
(
dex
,
id
);
for
(
FieldNode
f
:
fields
)
{
if
(
f
.
getName
().
equals
(
name
))
if
(
f
.
getName
().
equals
(
name
))
{
return
f
;
}
}
return
null
;
}
...
...
@@ -300,24 +309,27 @@ public class ClassNode extends LineAttrNode implements ILoadable {
public
FieldNode
searchFieldByName
(
String
name
)
{
for
(
FieldNode
f
:
fields
)
{
if
(
f
.
getName
().
equals
(
name
))
if
(
f
.
getName
().
equals
(
name
))
{
return
f
;
}
}
return
null
;
}
public
MethodNode
searchMethod
(
MethodInfo
mth
)
{
for
(
MethodNode
m
:
methods
)
{
if
(
m
.
getMethodInfo
().
equals
(
mth
))
if
(
m
.
getMethodInfo
().
equals
(
mth
))
{
return
m
;
}
}
return
null
;
}
public
MethodNode
searchMethodByName
(
String
shortId
)
{
for
(
MethodNode
m
:
methods
)
{
if
(
m
.
getMethodInfo
().
getShortId
().
equals
(
shortId
))
if
(
m
.
getMethodInfo
().
getShortId
().
equals
(
shortId
))
{
return
m
;
}
}
return
null
;
}
...
...
@@ -331,8 +343,9 @@ public class ClassNode extends LineAttrNode implements ILoadable {
}
public
void
addInnerClass
(
ClassNode
cls
)
{
if
(
innerClasses
.
isEmpty
())
if
(
innerClasses
.
isEmpty
())
{
innerClasses
=
new
ArrayList
<
ClassNode
>(
3
);
}
innerClasses
.
add
(
cls
);
}
...
...
@@ -351,7 +364,7 @@ public class ClassNode extends LineAttrNode implements ILoadable {
if
(
mth
.
getAccessFlags
().
isConstructor
()
&&
mth
.
getMethodInfo
().
isConstructor
()
&&
(
mth
.
getMethodInfo
().
getArgsCount
()
==
0
||
(
mth
.
getArguments
(
false
)
!=
null
&&
mth
.
getArguments
(
false
).
isEmpty
())))
{
||
(
mth
.
getArguments
(
false
)
!=
null
&&
mth
.
getArguments
(
false
).
isEmpty
())))
{
return
mth
;
}
}
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/InsnContainer.java
浏览文件 @
ab593e3c
...
...
@@ -6,7 +6,7 @@ import java.util.List;
public
class
InsnContainer
extends
AttrNode
implements
IBlock
{
private
List
<
InsnNode
>
insns
;
private
final
List
<
InsnNode
>
insns
;
public
InsnContainer
(
List
<
InsnNode
>
insns
)
{
this
.
insns
=
insns
;
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/parser/StaticValuesParser.java
浏览文件 @
ab593e3c
...
...
@@ -15,13 +15,12 @@ public class StaticValuesParser extends EncValueParser {
super
(
dex
,
in
);
}
public
void
processFields
(
List
<
FieldNode
>
fields
)
throws
DecodeException
{
int
size
=
Leb128Utils
.
readUnsignedLeb128
(
in
);
visitArray
(
size
);
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
public
int
processFields
(
List
<
FieldNode
>
fields
)
throws
DecodeException
{
int
count
=
Leb128Utils
.
readUnsignedLeb128
(
in
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
Object
value
=
parseValue
();
fields
.
get
(
i
).
getAttributes
().
add
(
new
FieldValueAttr
(
value
));
}
return
count
;
}
}
jadx-core/src/main/java/jadx/core/dex/visitors/BlockProcessingHelper.java
浏览文件 @
ab593e3c
...
...
@@ -24,7 +24,6 @@ public class BlockProcessingHelper {
if
(
mth
.
isNoCode
())
{
return
;
}
for
(
BlockNode
block
:
mth
.
getBasicBlocks
())
{
markExceptionHandlers
(
block
);
}
...
...
@@ -78,7 +77,6 @@ public class BlockProcessingHelper {
for
(
BlockNode
node
:
BlockUtils
.
collectBlocksDominatedBy
(
block
,
block
))
{
excHandler
.
addBlock
(
node
);
}
for
(
BlockNode
excBlock
:
excHandler
.
getBlocks
())
{
// remove 'monitor-exit' from exception handler blocks
InstructionRemover
remover
=
new
InstructionRemover
(
excBlock
.
getInstructions
());
...
...
@@ -86,7 +84,6 @@ public class BlockProcessingHelper {
if
(
insn
.
getType
()
==
InsnType
.
MONITOR_ENTER
)
{
break
;
}
if
(
insn
.
getType
()
==
InsnType
.
MONITOR_EXIT
)
{
remover
.
add
(
insn
);
}
...
...
@@ -119,7 +116,6 @@ public class BlockProcessingHelper {
if
(
catchAttr
==
null
)
{
continue
;
}
if
(
commonCatchAttr
==
null
)
{
commonCatchAttr
=
catchAttr
;
}
else
if
(
commonCatchAttr
!=
catchAttr
)
{
...
...
jadx-core/src/main/java/jadx/core/utils/BlockUtils.java
浏览文件 @
ab593e3c
...
...
@@ -17,10 +17,11 @@ public class BlockUtils {
public
static
BlockNode
getBlockByOffset
(
int
offset
,
Iterable
<
BlockNode
>
casesBlocks
)
{
for
(
BlockNode
block
:
casesBlocks
)
{
if
(
block
.
getStartOffset
()
==
offset
)
if
(
block
.
getStartOffset
()
==
offset
)
{
return
block
;
}
}
throw
new
JadxRuntimeException
(
"Can'
r
find block by offset: "
throw
new
JadxRuntimeException
(
"Can'
t
find block by offset: "
+
InsnUtils
.
formatOffset
(
offset
)
+
" in list "
+
casesBlocks
);
}
...
...
@@ -30,7 +31,6 @@ public class BlockUtils {
if
(
list
.
size
()
>
2
)
{
list
=
cleanBlockList
(
list
);
}
assert
list
.
size
()
==
2
:
"too many nodes for selectOther: "
+
node
+
" in "
+
list
;
BlockNode
first
=
list
.
get
(
0
);
if
(
first
!=
node
)
...
...
jadx-gui/src/main/java/jadx/gui/MainWindow.java
浏览文件 @
ab593e3c
...
...
@@ -81,10 +81,12 @@ public class MainWindow extends JFrame {
private
final
JadxWrapper
wrapper
;
private
JPanel
mainPanel
;
private
JTree
tree
;
private
final
JTabbedPane
tabbedPane
=
new
JTabbedPane
();
private
DefaultTreeModel
treeModel
;
private
Map
<
JClass
,
Component
>
openTabs
=
new
HashMap
<
JClass
,
Component
>();
private
final
JTabbedPane
tabbedPane
=
new
JTabbedPane
();
private
final
Map
<
JClass
,
Component
>
openTabs
=
new
HashMap
<
JClass
,
Component
>();
public
MainWindow
(
JadxWrapper
wrapper
)
{
this
.
wrapper
=
wrapper
;
...
...
jadx-gui/src/main/java/jadx/gui/treemodel/JClass.java
浏览文件 @
ab593e3c
...
...
@@ -50,7 +50,7 @@ public class JClass extends JNode {
}
@Override
public
void
updateChilds
()
{
public
synchronized
void
updateChilds
()
{
removeAllChildren
();
if
(!
loaded
)
{
add
(
new
TextNode
(
NLS
.
str
(
"tree.loading"
)));
...
...
jadx-gui/src/main/java/jadx/gui/treemodel/JPackage.java
浏览文件 @
ab593e3c
...
...
@@ -15,8 +15,8 @@ public class JPackage extends JNode implements Comparable<JPackage> {
private
static
final
ImageIcon
PACKAGE_ICON
=
Utils
.
openIcon
(
"package_obj"
);
private
String
name
;
private
List
<
JClass
>
classes
;
private
List
<
JPackage
>
innerPackages
=
new
ArrayList
<
JPackage
>(
1
);
private
final
List
<
JClass
>
classes
;
private
final
List
<
JPackage
>
innerPackages
=
new
ArrayList
<
JPackage
>(
1
);
public
JPackage
(
JavaPackage
pkg
)
{
this
.
name
=
pkg
.
getName
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录