Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Quincy379
jadx
提交
a01c379c
J
jadx
项目概览
Quincy379
/
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,发现更多精彩内容 >>
未验证
提交
a01c379c
编写于
1月 02, 2018
作者:
S
skylot
提交者:
GitHub
1月 02, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #171 from daramos/deobfuscation_work
deobfuscation fixes
上级
c9b781d5
bf3863d1
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
58 addition
and
34 deletion
+58
-34
jadx-core/src/main/java/jadx/core/codegen/ClassGen.java
jadx-core/src/main/java/jadx/core/codegen/ClassGen.java
+6
-3
jadx-core/src/main/java/jadx/core/codegen/MethodGen.java
jadx-core/src/main/java/jadx/core/codegen/MethodGen.java
+4
-0
jadx-core/src/main/java/jadx/core/codegen/NameGen.java
jadx-core/src/main/java/jadx/core/codegen/NameGen.java
+1
-0
jadx-core/src/main/java/jadx/core/deobf/Deobfuscator.java
jadx-core/src/main/java/jadx/core/deobf/Deobfuscator.java
+14
-14
jadx-core/src/main/java/jadx/core/dex/info/ClassInfo.java
jadx-core/src/main/java/jadx/core/dex/info/ClassInfo.java
+6
-2
jadx-core/src/main/java/jadx/core/dex/info/FieldInfo.java
jadx-core/src/main/java/jadx/core/dex/info/FieldInfo.java
+1
-1
jadx-core/src/main/java/jadx/core/dex/info/InfoStorage.java
jadx-core/src/main/java/jadx/core/dex/info/InfoStorage.java
+9
-4
jadx-core/src/main/java/jadx/core/dex/info/MethodInfo.java
jadx-core/src/main/java/jadx/core/dex/info/MethodInfo.java
+2
-2
jadx-core/src/main/java/jadx/core/dex/nodes/DexNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/DexNode.java
+7
-7
jadx-core/src/main/java/jadx/core/dex/nodes/RootNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/RootNode.java
+8
-1
未找到文件。
jadx-core/src/main/java/jadx/core/codegen/ClassGen.java
浏览文件 @
a01c379c
...
...
@@ -339,6 +339,10 @@ public class ClassGen {
continue
;
}
annotationGen
.
addForField
(
code
,
f
);
if
(
f
.
getFieldInfo
().
isRenamed
())
{
code
.
startLine
(
"/* renamed from: "
).
add
(
f
.
getName
()).
add
(
" */"
);
}
code
.
startLine
(
f
.
getAccessFlags
().
makeString
());
useType
(
code
,
f
.
getType
());
code
.
add
(
' '
);
...
...
@@ -586,9 +590,8 @@ public class ClassGen {
private
void
insertRenameInfo
(
CodeWriter
code
,
ClassNode
cls
)
{
ClassInfo
classInfo
=
cls
.
getClassInfo
();
if
(
classInfo
.
isRenamed
()
&&
!
cls
.
getShortName
().
equals
(
cls
.
getAlias
().
getShortName
()))
{
code
.
startLine
(
"/* renamed from: "
).
add
(
classInfo
.
getFullName
()).
add
(
" */"
);
if
(
classInfo
.
isRenamed
())
{
code
.
startLine
(
"/* renamed from: "
).
add
(
classInfo
.
getType
().
getObject
()).
add
(
" */"
);
}
}
...
...
jadx-core/src/main/java/jadx/core/codegen/MethodGen.java
浏览文件 @
a01c379c
...
...
@@ -80,6 +80,10 @@ public class MethodGen {
if
(
clsAccFlags
.
isAnnotation
())
{
ai
=
ai
.
remove
(
AccessFlags
.
ACC_PUBLIC
);
}
if
(
mth
.
getMethodInfo
().
isRenamed
())
{
code
.
startLine
(
"/* renamed from: "
).
add
(
mth
.
getName
()).
add
(
" */"
);
}
code
.
startLineWithNum
(
mth
.
getSourceLine
());
code
.
add
(
ai
.
makeString
());
...
...
jadx-core/src/main/java/jadx/core/codegen/NameGen.java
浏览文件 @
a01c379c
...
...
@@ -164,6 +164,7 @@ public class NameGen {
if
(
vName
!=
null
)
{
return
vName
;
}
return
StringUtils
.
escape
(
shortName
.
toLowerCase
());
}
return
StringUtils
.
escape
(
type
.
toString
());
}
...
...
jadx-core/src/main/java/jadx/core/deobf/Deobfuscator.java
浏览文件 @
a01c379c
...
...
@@ -16,7 +16,6 @@ import java.io.File;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
...
...
@@ -111,22 +110,23 @@ public class Deobfuscator {
private
void
postProcess
()
{
int
id
=
1
;
for
(
OverridedMethodsNode
o
:
ovrd
)
{
Iterator
<
MethodInfo
>
it
=
o
.
getMethods
().
iterator
();
if
(
it
.
hasNext
())
{
MethodInfo
mth
=
it
.
next
();
if
(
mth
.
isRenamed
()
&&
!
mth
.
isAliasFromPreset
())
{
mth
.
setAlias
(
String
.
format
(
"mo%d%s"
,
id
,
makeName
(
mth
.
getName
())));
boolean
aliasFromPreset
=
false
;
String
aliasToUse
=
null
;
for
(
MethodInfo
mth
:
o
.
getMethods
()){
if
(
mth
.
isAliasFromPreset
())
{
aliasToUse
=
mth
.
getAlias
();
aliasFromPreset
=
true
;
}
String
firstMethodAlias
=
mth
.
getAlias
();
while
(
it
.
hasNext
())
{
mth
=
it
.
next
();
if
(!
mth
.
getAlias
().
equals
(
firstMethodAlias
))
{
mth
.
setAlias
(
firstMethodAlias
);
}
for
(
MethodInfo
mth
:
o
.
getMethods
()){
if
(
aliasToUse
==
null
)
{
if
(
mth
.
isRenamed
()
&&
!
mth
.
isAliasFromPreset
())
{
mth
.
setAlias
(
String
.
format
(
"mo%d%s"
,
id
,
makeName
(
mth
.
getName
())));
}
aliasToUse
=
mth
.
getAlias
();
}
mth
.
setAlias
(
aliasToUse
);
mth
.
setAliasFromPreset
(
aliasFromPreset
);
}
id
++;
...
...
jadx-core/src/main/java/jadx/core/dex/info/ClassInfo.java
浏览文件 @
a01c379c
...
...
@@ -35,12 +35,12 @@ public final class ClassInfo {
if
(
type
.
isArray
())
{
type
=
ArgType
.
OBJECT
;
}
ClassInfo
cls
=
dex
.
getInfoStorage
().
getCls
(
type
);
ClassInfo
cls
=
dex
.
root
().
getInfoStorage
().
getCls
(
type
);
if
(
cls
!=
null
)
{
return
cls
;
}
cls
=
new
ClassInfo
(
dex
,
type
);
return
dex
.
getInfoStorage
().
putCls
(
cls
);
return
dex
.
root
().
getInfoStorage
().
putCls
(
cls
);
}
public
static
ClassInfo
fromDex
(
DexNode
dex
,
int
clsIndex
)
{
...
...
@@ -89,6 +89,10 @@ public final class ClassInfo {
int
sep
=
clsName
.
lastIndexOf
(
'$'
);
if
(
canBeInner
&&
sep
>
0
&&
sep
!=
clsName
.
length
()
-
1
)
{
String
parClsName
=
pkg
+
"."
+
clsName
.
substring
(
0
,
sep
);
if
(
pkg
.
length
()
==
0
)
{
parClsName
=
clsName
.
substring
(
0
,
sep
);
}
parentClass
=
fromName
(
dex
,
parClsName
);
clsName
=
clsName
.
substring
(
sep
+
1
);
}
else
{
...
...
jadx-core/src/main/java/jadx/core/dex/info/FieldInfo.java
浏览文件 @
a01c379c
...
...
@@ -22,7 +22,7 @@ public final class FieldInfo {
public
static
FieldInfo
from
(
DexNode
dex
,
ClassInfo
declClass
,
String
name
,
ArgType
type
)
{
FieldInfo
field
=
new
FieldInfo
(
declClass
,
name
,
type
);
return
dex
.
getInfoStorage
().
getField
(
field
);
return
dex
.
root
().
getInfoStorage
().
getField
(
field
);
}
public
static
FieldInfo
fromDex
(
DexNode
dex
,
int
index
)
{
...
...
jadx-core/src/main/java/jadx/core/dex/info/InfoStorage.java
浏览文件 @
a01c379c
package
jadx.core.dex.info
;
import
jadx.core.dex.instructions.args.ArgType
;
import
jadx.core.dex.nodes.DexNode
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -22,13 +23,17 @@ public class InfoStorage {
}
}
p
ublic
MethodInfo
getMethod
(
int
mtd
Id
)
{
return
methods
.
get
(
mtdId
)
;
p
rivate
int
generateMethodLookupId
(
DexNode
dex
,
int
mth
Id
)
{
return
(
dex
.
getDexId
()<<
16
)|
mthId
;
}
public
MethodInfo
putMethod
(
int
mthId
,
MethodInfo
mth
)
{
public
MethodInfo
getMethod
(
DexNode
dex
,
int
mtdId
)
{
return
methods
.
get
(
generateMethodLookupId
(
dex
,
mtdId
));
}
public
MethodInfo
putMethod
(
DexNode
dex
,
int
mthId
,
MethodInfo
mth
)
{
synchronized
(
methods
)
{
MethodInfo
prev
=
methods
.
put
(
mthId
,
mth
);
MethodInfo
prev
=
methods
.
put
(
generateMethodLookupId
(
dex
,
mthId
)
,
mth
);
return
prev
==
null
?
mth
:
prev
;
}
}
...
...
jadx-core/src/main/java/jadx/core/dex/info/MethodInfo.java
浏览文件 @
a01c379c
...
...
@@ -34,12 +34,12 @@ public final class MethodInfo {
}
public
static
MethodInfo
fromDex
(
DexNode
dex
,
int
mthIndex
)
{
MethodInfo
mth
=
dex
.
getInfoStorage
().
getMethod
(
mthIndex
);
MethodInfo
mth
=
dex
.
root
().
getInfoStorage
().
getMethod
(
dex
,
mthIndex
);
if
(
mth
!=
null
)
{
return
mth
;
}
mth
=
new
MethodInfo
(
dex
,
mthIndex
);
return
dex
.
getInfoStorage
().
putMethod
(
mthIndex
,
mth
);
return
dex
.
root
().
getInfoStorage
().
putMethod
(
dex
,
mthIndex
,
mth
);
}
public
String
makeSignature
(
boolean
includeRetType
)
{
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/DexNode.java
浏览文件 @
a01c379c
...
...
@@ -35,16 +35,16 @@ public class DexNode implements IDexNode {
private
final
RootNode
root
;
private
final
Dex
dexBuf
;
private
final
DexFile
file
;
private
final
int
dexId
;
private
final
List
<
ClassNode
>
classes
=
new
ArrayList
<
ClassNode
>();
private
final
Map
<
ClassInfo
,
ClassNode
>
clsMap
=
new
HashMap
<
ClassInfo
,
ClassNode
>();
private
final
InfoStorage
infoStorage
=
new
InfoStorage
();
public
DexNode
(
RootNode
root
,
DexFile
input
)
{
public
DexNode
(
RootNode
root
,
DexFile
input
,
int
dexId
)
{
this
.
root
=
root
;
this
.
file
=
input
;
this
.
dexBuf
=
input
.
getDexBuf
();
this
.
dexId
=
dexId
;
}
public
void
loadClasses
()
throws
DecodeException
{
...
...
@@ -153,10 +153,6 @@ public class DexNode implements IDexNode {
return
null
;
}
public
InfoStorage
getInfoStorage
()
{
return
infoStorage
;
}
public
DexFile
getDexFile
()
{
return
file
;
}
...
...
@@ -214,6 +210,10 @@ public class DexNode implements IDexNode {
return
this
;
}
public
int
getDexId
()
{
return
dexId
;
}
@Override
public
String
toString
()
{
return
"DEX"
;
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/RootNode.java
浏览文件 @
a01c379c
...
...
@@ -7,6 +7,7 @@ import jadx.api.ResourcesLoader;
import
jadx.core.clsp.ClspGraph
;
import
jadx.core.dex.info.ClassInfo
;
import
jadx.core.dex.info.ConstStorage
;
import
jadx.core.dex.info.InfoStorage
;
import
jadx.core.utils.ErrorsCounter
;
import
jadx.core.utils.StringUtils
;
import
jadx.core.utils.android.AndroidResourcesUtils
;
...
...
@@ -34,6 +35,7 @@ public class RootNode {
private
final
IJadxArgs
args
;
private
final
StringUtils
stringUtils
;
private
final
ConstStorage
constValues
;
private
final
InfoStorage
infoStorage
=
new
InfoStorage
();
private
List
<
DexNode
>
dexNodes
;
@Nullable
...
...
@@ -53,7 +55,7 @@ public class RootNode {
for
(
DexFile
dexFile
:
input
.
getDexFiles
())
{
try
{
LOG
.
debug
(
"Load: {}"
,
dexFile
);
DexNode
dexNode
=
new
DexNode
(
this
,
dexFile
);
DexNode
dexNode
=
new
DexNode
(
this
,
dexFile
,
dexNodes
.
size
()
);
dexNodes
.
add
(
dexNode
);
}
catch
(
Exception
e
)
{
throw
new
DecodeException
(
"Error decode file: "
+
dexFile
,
e
);
...
...
@@ -197,4 +199,9 @@ public class RootNode {
public
ConstStorage
getConstValues
()
{
return
constValues
;
}
public
InfoStorage
getInfoStorage
()
{
return
infoStorage
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录