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
6f973ca2
Commit
6f973ca2
authored
May 08, 2019
by
Jan S
Committed by
skylot
May 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(cli): decompile only a single class (PR #657)
parent
4b73d24d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
JadxCLIArgs.java
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
+6
-0
JadxArgs.java
jadx-core/src/main/java/jadx/api/JadxArgs.java
+14
-0
JadxDecompiler.java
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
+5
-0
No files found.
jadx-cli/src/main/java/jadx/cli/JadxCLIArgs.java
View file @
6f973ca2
...
...
@@ -43,6 +43,9 @@ public class JadxCLIArgs {
@Parameter
(
names
=
{
"-s"
,
"--no-src"
},
description
=
"do not decompile source code"
)
protected
boolean
skipSources
=
false
;
@Parameter
(
names
=
{
"--single-class"
},
description
=
"decompile a single class"
)
protected
String
singleClass
=
null
;
@Parameter
(
names
=
{
"-e"
,
"--export-gradle"
},
description
=
"save as android gradle project"
)
protected
boolean
exportAsGradleProject
=
false
;
...
...
@@ -173,6 +176,9 @@ public class JadxCLIArgs {
args
.
setOutDirRes
(
FileUtils
.
toFile
(
outDirRes
));
args
.
setThreadsCount
(
threadsCount
);
args
.
setSkipSources
(
skipSources
);
if
(
singleClass
!=
null
)
{
args
.
setClassFilter
((
className
)
->
singleClass
.
equals
(
className
));
}
args
.
setSkipResources
(
skipResources
);
args
.
setFallbackMode
(
fallbackMode
);
args
.
setShowInconsistentCode
(
showInconsistentCode
);
...
...
jadx-core/src/main/java/jadx/api/JadxArgs.java
View file @
6f973ca2
...
...
@@ -6,6 +6,7 @@ import java.util.Collections;
import
java.util.EnumSet
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.function.Predicate
;
public
class
JadxArgs
{
...
...
@@ -36,6 +37,11 @@ public class JadxArgs {
private
boolean
skipResources
=
false
;
private
boolean
skipSources
=
false
;
/**
* Predicate that allows to filter the classes to be process based on their full name
*/
private
Predicate
<
String
>
classFilter
=
null
;
private
boolean
deobfuscationOn
=
false
;
private
boolean
deobfuscationForceSave
=
false
;
private
boolean
useSourceNameAsClassAlias
=
false
;
...
...
@@ -182,6 +188,14 @@ public class JadxArgs {
this
.
skipSources
=
skipSources
;
}
public
Predicate
<
String
>
getClassFilter
()
{
return
classFilter
;
}
public
void
setClassFilter
(
Predicate
<
String
>
classFilter
)
{
this
.
classFilter
=
classFilter
;
}
public
boolean
isDeobfuscationOn
()
{
return
deobfuscationOn
;
}
...
...
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
View file @
6f973ca2
...
...
@@ -13,6 +13,7 @@ import java.util.concurrent.ConcurrentHashMap;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.TimeUnit
;
import
java.util.function.Predicate
;
import
org.jf.baksmali.Adaptors.ClassDefinition
;
import
org.jf.baksmali.BaksmaliOptions
;
...
...
@@ -203,10 +204,14 @@ public final class JadxDecompiler {
}
private
void
appendSourcesSave
(
ExecutorService
executor
,
File
outDir
)
{
final
Predicate
<
String
>
classFilter
=
args
.
getClassFilter
();
for
(
JavaClass
cls
:
getClasses
())
{
if
(
cls
.
getClassNode
().
contains
(
AFlag
.
DONT_GENERATE
))
{
continue
;
}
if
(
classFilter
!=
null
&&
!
classFilter
.
test
(
cls
.
getFullName
()))
{
continue
;
}
executor
.
execute
(()
->
{
try
{
cls
.
decompile
();
...
...
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