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
2ab7524e
Commit
2ab7524e
authored
Sep 08, 2015
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: better args class
parent
d55969bc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
169 additions
and
115 deletions
+169
-115
DefaultJadxArgs.java
jadx-core/src/main/java/jadx/api/DefaultJadxArgs.java
+0
-76
JadxArgs.java
jadx-core/src/main/java/jadx/api/JadxArgs.java
+152
-0
JadxDecompiler.java
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
+2
-2
ConvertToClsSet.java
jadx-core/src/main/java/jadx/core/clsp/ConvertToClsSet.java
+2
-2
IntegrationTest.java
jadx-core/src/test/java/jadx/tests/api/IntegrationTest.java
+11
-33
JadxVisitorsOrderTest.java
...est/java/jadx/tests/functional/JadxVisitorsOrderTest.java
+2
-2
No files found.
jadx-core/src/main/java/jadx/api/DefaultJadxArgs.java
deleted
100644 → 0
View file @
d55969bc
package
jadx
.
api
;
import
java.io.File
;
public
class
DefaultJadxArgs
implements
IJadxArgs
{
@Override
public
File
getOutDir
()
{
return
new
File
(
"jadx-output"
);
}
@Override
public
int
getThreadsCount
()
{
return
Runtime
.
getRuntime
().
availableProcessors
();
}
@Override
public
boolean
isCFGOutput
()
{
return
false
;
}
@Override
public
boolean
isRawCFGOutput
()
{
return
false
;
}
@Override
public
boolean
isFallbackMode
()
{
return
false
;
}
@Override
public
boolean
isShowInconsistentCode
()
{
return
false
;
}
@Override
public
boolean
isVerbose
()
{
return
false
;
}
@Override
public
boolean
isSkipResources
()
{
return
false
;
}
@Override
public
boolean
isSkipSources
()
{
return
false
;
}
@Override
public
boolean
isDeobfuscationOn
()
{
return
false
;
}
@Override
public
int
getDeobfuscationMinLength
()
{
return
Integer
.
MIN_VALUE
+
1
;
}
@Override
public
int
getDeobfuscationMaxLength
()
{
return
Integer
.
MAX_VALUE
-
1
;
}
@Override
public
boolean
isDeobfuscationForceSave
()
{
return
false
;
}
@Override
public
boolean
useSourceNameAsClassAlias
()
{
return
false
;
}
}
jadx-core/src/main/java/jadx/api/JadxArgs.java
0 → 100644
View file @
2ab7524e
package
jadx
.
api
;
import
java.io.File
;
public
class
JadxArgs
implements
IJadxArgs
{
private
File
outDir
=
new
File
(
"jadx-output"
);
private
int
threadsCount
=
Math
.
max
(
1
,
Runtime
.
getRuntime
().
availableProcessors
()
-
1
);
private
boolean
cfgOutput
=
false
;
private
boolean
rawCFGOutput
=
false
;
private
boolean
isVerbose
=
false
;
private
boolean
fallbackMode
=
false
;
private
boolean
showInconsistentCode
=
false
;
private
boolean
isSkipResources
=
false
;
private
boolean
isSkipSources
=
false
;
private
boolean
isDeobfuscationOn
=
false
;
private
boolean
isDeobfuscationForceSave
=
false
;
private
boolean
useSourceNameAsClassAlias
=
false
;
private
int
deobfuscationMinLength
=
0
;
private
int
deobfuscationMaxLength
=
Integer
.
MAX_VALUE
;
@Override
public
File
getOutDir
()
{
return
outDir
;
}
public
void
setOutDir
(
File
outDir
)
{
this
.
outDir
=
outDir
;
}
@Override
public
int
getThreadsCount
()
{
return
threadsCount
;
}
public
void
setThreadsCount
(
int
threadsCount
)
{
this
.
threadsCount
=
threadsCount
;
}
@Override
public
boolean
isCFGOutput
()
{
return
cfgOutput
;
}
public
void
setCfgOutput
(
boolean
cfgOutput
)
{
this
.
cfgOutput
=
cfgOutput
;
}
@Override
public
boolean
isRawCFGOutput
()
{
return
rawCFGOutput
;
}
public
void
setRawCFGOutput
(
boolean
rawCFGOutput
)
{
this
.
rawCFGOutput
=
rawCFGOutput
;
}
@Override
public
boolean
isFallbackMode
()
{
return
fallbackMode
;
}
public
void
setFallbackMode
(
boolean
fallbackMode
)
{
this
.
fallbackMode
=
fallbackMode
;
}
@Override
public
boolean
isShowInconsistentCode
()
{
return
showInconsistentCode
;
}
public
void
setShowInconsistentCode
(
boolean
showInconsistentCode
)
{
this
.
showInconsistentCode
=
showInconsistentCode
;
}
@Override
public
boolean
isVerbose
()
{
return
isVerbose
;
}
public
void
setVerbose
(
boolean
verbose
)
{
isVerbose
=
verbose
;
}
@Override
public
boolean
isSkipResources
()
{
return
isSkipResources
;
}
public
void
setSkipResources
(
boolean
skipResources
)
{
isSkipResources
=
skipResources
;
}
@Override
public
boolean
isSkipSources
()
{
return
isSkipSources
;
}
public
void
setSkipSources
(
boolean
skipSources
)
{
isSkipSources
=
skipSources
;
}
@Override
public
boolean
isDeobfuscationOn
()
{
return
isDeobfuscationOn
;
}
public
void
setDeobfuscationOn
(
boolean
deobfuscationOn
)
{
isDeobfuscationOn
=
deobfuscationOn
;
}
@Override
public
boolean
isDeobfuscationForceSave
()
{
return
isDeobfuscationForceSave
;
}
public
void
setDeobfuscationForceSave
(
boolean
deobfuscationForceSave
)
{
isDeobfuscationForceSave
=
deobfuscationForceSave
;
}
@Override
public
boolean
useSourceNameAsClassAlias
()
{
return
useSourceNameAsClassAlias
;
}
public
void
setUseSourceNameAsClassAlias
(
boolean
useSourceNameAsClassAlias
)
{
this
.
useSourceNameAsClassAlias
=
useSourceNameAsClassAlias
;
}
@Override
public
int
getDeobfuscationMinLength
()
{
return
deobfuscationMinLength
;
}
public
void
setDeobfuscationMinLength
(
int
deobfuscationMinLength
)
{
this
.
deobfuscationMinLength
=
deobfuscationMinLength
;
}
@Override
public
int
getDeobfuscationMaxLength
()
{
return
deobfuscationMaxLength
;
}
public
void
setDeobfuscationMaxLength
(
int
deobfuscationMaxLength
)
{
this
.
deobfuscationMaxLength
=
deobfuscationMaxLength
;
}
}
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
View file @
2ab7524e
...
...
@@ -69,7 +69,7 @@ public final class JadxDecompiler {
private
Map
<
FieldNode
,
JavaField
>
fieldsMap
=
new
HashMap
<
FieldNode
,
JavaField
>();
public
JadxDecompiler
()
{
this
(
new
Default
JadxArgs
());
this
(
new
JadxArgs
());
}
public
JadxDecompiler
(
IJadxArgs
jadxArgs
)
{
...
...
@@ -86,7 +86,7 @@ public final class JadxDecompiler {
void
init
()
{
if
(
outDir
==
null
)
{
outDir
=
new
Default
JadxArgs
().
getOutDir
();
outDir
=
new
JadxArgs
().
getOutDir
();
}
this
.
passes
=
Jadx
.
getPassesList
(
args
,
outDir
);
this
.
codeGen
=
new
CodeGen
(
args
);
...
...
jadx-core/src/main/java/jadx/core/clsp/ConvertToClsSet.java
View file @
2ab7524e
package
jadx
.
core
.
clsp
;
import
jadx.api.
Default
JadxArgs
;
import
jadx.api.JadxArgs
;
import
jadx.core.dex.nodes.RootNode
;
import
jadx.core.utils.exceptions.DecodeException
;
import
jadx.core.utils.files.InputFile
;
...
...
@@ -43,7 +43,7 @@ public class ConvertToClsSet {
LOG
.
info
(
"Loaded: {}"
,
inputFile
.
getFile
());
}
RootNode
root
=
new
RootNode
(
new
Default
JadxArgs
());
RootNode
root
=
new
RootNode
(
new
JadxArgs
());
root
.
load
(
inputFiles
);
ClsSet
set
=
new
ClsSet
();
...
...
jadx-core/src/test/java/jadx/tests/api/IntegrationTest.java
View file @
2ab7524e
package
jadx
.
tests
.
api
;
import
jadx.api.DefaultJadxArgs
;
import
jadx.api.IJadxArgs
;
import
jadx.api.JadxArgs
;
import
jadx.api.JadxDecompiler
;
import
jadx.api.JadxInternalAccess
;
import
jadx.core.Jadx
;
...
...
@@ -135,38 +136,15 @@ public abstract class IntegrationTest extends TestUtils {
assertThat
(
cls
.
getCode
().
toString
(),
not
(
containsString
(
"inconsistent"
)));
}
private
DefaultJadxArgs
getArgs
()
{
return
new
DefaultJadxArgs
()
{
@Override
public
boolean
isCFGOutput
()
{
return
outputCFG
;
}
@Override
public
boolean
isRawCFGOutput
()
{
return
outputCFG
;
}
@Override
public
boolean
isFallbackMode
()
{
return
isFallback
;
}
@Override
public
boolean
isShowInconsistentCode
()
{
return
true
;
}
@Override
public
int
getThreadsCount
()
{
return
1
;
}
@Override
public
boolean
isSkipResources
()
{
return
true
;
}
};
private
IJadxArgs
getArgs
()
{
JadxArgs
args
=
new
JadxArgs
();
args
.
setCfgOutput
(
outputCFG
);
args
.
setRawCFGOutput
(
outputCFG
);
args
.
setFallbackMode
(
isFallback
);
args
.
setShowInconsistentCode
(
true
);
args
.
setThreadsCount
(
1
);
args
.
setSkipResources
(
true
);
return
args
;
}
private
void
runAutoCheck
(
String
clsName
)
{
...
...
jadx-core/src/test/java/jadx/tests/functional/JadxVisitorsOrderTest.java
View file @
2ab7524e
package
jadx
.
tests
.
functional
;
import
jadx.api.
Default
JadxArgs
;
import
jadx.api.JadxArgs
;
import
jadx.core.Jadx
;
import
jadx.core.dex.visitors.IDexTreeVisitor
;
import
jadx.core.dex.visitors.JadxVisitor
;
...
...
@@ -24,7 +24,7 @@ public class JadxVisitorsOrderTest {
@Test
public
void
testOrder
()
{
List
<
IDexTreeVisitor
>
passes
=
Jadx
.
getPassesList
(
new
Default
JadxArgs
(),
new
File
(
"out"
));
List
<
IDexTreeVisitor
>
passes
=
Jadx
.
getPassesList
(
new
JadxArgs
(),
new
File
(
"out"
));
List
<
String
>
errors
=
check
(
passes
);
for
(
String
str
:
errors
)
{
...
...
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