Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_76393173
jadx
提交
6bc2d332
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,发现更多精彩内容 >>
提交
6bc2d332
编写于
9月 25, 2013
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code refactoring
上级
c9521192
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
78 addition
and
72 deletion
+78
-72
build.gradle
build.gradle
+3
-3
jadx-cli/src/main/java/jadx/cli/JadxCLI.java
jadx-cli/src/main/java/jadx/cli/JadxCLI.java
+13
-11
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
+2
-2
jadx-cli/src/main/resources/logback.xml
jadx-cli/src/main/resources/logback.xml
+1
-1
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
+7
-7
jadx-core/src/main/java/jadx/core/dex/info/ClassInfo.java
jadx-core/src/main/java/jadx/core/dex/info/ClassInfo.java
+1
-1
jadx-core/src/main/java/jadx/core/dex/instructions/ConstClassNode.java
.../main/java/jadx/core/dex/instructions/ConstClassNode.java
+2
-2
jadx-core/src/main/java/jadx/core/dex/instructions/ConstStringNode.java
...main/java/jadx/core/dex/instructions/ConstStringNode.java
+2
-2
jadx-core/src/main/java/jadx/core/dex/instructions/FillArrayNode.java
...c/main/java/jadx/core/dex/instructions/FillArrayNode.java
+2
-2
jadx-core/src/main/java/jadx/core/dex/instructions/InsnDecoder.java
...src/main/java/jadx/core/dex/instructions/InsnDecoder.java
+3
-3
jadx-core/src/main/java/jadx/core/dex/instructions/args/InsnArg.java
...rc/main/java/jadx/core/dex/instructions/args/InsnArg.java
+32
-28
jadx-core/src/main/java/jadx/core/dex/instructions/args/RegisterArg.java
...ain/java/jadx/core/dex/instructions/args/RegisterArg.java
+4
-4
jadx-core/src/main/java/jadx/core/dex/visitors/ModVisitor.java
...core/src/main/java/jadx/core/dex/visitors/ModVisitor.java
+4
-4
jadx-samples/build.gradle
jadx-samples/build.gradle
+2
-2
未找到文件。
build.gradle
浏览文件 @
6bc2d332
...
...
@@ -35,20 +35,20 @@ subprojects {
}
}
task
copyArtifacts
(
type:
Sync
,
dependsOn:
[
'jadx-cli:installApp'
,
'jadx-gui:installApp'
])
{
task
copyArtifacts
(
type:
Sync
,
dependsOn:
[
'jadx-cli:installApp'
,
'jadx-gui:installApp'
])
{
destinationDir
file
(
"$buildDir/jadx"
)
[
'jadx-cli'
,
'jadx-gui'
].
each
{
from
tasks
.
getByPath
(
":${it}:installApp"
).
destinationDir
}
}
task
pack
(
type:
Zip
,
dependsOn:
copyArtifacts
)
{
task
pack
(
type:
Zip
,
dependsOn:
copyArtifacts
)
{
destinationDir
buildDir
archiveName
"jadx-${jadxVersion}.zip"
from
copyArtifacts
.
destinationDir
}
task
build
(
dependsOn:
pack
)
{
task
build
(
dependsOn:
pack
)
{
description
=
'Build jadx distribution zip'
}
...
...
jadx-cli/src/main/java/jadx/cli/JadxCLI.java
浏览文件 @
6bc2d332
...
...
@@ -2,7 +2,6 @@ package jadx.cli;
import
jadx.api.Decompiler
;
import
jadx.core.utils.ErrorsCounter
;
import
jadx.core.utils.exceptions.JadxException
;
import
java.io.File
;
...
...
@@ -17,7 +16,7 @@ public class JadxCLI {
JadxCLIArgs
jadxArgs
=
new
JadxCLIArgs
(
args
);
checkArgs
(
jadxArgs
);
processAndSave
(
jadxArgs
);
}
catch
(
Jadx
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOG
.
error
(
e
.
getMessage
());
System
.
exit
(
1
);
}
...
...
@@ -40,26 +39,29 @@ public class JadxCLI {
System
.
exit
(
errorsCount
);
}
private
static
void
checkArgs
(
JadxCLIArgs
jadxArgs
)
throws
JadxException
{
if
(
jadxArgs
.
getInput
().
isEmpty
())
throw
new
JadxException
(
"Please specify input file"
);
private
static
void
checkArgs
(
JadxCLIArgs
jadxArgs
)
throws
Exception
{
if
(
jadxArgs
.
getInput
().
isEmpty
())
{
LOG
.
error
(
"Please specify input file"
);
jadxArgs
.
printUsage
();
System
.
exit
(
1
);
}
File
outputDir
=
jadxArgs
.
getOutDir
();
if
(
outputDir
==
null
)
{
String
outDirName
;
File
file
=
jadxArgs
.
getInput
().
get
(
0
);
String
name
=
file
.
getName
();
int
pos
=
name
.
lastIndexOf
(
'.'
);
if
(
pos
!=
-
1
)
if
(
pos
!=
-
1
)
{
outDirName
=
name
.
substring
(
0
,
pos
);
else
}
else
{
outDirName
=
name
+
"-jadx-out"
;
}
LOG
.
info
(
"output directory: "
+
outDirName
);
outputDir
=
new
File
(
outDirName
);
jadxArgs
.
setOutputDir
(
outputDir
);
}
if
(
outputDir
.
exists
()
&&
!
outputDir
.
isDirectory
())
throw
new
JadxException
(
"Output directory exists as file "
+
outputDir
);
if
(
outputDir
.
exists
()
&&
!
outputDir
.
isDirectory
())
{
throw
new
Exception
(
"Output directory exists as file "
+
outputDir
);
}
}
}
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
浏览文件 @
6bc2d332
...
...
@@ -20,7 +20,7 @@ import com.beust.jcommander.ParameterException;
public
final
class
JadxCLIArgs
implements
IJadxArgs
{
@Parameter
(
description
=
"<input file> (.dex, .apk
, .jar or .class
)"
)
@Parameter
(
description
=
"<input file> (.dex, .apk
or .jar
)"
)
protected
List
<
String
>
files
;
@Parameter
(
names
=
{
"-d"
,
"--output-dir"
},
description
=
"output directory"
)
...
...
@@ -32,7 +32,7 @@ public final class JadxCLIArgs implements IJadxArgs {
@Parameter
(
names
=
{
"-f"
,
"--fallback"
},
description
=
"make simple dump (using goto instead of 'if', 'for', etc)"
,
help
=
true
)
protected
boolean
fallbackMode
=
false
;
@Parameter
(
names
=
{
"--cfg"
},
description
=
"save methods control flow graph"
)
@Parameter
(
names
=
{
"--cfg"
},
description
=
"save methods control flow graph
to dot file
"
)
protected
boolean
cfgOutput
=
false
;
@Parameter
(
names
=
{
"--raw-cfg"
},
description
=
"save methods control flow graph (use raw instructions)"
)
...
...
jadx-c
ore
/src/main/resources/logback.xml
→
jadx-c
li
/src/main/resources/logback.xml
浏览文件 @
6bc2d332
...
...
@@ -2,7 +2,7 @@
<appender
name=
"STDOUT"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder>
<pattern>
%
d{HH:mm:ss} %
-5level - %msg%n
</pattern>
<pattern>
%-5level - %msg%n
</pattern>
</encoder>
</appender>
...
...
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
浏览文件 @
6bc2d332
...
...
@@ -8,9 +8,9 @@ import jadx.core.dex.info.FieldInfo;
import
jadx.core.dex.info.MethodInfo
;
import
jadx.core.dex.instructions.ArithNode
;
import
jadx.core.dex.instructions.ArithOp
;
import
jadx.core.dex.instructions.ConstClass
Insn
;
import
jadx.core.dex.instructions.ConstString
Insn
;
import
jadx.core.dex.instructions.FillArray
Op
;
import
jadx.core.dex.instructions.ConstClass
Node
;
import
jadx.core.dex.instructions.ConstString
Node
;
import
jadx.core.dex.instructions.FillArray
Node
;
import
jadx.core.dex.instructions.GotoNode
;
import
jadx.core.dex.instructions.IfNode
;
import
jadx.core.dex.instructions.IndexInsnNode
;
...
...
@@ -209,12 +209,12 @@ public class InsnGen {
private
void
makeInsnBody
(
CodeWriter
code
,
InsnNode
insn
,
EnumSet
<
IGState
>
state
)
throws
CodegenException
{
switch
(
insn
.
getType
())
{
case
CONST_STR:
String
str
=
((
ConstString
Insn
)
insn
).
getString
();
String
str
=
((
ConstString
Node
)
insn
).
getString
();
code
.
add
(
StringUtils
.
unescapeString
(
str
));
break
;
case
CONST_CLASS:
ArgType
clsType
=
((
ConstClass
Insn
)
insn
).
getClsType
();
ArgType
clsType
=
((
ConstClass
Node
)
insn
).
getClsType
();
code
.
add
(
useType
(
clsType
)).
add
(
".class"
);
break
;
...
...
@@ -311,7 +311,7 @@ public class InsnGen {
break
;
case
FILL_ARRAY:
fillArray
((
FillArray
Op
)
insn
,
code
);
fillArray
((
FillArray
Node
)
insn
,
code
);
break
;
case
FILLED_NEW_ARRAY:
...
...
@@ -449,7 +449,7 @@ public class InsnGen {
code
.
add
(
'}'
);
}
private
void
fillArray
(
FillArray
Op
insn
,
CodeWriter
code
)
throws
CodegenException
{
private
void
fillArray
(
FillArray
Node
insn
,
CodeWriter
code
)
throws
CodegenException
{
ArgType
elType
=
insn
.
getResult
().
getType
().
getArrayElement
();
if
(
elType
.
getPrimitiveType
()
==
null
)
{
elType
=
elType
.
selectFirst
();
...
...
jadx-core/src/main/java/jadx/core/dex/info/ClassInfo.java
浏览文件 @
6bc2d332
...
...
@@ -80,7 +80,7 @@ public final class ClassInfo {
char
firstChar
=
name
.
charAt
(
0
);
if
(
Character
.
isDigit
(
firstChar
))
{
name
=
"
Inner
Class_"
+
name
;
name
=
"
Anonymous
Class_"
+
name
;
}
else
if
(
firstChar
==
'$'
)
{
name
=
"_"
+
name
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/ConstClass
Insn
.java
→
jadx-core/src/main/java/jadx/core/dex/instructions/ConstClass
Node
.java
浏览文件 @
6bc2d332
...
...
@@ -3,11 +3,11 @@ package jadx.core.dex.instructions;
import
jadx.core.dex.instructions.args.ArgType
;
import
jadx.core.dex.nodes.InsnNode
;
public
class
ConstClass
Insn
extends
InsnNode
{
public
class
ConstClass
Node
extends
InsnNode
{
private
final
ArgType
clsType
;
public
ConstClass
Insn
(
ArgType
clsType
)
{
public
ConstClass
Node
(
ArgType
clsType
)
{
super
(
InsnType
.
CONST_CLASS
,
0
);
this
.
clsType
=
clsType
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/ConstString
Insn
.java
→
jadx-core/src/main/java/jadx/core/dex/instructions/ConstString
Node
.java
浏览文件 @
6bc2d332
...
...
@@ -2,11 +2,11 @@ package jadx.core.dex.instructions;
import
jadx.core.dex.nodes.InsnNode
;
public
class
ConstString
Insn
extends
InsnNode
{
public
class
ConstString
Node
extends
InsnNode
{
private
final
String
str
;
public
ConstString
Insn
(
String
str
)
{
public
ConstString
Node
(
String
str
)
{
super
(
InsnType
.
CONST_STR
,
0
);
this
.
str
=
str
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/FillArray
Op
.java
→
jadx-core/src/main/java/jadx/core/dex/instructions/FillArray
Node
.java
浏览文件 @
6bc2d332
...
...
@@ -7,11 +7,11 @@ import jadx.core.dex.nodes.InsnNode;
import
com.android.dx.io.instructions.FillArrayDataPayloadDecodedInstruction
;
public
class
FillArray
Op
extends
InsnNode
{
public
class
FillArray
Node
extends
InsnNode
{
private
final
Object
data
;
public
FillArray
Op
(
int
resReg
,
FillArrayDataPayloadDecodedInstruction
payload
)
{
public
FillArray
Node
(
int
resReg
,
FillArrayDataPayloadDecodedInstruction
payload
)
{
super
(
InsnType
.
FILL_ARRAY
,
0
);
this
.
data
=
payload
.
getData
();
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/InsnDecoder.java
浏览文件 @
6bc2d332
...
...
@@ -96,13 +96,13 @@ public class InsnDecoder {
case
Opcodes
.
CONST_STRING
:
case
Opcodes
.
CONST_STRING_JUMBO
:
{
InsnNode
node
=
new
ConstString
Insn
(
dex
.
getString
(
insn
.
getIndex
()));
InsnNode
node
=
new
ConstString
Node
(
dex
.
getString
(
insn
.
getIndex
()));
node
.
setResult
(
InsnArg
.
reg
(
insn
,
0
,
ArgType
.
STRING
));
return
node
;
}
case
Opcodes
.
CONST_CLASS
:
{
InsnNode
node
=
new
ConstClass
Insn
(
dex
.
getType
(
insn
.
getIndex
()));
InsnNode
node
=
new
ConstClass
Node
(
dex
.
getType
(
insn
.
getIndex
()));
node
.
setResult
(
InsnArg
.
reg
(
insn
,
0
,
ArgType
.
CLASS
));
return
node
;
}
...
...
@@ -595,7 +595,7 @@ public class InsnDecoder {
private
InsnNode
fillArray
(
DecodedInstruction
insn
)
{
DecodedInstruction
payload
=
insnArr
[
insn
.
getTarget
()];
return
new
FillArray
Op
(
insn
.
getA
(),
(
FillArrayDataPayloadDecodedInstruction
)
payload
);
return
new
FillArray
Node
(
insn
.
getA
(),
(
FillArrayDataPayloadDecodedInstruction
)
payload
);
}
private
InsnNode
filledNewArray
(
DecodedInstruction
insn
,
int
offset
,
boolean
isRange
)
{
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/args/InsnArg.java
浏览文件 @
6bc2d332
package
jadx.core.dex.instructions.args
;
import
jadx.core.dex.instructions.InsnType
;
import
jadx.core.dex.nodes.InsnNode
;
import
jadx.core.utils.InsnUtils
;
...
...
@@ -63,40 +62,45 @@ public abstract class InsnArg extends Typed {
}
public
InsnArg
wrapInstruction
(
InsnNode
insn
)
{
assert
parentInsn
!=
insn
:
"Can't wrap instruction info itself"
;
int
count
=
parentInsn
.
getArgsCount
();
InsnNode
parent
=
parentInsn
;
assert
parent
!=
insn
:
"Can't wrap instruction info itself"
;
int
count
=
parent
.
getArgsCount
();
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
if
(
parentInsn
.
getArg
(
i
)
==
this
)
{
InsnArg
arg
;
InsnType
insnType
=
insn
.
getType
();
switch
(
insnType
)
{
case
MOVE:
case
CONST:
arg
=
insn
.
getArg
(
0
);
String
name
=
insn
.
getResult
().
getTypedVar
().
getName
();
if
(
name
!=
null
)
{
arg
.
getTypedVar
().
setName
(
name
);
}
break
;
case
CONST_STR:
arg
=
wrap
(
insn
);
arg
.
getTypedVar
().
forceSetType
(
ArgType
.
STRING
);
break
;
case
CONST_CLASS:
arg
=
wrap
(
insn
);
arg
.
getTypedVar
().
forceSetType
(
ArgType
.
CLASS
);
break
;
default
:
arg
=
wrap
(
insn
);
break
;
}
parentInsn
.
setArg
(
i
,
arg
);
if
(
parent
.
getArg
(
i
)
==
this
)
{
InsnArg
arg
=
wrapArg
(
insn
);
parent
.
setArg
(
i
,
arg
);
return
arg
;
}
}
return
null
;
}
private
static
InsnArg
wrapArg
(
InsnNode
insn
)
{
InsnArg
arg
;
switch
(
insn
.
getType
())
{
case
MOVE:
case
CONST:
arg
=
insn
.
getArg
(
0
);
String
name
=
insn
.
getResult
().
getTypedVar
().
getName
();
if
(
name
!=
null
)
{
arg
.
getTypedVar
().
setName
(
name
);
}
break
;
case
CONST_STR:
arg
=
wrap
(
insn
);
arg
.
getTypedVar
().
forceSetType
(
ArgType
.
STRING
);
break
;
case
CONST_CLASS:
arg
=
wrap
(
insn
);
arg
.
getTypedVar
().
forceSetType
(
ArgType
.
CLASS
);
break
;
default
:
arg
=
wrap
(
insn
);
break
;
}
return
arg
;
}
public
boolean
isThis
()
{
// must be implemented in RegisterArg
return
false
;
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/args/RegisterArg.java
浏览文件 @
6bc2d332
package
jadx.core.dex.instructions.args
;
import
jadx.core.dex.instructions.ConstClass
Insn
;
import
jadx.core.dex.instructions.ConstString
Insn
;
import
jadx.core.dex.instructions.ConstClass
Node
;
import
jadx.core.dex.instructions.ConstString
Node
;
import
jadx.core.dex.instructions.InsnType
;
import
jadx.core.dex.nodes.InsnNode
;
import
jadx.core.dex.visitors.InstructionRemover
;
...
...
@@ -53,9 +53,9 @@ public class RegisterArg extends InsnArg {
case
CONST:
return
parInsn
.
getArg
(
0
);
case
CONST_STR:
return
((
ConstString
Insn
)
parInsn
).
getString
();
return
((
ConstString
Node
)
parInsn
).
getString
();
case
CONST_CLASS:
return
((
ConstClass
Insn
)
parInsn
).
getClsType
();
return
((
ConstClass
Node
)
parInsn
).
getClsType
();
}
}
return
null
;
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/ModVisitor.java
浏览文件 @
6bc2d332
...
...
@@ -3,8 +3,8 @@ package jadx.core.dex.visitors;
import
jadx.core.deobf.NameMapper
;
import
jadx.core.dex.attributes.AttributeType
;
import
jadx.core.dex.info.MethodInfo
;
import
jadx.core.dex.instructions.ConstClass
Insn
;
import
jadx.core.dex.instructions.ConstString
Insn
;
import
jadx.core.dex.instructions.ConstClass
Node
;
import
jadx.core.dex.instructions.ConstString
Node
;
import
jadx.core.dex.instructions.IndexInsnNode
;
import
jadx.core.dex.instructions.InsnType
;
import
jadx.core.dex.instructions.InvokeNode
;
...
...
@@ -104,10 +104,10 @@ public class ModVisitor extends AbstractVisitor {
ClassNode
parentClass
=
mth
.
getParentClass
();
FieldNode
f
=
null
;
if
(
insn
.
getType
()
==
InsnType
.
CONST_STR
)
{
String
s
=
((
ConstString
Insn
)
insn
).
getString
();
String
s
=
((
ConstString
Node
)
insn
).
getString
();
f
=
parentClass
.
getConstField
(
s
);
}
else
if
(
insn
.
getType
()
==
InsnType
.
CONST_CLASS
)
{
ArgType
t
=
((
ConstClass
Insn
)
insn
).
getClsType
();
ArgType
t
=
((
ConstClass
Node
)
insn
).
getClsType
();
f
=
parentClass
.
getConstField
(
t
);
}
else
{
LiteralArg
arg
=
(
LiteralArg
)
insn
.
getArg
(
0
);
...
...
jadx-samples/build.gradle
浏览文件 @
6bc2d332
...
...
@@ -40,10 +40,10 @@ task samplesJadxRun(type: JavaExec, dependsOn: samplesJadxCompile) {
main
=
mainSamplesClass
}
task
samples
(
dependsOn:
samplesJadxRun
)
{
task
samples
(
dependsOn:
samplesJadxRun
)
{
}
task
cleanGeneratedFiles
(
type:
Delete
)
{
task
cleanGeneratedFiles
(
type:
Delete
)
{
delete
samplesJadxSrcDir
delete
samplesJadxOutDir
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录