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
a9251de1
Commit
a9251de1
authored
Aug 19, 2018
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deobf: prevents overlaping of class names and packages (#335)
parent
56798e71
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
Deobfuscator.java
jadx-core/src/main/java/jadx/core/deobf/Deobfuscator.java
+13
-3
No files found.
jadx-core/src/main/java/jadx/core/deobf/Deobfuscator.java
View file @
a9251de1
...
...
@@ -2,7 +2,9 @@ package jadx.core.deobf;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -48,6 +50,7 @@ public class Deobfuscator {
private
final
PackageNode
rootPackage
=
new
PackageNode
(
""
);
private
final
Set
<
String
>
pkgSet
=
new
TreeSet
<>();
private
final
Set
<
String
>
reservedClsNames
=
new
HashSet
<>();
private
final
int
maxLength
;
private
final
int
minLength
;
...
...
@@ -89,6 +92,11 @@ public class Deobfuscator {
private
void
preProcess
()
{
for
(
DexNode
dexNode
:
dexNodes
)
{
for
(
ClassNode
cls
:
dexNode
.
getClasses
())
{
Collections
.
addAll
(
reservedClsNames
,
cls
.
getPackage
().
split
(
"\\."
));
}
}
for
(
DexNode
dexNode
:
dexNodes
)
{
for
(
ClassNode
cls
:
dexNode
.
getClasses
())
{
preProcessClass
(
cls
);
}
}
...
...
@@ -312,9 +320,11 @@ public class Deobfuscator {
if
(
alias
!=
null
)
{
clsMap
.
put
(
classInfo
,
new
DeobfClsInfo
(
this
,
cls
,
pkg
,
alias
));
}
else
{
if
(!
clsMap
.
containsKey
(
classInfo
)
&&
shouldRename
(
classInfo
.
getShortName
()))
{
makeClsAlias
(
cls
);
if
(!
clsMap
.
containsKey
(
classInfo
))
{
String
clsShortName
=
classInfo
.
getShortName
();
if
(
shouldRename
(
clsShortName
)
||
reservedClsNames
.
contains
(
clsShortName
))
{
makeClsAlias
(
cls
);
}
}
}
for
(
ClassNode
innerCls
:
cls
.
getInnerClasses
())
{
...
...
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