Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
keyescgm
jadx
提交
a9bbadd6
J
jadx
项目概览
keyescgm
/
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,发现更多精彩内容 >>
未验证
提交
a9bbadd6
编写于
2月 19, 2022
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add option for deobfuscation map file handle mode (#1351)
上级
2c570681
变更
17
显示空白变更内容
内联
并排
Showing
17 changed file
with
151 addition
and
43 deletion
+151
-43
README.md
README.md
+6
-1
jadx-cli/src/main/java/jadx/cli/JCommanderWrapper.java
jadx-cli/src/main/java/jadx/cli/JCommanderWrapper.java
+1
-1
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
+35
-2
jadx-core/src/main/java/jadx/api/JadxArgs.java
jadx-core/src/main/java/jadx/api/JadxArgs.java
+18
-4
jadx-core/src/main/java/jadx/api/args/DeobfuscationMapFileMode.java
...src/main/java/jadx/api/args/DeobfuscationMapFileMode.java
+32
-0
jadx-core/src/main/java/jadx/core/deobf/DeobfPresets.java
jadx-core/src/main/java/jadx/core/deobf/DeobfPresets.java
+9
-5
jadx-core/src/main/java/jadx/core/deobf/Deobfuscator.java
jadx-core/src/main/java/jadx/core/deobf/Deobfuscator.java
+13
-9
jadx-gui/src/main/java/jadx/gui/settings/JadxProject.java
jadx-gui/src/main/java/jadx/gui/settings/JadxProject.java
+4
-1
jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java
jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java
+13
-4
jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsWindow.java
...i/src/main/java/jadx/gui/settings/JadxSettingsWindow.java
+13
-9
jadx-gui/src/main/java/jadx/gui/settings/data/ProjectData.java
...gui/src/main/java/jadx/gui/settings/data/ProjectData.java
+1
-1
jadx-gui/src/main/resources/i18n/Messages_de_DE.properties
jadx-gui/src/main/resources/i18n/Messages_de_DE.properties
+1
-1
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
+1
-1
jadx-gui/src/main/resources/i18n/Messages_es_ES.properties
jadx-gui/src/main/resources/i18n/Messages_es_ES.properties
+1
-1
jadx-gui/src/main/resources/i18n/Messages_ko_KR.properties
jadx-gui/src/main/resources/i18n/Messages_ko_KR.properties
+1
-1
jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties
jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties
+1
-1
jadx-gui/src/main/resources/i18n/Messages_zh_TW.properties
jadx-gui/src/main/resources/i18n/Messages_zh_TW.properties
+1
-1
未找到文件。
README.md
浏览文件 @
a9bbadd6
...
@@ -96,7 +96,12 @@ options:
...
@@ -96,7 +96,12 @@ options:
--deobf-min - min length of name, renamed if shorter, default: 3
--deobf-min - min length of name, renamed if shorter, default: 3
--deobf-max - max length of name, renamed if longer, default: 64
--deobf-max - max length of name, renamed if longer, default: 64
--deobf-cfg-file - deobfuscation map file, default: same dir and name as input file with '.jobf' extension
--deobf-cfg-file - deobfuscation map file, default: same dir and name as input file with '.jobf' extension
--deobf-rewrite-cfg - force to ignore and overwrite deobfuscation map file
--deobf-cfg-file-mode - set mode for handle deobfuscation map file:
'read' - read if found, don't save (default)
'read-or-save' - read if found, save otherwise (don't overwrite)
'overwrite' - don't read, always save
'ignore' - don't read and don't save
--deobf-rewrite-cfg - set '--deobf-cfg-file-mode' to 'overwrite' (deprecated)
--deobf-use-sourcename - use source file name as class name alias
--deobf-use-sourcename - use source file name as class name alias
--deobf-parse-kotlin-metadata - parse kotlin metadata to class and package names
--deobf-parse-kotlin-metadata - parse kotlin metadata to class and package names
--use-kotlin-methods-for-var-names - use kotlin intrinsic methods to rename variables, values: disable, apply, apply-and-hide, default: apply
--use-kotlin-methods-for-var-names - use kotlin intrinsic methods to rename variables, values: disable, apply, apply-and-hide, default: apply
...
...
jadx-cli/src/main/java/jadx/cli/JCommanderWrapper.java
浏览文件 @
a9bbadd6
...
@@ -94,7 +94,7 @@ public class JCommanderWrapper<T> {
...
@@ -94,7 +94,7 @@ public class JCommanderWrapper<T> {
opt
.
append
(
"- "
).
append
(
description
);
opt
.
append
(
"- "
).
append
(
description
);
}
}
String
defaultValue
=
getDefaultValue
(
args
,
f
,
opt
);
String
defaultValue
=
getDefaultValue
(
args
,
f
,
opt
);
if
(
defaultValue
!=
null
)
{
if
(
defaultValue
!=
null
&&
!
description
.
contains
(
"(default)"
)
)
{
opt
.
append
(
", default: "
).
append
(
defaultValue
);
opt
.
append
(
", default: "
).
append
(
defaultValue
);
}
}
out
.
println
(
opt
);
out
.
println
(
opt
);
...
...
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
浏览文件 @
a9bbadd6
...
@@ -16,6 +16,7 @@ import jadx.api.JadxArgs;
...
@@ -16,6 +16,7 @@ import jadx.api.JadxArgs;
import
jadx.api.JadxArgs.RenameEnum
;
import
jadx.api.JadxArgs.RenameEnum
;
import
jadx.api.JadxArgs.UseKotlinMethodsForVarNames
;
import
jadx.api.JadxArgs.UseKotlinMethodsForVarNames
;
import
jadx.api.JadxDecompiler
;
import
jadx.api.JadxDecompiler
;
import
jadx.api.args.DeobfuscationMapFileMode
;
import
jadx.core.utils.exceptions.JadxException
;
import
jadx.core.utils.exceptions.JadxException
;
import
jadx.core.utils.files.FileUtils
;
import
jadx.core.utils.files.FileUtils
;
...
@@ -93,7 +94,18 @@ public class JadxCLIArgs {
...
@@ -93,7 +94,18 @@ public class JadxCLIArgs {
)
)
protected
String
deobfuscationMapFile
;
protected
String
deobfuscationMapFile
;
@Parameter
(
names
=
{
"--deobf-rewrite-cfg"
},
description
=
"force to ignore and overwrite deobfuscation map file"
)
@Parameter
(
names
=
{
"--deobf-cfg-file-mode"
},
description
=
"set mode for handle deobfuscation map file:"
+
"\n 'read' - read if found, don't save (default)"
+
"\n 'read-or-save' - read if found, save otherwise (don't overwrite)"
+
"\n 'overwrite' - don't read, always save"
+
"\n 'ignore' - don't read and don't save"
,
converter
=
DeobfuscationMapFileModeConverter
.
class
)
protected
DeobfuscationMapFileMode
deobfuscationMapFileMode
=
DeobfuscationMapFileMode
.
READ
;
@Parameter
(
names
=
{
"--deobf-rewrite-cfg"
},
description
=
"set '--deobf-cfg-file-mode' to 'overwrite' (deprecated)"
)
protected
boolean
deobfuscationForceSave
=
false
;
protected
boolean
deobfuscationForceSave
=
false
;
@Parameter
(
names
=
{
"--deobf-use-sourcename"
},
description
=
"use source file name as class name alias"
)
@Parameter
(
names
=
{
"--deobf-use-sourcename"
},
description
=
"use source file name as class name alias"
)
...
@@ -226,7 +238,11 @@ public class JadxCLIArgs {
...
@@ -226,7 +238,11 @@ public class JadxCLIArgs {
args
.
setReplaceConsts
(
replaceConsts
);
args
.
setReplaceConsts
(
replaceConsts
);
args
.
setDeobfuscationOn
(
deobfuscationOn
);
args
.
setDeobfuscationOn
(
deobfuscationOn
);
args
.
setDeobfuscationMapFile
(
FileUtils
.
toFile
(
deobfuscationMapFile
));
args
.
setDeobfuscationMapFile
(
FileUtils
.
toFile
(
deobfuscationMapFile
));
args
.
setDeobfuscationForceSave
(
deobfuscationForceSave
);
if
(
deobfuscationForceSave
)
{
args
.
setDeobfuscationMapFileMode
(
DeobfuscationMapFileMode
.
OVERWRITE
);
}
else
{
args
.
setDeobfuscationMapFileMode
(
deobfuscationMapFileMode
);
}
args
.
setDeobfuscationMinLength
(
deobfuscationMinLength
);
args
.
setDeobfuscationMinLength
(
deobfuscationMinLength
);
args
.
setDeobfuscationMaxLength
(
deobfuscationMaxLength
);
args
.
setDeobfuscationMaxLength
(
deobfuscationMaxLength
);
args
.
setUseSourceNameAsClassAlias
(
deobfuscationUseSourceNameAsAlias
);
args
.
setUseSourceNameAsClassAlias
(
deobfuscationUseSourceNameAsAlias
);
...
@@ -323,6 +339,10 @@ public class JadxCLIArgs {
...
@@ -323,6 +339,10 @@ public class JadxCLIArgs {
return
deobfuscationMapFile
;
return
deobfuscationMapFile
;
}
}
public
DeobfuscationMapFileMode
getDeobfuscationMapFileMode
()
{
return
deobfuscationMapFileMode
;
}
public
boolean
isDeobfuscationForceSave
()
{
public
boolean
isDeobfuscationForceSave
()
{
return
deobfuscationForceSave
;
return
deobfuscationForceSave
;
}
}
...
@@ -438,6 +458,19 @@ public class JadxCLIArgs {
...
@@ -438,6 +458,19 @@ public class JadxCLIArgs {
}
}
}
}
public
static
class
DeobfuscationMapFileModeConverter
implements
IStringConverter
<
DeobfuscationMapFileMode
>
{
@Override
public
DeobfuscationMapFileMode
convert
(
String
value
)
{
try
{
return
DeobfuscationMapFileMode
.
valueOf
(
value
.
toUpperCase
());
}
catch
(
Exception
e
)
{
throw
new
IllegalArgumentException
(
'\''
+
value
+
"' is unknown, possible values are: "
+
JadxCLIArgs
.
enumValuesString
(
DeobfuscationMapFileMode
.
values
()));
}
}
}
public
static
String
enumValuesString
(
Enum
<?>[]
values
)
{
public
static
String
enumValuesString
(
Enum
<?>[]
values
)
{
return
Stream
.
of
(
values
)
return
Stream
.
of
(
values
)
.
map
(
v
->
v
.
name
().
replace
(
'_'
,
'-'
).
toLowerCase
(
Locale
.
ROOT
))
.
map
(
v
->
v
.
name
().
replace
(
'_'
,
'-'
).
toLowerCase
(
Locale
.
ROOT
))
...
...
jadx-core/src/main/java/jadx/api/JadxArgs.java
浏览文件 @
a9bbadd6
...
@@ -9,6 +9,7 @@ import java.util.Set;
...
@@ -9,6 +9,7 @@ import java.util.Set;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.function.Predicate
;
import
java.util.function.Predicate
;
import
jadx.api.args.DeobfuscationMapFileMode
;
import
jadx.api.data.ICodeData
;
import
jadx.api.data.ICodeData
;
import
jadx.api.impl.AnnotatedCodeWriter
;
import
jadx.api.impl.AnnotatedCodeWriter
;
import
jadx.api.impl.InMemoryCodeCache
;
import
jadx.api.impl.InMemoryCodeCache
;
...
@@ -54,11 +55,12 @@ public class JadxArgs {
...
@@ -54,11 +55,12 @@ public class JadxArgs {
private
Predicate
<
String
>
classFilter
=
null
;
private
Predicate
<
String
>
classFilter
=
null
;
private
boolean
deobfuscationOn
=
false
;
private
boolean
deobfuscationOn
=
false
;
private
boolean
deobfuscationForceSave
=
false
;
private
boolean
useSourceNameAsClassAlias
=
false
;
private
boolean
useSourceNameAsClassAlias
=
false
;
private
boolean
parseKotlinMetadata
=
false
;
private
boolean
parseKotlinMetadata
=
false
;
private
File
deobfuscationMapFile
=
null
;
private
File
deobfuscationMapFile
=
null
;
private
DeobfuscationMapFileMode
deobfuscationMapFileMode
=
DeobfuscationMapFileMode
.
READ
;
private
int
deobfuscationMinLength
=
0
;
private
int
deobfuscationMinLength
=
0
;
private
int
deobfuscationMaxLength
=
Integer
.
MAX_VALUE
;
private
int
deobfuscationMaxLength
=
Integer
.
MAX_VALUE
;
...
@@ -264,12 +266,24 @@ public class JadxArgs {
...
@@ -264,12 +266,24 @@ public class JadxArgs {
this
.
deobfuscationOn
=
deobfuscationOn
;
this
.
deobfuscationOn
=
deobfuscationOn
;
}
}
@Deprecated
public
boolean
isDeobfuscationForceSave
()
{
public
boolean
isDeobfuscationForceSave
()
{
return
deobfuscation
ForceSave
;
return
deobfuscation
MapFileMode
==
DeobfuscationMapFileMode
.
OVERWRITE
;
}
}
@Deprecated
public
void
setDeobfuscationForceSave
(
boolean
deobfuscationForceSave
)
{
public
void
setDeobfuscationForceSave
(
boolean
deobfuscationForceSave
)
{
this
.
deobfuscationForceSave
=
deobfuscationForceSave
;
if
(
deobfuscationForceSave
)
{
this
.
deobfuscationMapFileMode
=
DeobfuscationMapFileMode
.
OVERWRITE
;
}
}
public
DeobfuscationMapFileMode
getDeobfuscationMapFileMode
()
{
return
deobfuscationMapFileMode
;
}
public
void
setDeobfuscationMapFileMode
(
DeobfuscationMapFileMode
deobfuscationMapFileMode
)
{
this
.
deobfuscationMapFileMode
=
deobfuscationMapFileMode
;
}
}
public
boolean
isUseSourceNameAsClassAlias
()
{
public
boolean
isUseSourceNameAsClassAlias
()
{
...
@@ -476,7 +490,7 @@ public class JadxArgs {
...
@@ -476,7 +490,7 @@ public class JadxArgs {
+
", skipSources="
+
skipSources
+
", skipSources="
+
skipSources
+
", deobfuscationOn="
+
deobfuscationOn
+
", deobfuscationOn="
+
deobfuscationOn
+
", deobfuscationMapFile="
+
deobfuscationMapFile
+
", deobfuscationMapFile="
+
deobfuscationMapFile
+
", deobfuscation
ForceSave="
+
deobfuscationForceSav
e
+
", deobfuscation
MapFileMode="
+
deobfuscationMapFileMod
e
+
", useSourceNameAsClassAlias="
+
useSourceNameAsClassAlias
+
", useSourceNameAsClassAlias="
+
useSourceNameAsClassAlias
+
", parseKotlinMetadata="
+
parseKotlinMetadata
+
", parseKotlinMetadata="
+
parseKotlinMetadata
+
", useKotlinMethodsForVarNames="
+
useKotlinMethodsForVarNames
+
", useKotlinMethodsForVarNames="
+
useKotlinMethodsForVarNames
...
...
jadx-core/src/main/java/jadx/api/args/DeobfuscationMapFileMode.java
0 → 100644
浏览文件 @
a9bbadd6
package
jadx.api.args
;
public
enum
DeobfuscationMapFileMode
{
/**
* Load if found, don't save (default)
*/
READ
,
/**
* Load if found, save only if new (don't overwrite)
*/
READ_OR_SAVE
,
/**
* Don't load, always save
*/
OVERWRITE
,
/**
* Don't load and don't save
*/
IGNORE
;
public
boolean
shouldRead
()
{
return
this
==
READ
||
this
==
READ_OR_SAVE
;
}
public
boolean
shouldWrite
()
{
return
this
==
READ_OR_SAVE
||
this
==
OVERWRITE
;
}
}
jadx-core/src/main/java/jadx/core/deobf/DeobfPresets.java
浏览文件 @
a9bbadd6
...
@@ -17,6 +17,7 @@ import org.slf4j.Logger;
...
@@ -17,6 +17,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
jadx.api.JadxArgs
;
import
jadx.api.JadxArgs
;
import
jadx.api.args.DeobfuscationMapFileMode
;
import
jadx.core.dex.info.ClassInfo
;
import
jadx.core.dex.info.ClassInfo
;
import
jadx.core.dex.info.FieldInfo
;
import
jadx.core.dex.info.FieldInfo
;
import
jadx.core.dex.info.MethodInfo
;
import
jadx.core.dex.info.MethodInfo
;
...
@@ -50,6 +51,9 @@ public class DeobfPresets {
...
@@ -50,6 +51,9 @@ public class DeobfPresets {
@Nullable
@Nullable
private
static
Path
getPathDeobfMapPath
(
RootNode
root
)
{
private
static
Path
getPathDeobfMapPath
(
RootNode
root
)
{
JadxArgs
jadxArgs
=
root
.
getArgs
();
JadxArgs
jadxArgs
=
root
.
getArgs
();
if
(
jadxArgs
.
getDeobfuscationMapFileMode
()
==
DeobfuscationMapFileMode
.
IGNORE
)
{
return
null
;
}
File
deobfMapFile
=
jadxArgs
.
getDeobfuscationMapFile
();
File
deobfMapFile
=
jadxArgs
.
getDeobfuscationMapFile
();
if
(
deobfMapFile
!=
null
)
{
if
(
deobfMapFile
!=
null
)
{
return
deobfMapFile
.
toPath
();
return
deobfMapFile
.
toPath
();
...
@@ -70,9 +74,9 @@ public class DeobfPresets {
...
@@ -70,9 +74,9 @@ public class DeobfPresets {
/**
/**
* Loads deobfuscator presets
* Loads deobfuscator presets
*/
*/
public
void
load
()
{
public
boolean
load
()
{
if
(!
Files
.
exists
(
deobfMapFile
))
{
if
(!
Files
.
exists
(
deobfMapFile
))
{
return
;
return
false
;
}
}
LOG
.
info
(
"Loading obfuscation map from: {}"
,
deobfMapFile
.
toAbsolutePath
());
LOG
.
info
(
"Loading obfuscation map from: {}"
,
deobfMapFile
.
toAbsolutePath
());
try
{
try
{
...
@@ -106,8 +110,10 @@ public class DeobfPresets {
...
@@ -106,8 +110,10 @@ public class DeobfPresets {
break
;
break
;
}
}
}
}
return
true
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Failed to load deobfuscation map file '{}'"
,
deobfMapFile
.
toAbsolutePath
(),
e
);
LOG
.
error
(
"Failed to load deobfuscation map file '{}'"
,
deobfMapFile
.
toAbsolutePath
(),
e
);
return
false
;
}
}
}
}
...
@@ -142,9 +148,7 @@ public class DeobfPresets {
...
@@ -142,9 +148,7 @@ public class DeobfPresets {
}
}
Files
.
write
(
deobfMapFile
,
list
,
MAP_FILE_CHARSET
,
Files
.
write
(
deobfMapFile
,
list
,
MAP_FILE_CHARSET
,
StandardOpenOption
.
WRITE
,
StandardOpenOption
.
CREATE
,
StandardOpenOption
.
TRUNCATE_EXISTING
);
StandardOpenOption
.
WRITE
,
StandardOpenOption
.
CREATE
,
StandardOpenOption
.
TRUNCATE_EXISTING
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
info
(
"Deobfuscation map file saved as: {}"
,
deobfMapFile
);
LOG
.
debug
(
"Deobfuscation map file saved as: {}"
,
deobfMapFile
);
}
}
}
public
String
getForCls
(
ClassInfo
cls
)
{
public
String
getForCls
(
ClassInfo
cls
)
{
...
...
jadx-core/src/main/java/jadx/core/deobf/Deobfuscator.java
浏览文件 @
a9bbadd6
...
@@ -16,6 +16,7 @@ import org.slf4j.Logger;
...
@@ -16,6 +16,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
jadx.api.JadxArgs
;
import
jadx.api.JadxArgs
;
import
jadx.api.args.DeobfuscationMapFileMode
;
import
jadx.api.plugins.input.data.attributes.JadxAttrType
;
import
jadx.api.plugins.input.data.attributes.JadxAttrType
;
import
jadx.api.plugins.input.data.attributes.types.SourceFileAttr
;
import
jadx.api.plugins.input.data.attributes.types.SourceFileAttr
;
import
jadx.core.dex.attributes.AFlag
;
import
jadx.core.dex.attributes.AFlag
;
...
@@ -76,22 +77,25 @@ public class Deobfuscator {
...
@@ -76,22 +77,25 @@ public class Deobfuscator {
}
}
public
void
execute
()
{
public
void
execute
()
{
if
(
!
args
.
isDeobfuscationForceSave
())
{
if
(
args
.
getDeobfuscationMapFileMode
().
shouldRead
())
{
deobfPresets
.
load
();
if
(
deobfPresets
.
load
())
{
for
(
Map
.
Entry
<
String
,
String
>
pkgEntry
:
deobfPresets
.
getPkgPresetMap
().
entrySet
())
{
for
(
Map
.
Entry
<
String
,
String
>
pkgEntry
:
deobfPresets
.
getPkgPresetMap
().
entrySet
())
{
addPackagePreset
(
pkgEntry
.
getKey
(),
pkgEntry
.
getValue
());
addPackagePreset
(
pkgEntry
.
getKey
(),
pkgEntry
.
getValue
());
}
}
deobfPresets
.
getPkgPresetMap
().
clear
();
// not needed anymore
deobfPresets
.
getPkgPresetMap
().
clear
();
// not needed anymore
initIndexes
();
initIndexes
();
}
}
}
process
();
process
();
}
}
public
void
savePresets
()
{
public
void
savePresets
()
{
DeobfuscationMapFileMode
mode
=
args
.
getDeobfuscationMapFileMode
();
if
(!
mode
.
shouldWrite
())
{
return
;
}
Path
deobfMapFile
=
deobfPresets
.
getDeobfMapFile
();
Path
deobfMapFile
=
deobfPresets
.
getDeobfMapFile
();
if
(
Files
.
exists
(
deobfMapFile
)
&&
!
args
.
isDeobfuscationForceSave
())
{
if
(
mode
==
DeobfuscationMapFileMode
.
READ_OR_SAVE
&&
Files
.
exists
(
deobfMapFile
))
{
LOG
.
info
(
"Deobfuscation map file '{}' exists. Use command line option '--deobf-rewrite-cfg' to rewrite it"
,
deobfMapFile
.
toAbsolutePath
());
return
;
return
;
}
}
try
{
try
{
...
...
jadx-gui/src/main/java/jadx/gui/settings/JadxProject.java
浏览文件 @
a9bbadd6
...
@@ -210,7 +210,10 @@ public class JadxProject {
...
@@ -210,7 +210,10 @@ public class JadxProject {
private
void
upgrade
()
{
private
void
upgrade
()
{
int
fromVersion
=
data
.
getProjectVersion
();
int
fromVersion
=
data
.
getProjectVersion
();
LOG
.
debug
(
"upgrade settings from version: {} to {}"
,
fromVersion
,
CURRENT_PROJECT_VERSION
);
if
(
fromVersion
==
CURRENT_PROJECT_VERSION
)
{
return
;
}
LOG
.
debug
(
"upgrade project settings from version: {} to {}"
,
fromVersion
,
CURRENT_PROJECT_VERSION
);
if
(
fromVersion
==
0
)
{
if
(
fromVersion
==
0
)
{
fromVersion
++;
fromVersion
++;
}
}
...
...
jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java
浏览文件 @
a9bbadd6
...
@@ -28,6 +28,7 @@ import com.beust.jcommander.Parameter;
...
@@ -28,6 +28,7 @@ import com.beust.jcommander.Parameter;
import
jadx.api.CommentsLevel
;
import
jadx.api.CommentsLevel
;
import
jadx.api.JadxArgs
;
import
jadx.api.JadxArgs
;
import
jadx.api.args.DeobfuscationMapFileMode
;
import
jadx.cli.JadxCLIArgs
;
import
jadx.cli.JadxCLIArgs
;
import
jadx.cli.LogHelper
;
import
jadx.cli.LogHelper
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
...
@@ -43,7 +44,7 @@ public class JadxSettings extends JadxCLIArgs {
...
@@ -43,7 +44,7 @@ public class JadxSettings extends JadxCLIArgs {
private
static
final
Path
USER_HOME
=
Paths
.
get
(
System
.
getProperty
(
"user.home"
));
private
static
final
Path
USER_HOME
=
Paths
.
get
(
System
.
getProperty
(
"user.home"
));
private
static
final
int
RECENT_PROJECTS_COUNT
=
15
;
private
static
final
int
RECENT_PROJECTS_COUNT
=
15
;
private
static
final
int
CURRENT_SETTINGS_VERSION
=
1
5
;
private
static
final
int
CURRENT_SETTINGS_VERSION
=
1
6
;
private
static
final
Font
DEFAULT_FONT
=
new
RSyntaxTextArea
().
getFont
();
private
static
final
Font
DEFAULT_FONT
=
new
RSyntaxTextArea
().
getFont
();
...
@@ -326,8 +327,8 @@ public class JadxSettings extends JadxCLIArgs {
...
@@ -326,8 +327,8 @@ public class JadxSettings extends JadxCLIArgs {
this
.
deobfuscationMaxLength
=
deobfuscationMaxLength
;
this
.
deobfuscationMaxLength
=
deobfuscationMaxLength
;
}
}
public
void
setDeobfuscation
ForceSave
(
boolean
deobfuscationForceSav
e
)
{
public
void
setDeobfuscation
MapFileMode
(
DeobfuscationMapFileMode
mod
e
)
{
this
.
deobfuscation
ForceSave
=
deobfuscationForceSav
e
;
this
.
deobfuscation
MapFileMode
=
mod
e
;
}
}
public
void
setDeobfuscationUseSourceNameAsAlias
(
boolean
deobfuscationUseSourceNameAsAlias
)
{
public
void
setDeobfuscationUseSourceNameAsAlias
(
boolean
deobfuscationUseSourceNameAsAlias
)
{
...
@@ -588,7 +589,7 @@ public class JadxSettings extends JadxCLIArgs {
...
@@ -588,7 +589,7 @@ public class JadxSettings extends JadxCLIArgs {
setDeobfuscationMaxLength
(
64
);
setDeobfuscationMaxLength
(
64
);
setDeobfuscationUseSourceNameAsAlias
(
true
);
setDeobfuscationUseSourceNameAsAlias
(
true
);
setDeobfuscationParseKotlinMetadata
(
true
);
setDeobfuscationParseKotlinMetadata
(
true
);
setDeobfuscation
ForceSave
(
false
);
setDeobfuscation
MapFileMode
(
DeobfuscationMapFileMode
.
READ
);
setThreadsCount
(
JadxArgs
.
DEFAULT_THREADS_COUNT
);
setThreadsCount
(
JadxArgs
.
DEFAULT_THREADS_COUNT
);
setReplaceConsts
(
true
);
setReplaceConsts
(
true
);
setSkipResources
(
false
);
setSkipResources
(
false
);
...
@@ -659,6 +660,14 @@ public class JadxSettings extends JadxCLIArgs {
...
@@ -659,6 +660,14 @@ public class JadxSettings extends JadxCLIArgs {
useKotlinMethodsForVarNames
=
JadxArgs
.
UseKotlinMethodsForVarNames
.
APPLY
;
useKotlinMethodsForVarNames
=
JadxArgs
.
UseKotlinMethodsForVarNames
.
APPLY
;
fromVersion
++;
fromVersion
++;
}
}
if
(
fromVersion
==
15
)
{
if
(
deobfuscationForceSave
)
{
deobfuscationMapFileMode
=
DeobfuscationMapFileMode
.
OVERWRITE
;
}
else
{
deobfuscationMapFileMode
=
DeobfuscationMapFileMode
.
READ
;
}
fromVersion
++;
}
if
(
fromVersion
!=
CURRENT_SETTINGS_VERSION
)
{
if
(
fromVersion
!=
CURRENT_SETTINGS_VERSION
)
{
throw
new
JadxRuntimeException
(
"Incorrect settings upgrade"
);
throw
new
JadxRuntimeException
(
"Incorrect settings upgrade"
);
}
}
...
...
jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsWindow.java
浏览文件 @
a9bbadd6
...
@@ -61,6 +61,7 @@ import say.swing.JFontChooser;
...
@@ -61,6 +61,7 @@ import say.swing.JFontChooser;
import
jadx.api.CommentsLevel
;
import
jadx.api.CommentsLevel
;
import
jadx.api.JadxArgs
;
import
jadx.api.JadxArgs
;
import
jadx.api.JadxArgs.UseKotlinMethodsForVarNames
;
import
jadx.api.JadxArgs.UseKotlinMethodsForVarNames
;
import
jadx.api.args.DeobfuscationMapFileMode
;
import
jadx.gui.ui.MainWindow
;
import
jadx.gui.ui.MainWindow
;
import
jadx.gui.ui.codearea.EditorTheme
;
import
jadx.gui.ui.codearea.EditorTheme
;
import
jadx.gui.utils.FontUtils
;
import
jadx.gui.utils.FontUtils
;
...
@@ -232,13 +233,6 @@ public class JadxSettingsWindow extends JDialog {
...
@@ -232,13 +233,6 @@ public class JadxSettingsWindow extends JDialog {
needReload
();
needReload
();
});
});
JCheckBox
deobfForce
=
new
JCheckBox
();
deobfForce
.
setSelected
(
settings
.
isDeobfuscationForceSave
());
deobfForce
.
addItemListener
(
e
->
{
settings
.
setDeobfuscationForceSave
(
e
.
getStateChange
()
==
ItemEvent
.
SELECTED
);
needReload
();
});
SpinnerNumberModel
minLenModel
=
new
SpinnerNumberModel
(
settings
.
getDeobfuscationMinLength
(),
0
,
Integer
.
MAX_VALUE
,
1
);
SpinnerNumberModel
minLenModel
=
new
SpinnerNumberModel
(
settings
.
getDeobfuscationMinLength
(),
0
,
Integer
.
MAX_VALUE
,
1
);
JSpinner
minLenSpinner
=
new
JSpinner
(
minLenModel
);
JSpinner
minLenSpinner
=
new
JSpinner
(
minLenModel
);
minLenSpinner
.
addChangeListener
(
e
->
{
minLenSpinner
.
addChangeListener
(
e
->
{
...
@@ -267,17 +261,27 @@ public class JadxSettingsWindow extends JDialog {
...
@@ -267,17 +261,27 @@ public class JadxSettingsWindow extends JDialog {
needReload
();
needReload
();
});
});
JComboBox
<
DeobfuscationMapFileMode
>
deobfMapFileModeCB
=
new
JComboBox
<>(
DeobfuscationMapFileMode
.
values
());
deobfMapFileModeCB
.
setSelectedItem
(
settings
.
getDeobfuscationMapFileMode
());
deobfMapFileModeCB
.
addActionListener
(
e
->
{
DeobfuscationMapFileMode
newValue
=
(
DeobfuscationMapFileMode
)
deobfMapFileModeCB
.
getSelectedItem
();
if
(
newValue
!=
settings
.
getDeobfuscationMapFileMode
())
{
settings
.
setDeobfuscationMapFileMode
(
newValue
);
needReload
();
}
});
SettingsGroup
deobfGroup
=
new
SettingsGroup
(
NLS
.
str
(
"preferences.deobfuscation"
));
SettingsGroup
deobfGroup
=
new
SettingsGroup
(
NLS
.
str
(
"preferences.deobfuscation"
));
deobfGroup
.
addRow
(
NLS
.
str
(
"preferences.deobfuscation_on"
),
deobfOn
);
deobfGroup
.
addRow
(
NLS
.
str
(
"preferences.deobfuscation_on"
),
deobfOn
);
deobfGroup
.
addRow
(
NLS
.
str
(
"preferences.deobfuscation_force"
),
deobfForce
);
deobfGroup
.
addRow
(
NLS
.
str
(
"preferences.deobfuscation_min_len"
),
minLenSpinner
);
deobfGroup
.
addRow
(
NLS
.
str
(
"preferences.deobfuscation_min_len"
),
minLenSpinner
);
deobfGroup
.
addRow
(
NLS
.
str
(
"preferences.deobfuscation_max_len"
),
maxLenSpinner
);
deobfGroup
.
addRow
(
NLS
.
str
(
"preferences.deobfuscation_max_len"
),
maxLenSpinner
);
deobfGroup
.
addRow
(
NLS
.
str
(
"preferences.deobfuscation_source_alias"
),
deobfSourceAlias
);
deobfGroup
.
addRow
(
NLS
.
str
(
"preferences.deobfuscation_source_alias"
),
deobfSourceAlias
);
deobfGroup
.
addRow
(
NLS
.
str
(
"preferences.deobfuscation_kotlin_metadata"
),
deobfKotlinMetadata
);
deobfGroup
.
addRow
(
NLS
.
str
(
"preferences.deobfuscation_kotlin_metadata"
),
deobfKotlinMetadata
);
deobfGroup
.
addRow
(
NLS
.
str
(
"preferences.deobfuscation_map_file_mode"
),
deobfMapFileModeCB
);
deobfGroup
.
end
();
deobfGroup
.
end
();
Collection
<
JComponent
>
connectedComponents
=
Collection
<
JComponent
>
connectedComponents
=
Arrays
.
asList
(
deobfForce
,
minLenSpinner
,
maxLenSpinner
,
deobfSourceAlias
,
deobfKotlinMetadata
);
Arrays
.
asList
(
minLenSpinner
,
maxLenSpinner
,
deobfSourceAlias
,
deobfKotlinMetadata
);
deobfOn
.
addItemListener
(
e
->
enableComponentList
(
connectedComponents
,
e
.
getStateChange
()
==
ItemEvent
.
SELECTED
));
deobfOn
.
addItemListener
(
e
->
enableComponentList
(
connectedComponents
,
e
.
getStateChange
()
==
ItemEvent
.
SELECTED
));
enableComponentList
(
connectedComponents
,
settings
.
isDeobfuscationOn
());
enableComponentList
(
connectedComponents
,
settings
.
isDeobfuscationOn
());
return
deobfGroup
;
return
deobfGroup
;
...
...
jadx-gui/src/main/java/jadx/gui/settings/data/ProjectData.java
浏览文件 @
a9bbadd6
...
@@ -9,7 +9,7 @@ import jadx.api.data.impl.JadxCodeData;
...
@@ -9,7 +9,7 @@ import jadx.api.data.impl.JadxCodeData;
public
class
ProjectData
{
public
class
ProjectData
{
private
int
projectVersion
;
private
int
projectVersion
=
1
;
private
List
<
Path
>
files
;
private
List
<
Path
>
files
;
private
List
<
String
[]>
treeExpansions
=
new
ArrayList
<>();
private
List
<
String
[]>
treeExpansions
=
new
ArrayList
<>();
private
JadxCodeData
codeData
=
new
JadxCodeData
();
private
JadxCodeData
codeData
=
new
JadxCodeData
();
...
...
jadx-gui/src/main/resources/i18n/Messages_de_DE.properties
浏览文件 @
a9bbadd6
...
@@ -153,7 +153,7 @@ preferences.start_jobs=Autom. Hintergrunddekompilierung starten
...
@@ -153,7 +153,7 @@ preferences.start_jobs=Autom. Hintergrunddekompilierung starten
preferences.select_font
=
Ändern
preferences.select_font
=
Ändern
preferences.select_smali_font
=
Ändern
preferences.select_smali_font
=
Ändern
preferences.deobfuscation_on
=
Deobfuskierung aktivieren
preferences.deobfuscation_on
=
Deobfuskierung aktivieren
preferences.deobfuscation_force
=
Überschreiben der Deobfuskierungs-Map-Datei erzwingen
#preferences.deobfuscation_map_file_mode=Map file handle mode
preferences.deobfuscation_min_len
=
Minimale Namenlänge
preferences.deobfuscation_min_len
=
Minimale Namenlänge
preferences.deobfuscation_max_len
=
Maximale Namenlänge
preferences.deobfuscation_max_len
=
Maximale Namenlänge
preferences.deobfuscation_source_alias
=
Quelldateiname als Klassennamen-Alias verwenden
preferences.deobfuscation_source_alias
=
Quelldateiname als Klassennamen-Alias verwenden
...
...
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
浏览文件 @
a9bbadd6
...
@@ -153,7 +153,7 @@ preferences.start_jobs=Auto start background decompilation
...
@@ -153,7 +153,7 @@ preferences.start_jobs=Auto start background decompilation
preferences.select_font
=
Change
preferences.select_font
=
Change
preferences.select_smali_font
=
Change
preferences.select_smali_font
=
Change
preferences.deobfuscation_on
=
Enable deobfuscation
preferences.deobfuscation_on
=
Enable deobfuscation
preferences.deobfuscation_
force
=
Force rewrite deobfuscation map fil
e
preferences.deobfuscation_
map_file_mode
=
Map file handle mod
e
preferences.deobfuscation_min_len
=
Minimum name length
preferences.deobfuscation_min_len
=
Minimum name length
preferences.deobfuscation_max_len
=
Maximum name length
preferences.deobfuscation_max_len
=
Maximum name length
preferences.deobfuscation_source_alias
=
Use source file name as class name alias
preferences.deobfuscation_source_alias
=
Use source file name as class name alias
...
...
jadx-gui/src/main/resources/i18n/Messages_es_ES.properties
浏览文件 @
a9bbadd6
...
@@ -153,7 +153,7 @@ preferences.start_jobs=Inicio autom. descompilación de fondo
...
@@ -153,7 +153,7 @@ preferences.start_jobs=Inicio autom. descompilación de fondo
preferences.select_font
=
Seleccionar
preferences.select_font
=
Seleccionar
#preferences.select_smali_font=
#preferences.select_smali_font=
preferences.deobfuscation_on
=
Activar desobfuscación
preferences.deobfuscation_on
=
Activar desobfuscación
preferences.deobfuscation_force
=
Forzar reescritura del fichero de ofuscación
#preferences.deobfuscation_map_file_mode=Map file handle mode
preferences.deobfuscation_min_len
=
Longitud mínima del nombre
preferences.deobfuscation_min_len
=
Longitud mínima del nombre
preferences.deobfuscation_max_len
=
Longitud máxima del nombre
preferences.deobfuscation_max_len
=
Longitud máxima del nombre
preferences.deobfuscation_source_alias
=
Usar el nombre del source como alias para la clase
preferences.deobfuscation_source_alias
=
Usar el nombre del source como alias para la clase
...
...
jadx-gui/src/main/resources/i18n/Messages_ko_KR.properties
浏览文件 @
a9bbadd6
...
@@ -153,7 +153,7 @@ preferences.start_jobs=백그라운드에서 디컴파일 자동 시작
...
@@ -153,7 +153,7 @@ preferences.start_jobs=백그라운드에서 디컴파일 자동 시작
preferences.select_font
=
변경
preferences.select_font
=
변경
preferences.select_smali_font
=
변경
preferences.select_smali_font
=
변경
preferences.deobfuscation_on
=
난독 해제 활성화
preferences.deobfuscation_on
=
난독 해제 활성화
preferences.deobfuscation_force
=
난독 해제 맵 파일 다시 쓰기
#preferences.deobfuscation_map_file_mode=Map file handle mode
preferences.deobfuscation_min_len
=
최소 이름 길이
preferences.deobfuscation_min_len
=
최소 이름 길이
preferences.deobfuscation_max_len
=
최대 이름 길이
preferences.deobfuscation_max_len
=
최대 이름 길이
preferences.deobfuscation_source_alias
=
소스 파일 이름을 클래스 이름 별칭으로 사용
preferences.deobfuscation_source_alias
=
소스 파일 이름을 클래스 이름 별칭으로 사용
...
...
jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties
浏览文件 @
a9bbadd6
...
@@ -153,7 +153,7 @@ preferences.start_jobs=自动进行后台反编译
...
@@ -153,7 +153,7 @@ preferences.start_jobs=自动进行后台反编译
preferences.select_font
=
修改
preferences.select_font
=
修改
preferences.select_smali_font
=
修改
preferences.select_smali_font
=
修改
preferences.deobfuscation_on
=
启用反混淆
preferences.deobfuscation_on
=
启用反混淆
preferences.deobfuscation_force
=
强制覆盖反混淆映射文件
#preferences.deobfuscation_map_file_mode=Map file handle mode
preferences.deobfuscation_min_len
=
最小命名长度
preferences.deobfuscation_min_len
=
最小命名长度
preferences.deobfuscation_max_len
=
最大命名长度
preferences.deobfuscation_max_len
=
最大命名长度
preferences.deobfuscation_source_alias
=
使用资源名作为类的别名
preferences.deobfuscation_source_alias
=
使用资源名作为类的别名
...
...
jadx-gui/src/main/resources/i18n/Messages_zh_TW.properties
浏览文件 @
a9bbadd6
...
@@ -153,7 +153,7 @@ preferences.start_jobs=自動開始背景反編譯
...
@@ -153,7 +153,7 @@ preferences.start_jobs=自動開始背景反編譯
preferences.select_font
=
變更
preferences.select_font
=
變更
preferences.select_smali_font
=
變更
preferences.select_smali_font
=
變更
preferences.deobfuscation_on
=
啟用去模糊化
preferences.deobfuscation_on
=
啟用去模糊化
preferences.deobfuscation_force
=
強制覆寫去模糊化對應檔
#preferences.deobfuscation_map_file_mode=Map file handle mode
preferences.deobfuscation_min_len
=
最小名稱長度
preferences.deobfuscation_min_len
=
最小名稱長度
preferences.deobfuscation_max_len
=
最大名稱長度
preferences.deobfuscation_max_len
=
最大名稱長度
preferences.deobfuscation_source_alias
=
將原始檔案名稱作為類別別名
preferences.deobfuscation_source_alias
=
將原始檔案名稱作為類別別名
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录