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
d23f4ac1
Commit
d23f4ac1
authored
Apr 14, 2019
by
Ahmed Ashour
Committed by
skylot
Apr 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: support smali files (#391) (PR #588)
parent
01da127c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
5 deletions
+18
-5
build.gradle
jadx-core/build.gradle
+4
-1
InputFile.java
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
+10
-0
SmaliTest.java
jadx-core/src/test/java/jadx/tests/api/SmaliTest.java
+3
-3
MainWindow.java
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
+1
-1
No files found.
jadx-core/build.gradle
View file @
d23f4ac1
...
...
@@ -8,8 +8,11 @@ dependencies {
compile
'org.ow2.asm:asm:7.1'
compile
'org.jetbrains:annotations:17.0.0'
compile
'uk.com.robust-it:cloning:1.9.12'
compile
(
'org.smali:smali:2.2.6'
)
{
exclude
group:
'com.google.guava'
}
compile
'com.google.guava:guava:27.1-jre'
testCompile
'org.smali:smali:2.2.6'
testCompile
'org.smali:baksmali:2.2.6'
testCompile
'org.apache.commons:commons-lang3:3.8.1'
...
...
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
View file @
d23f4ac1
...
...
@@ -18,6 +18,8 @@ import java.util.zip.ZipFile;
import
org.apache.commons.io.IOUtils
;
import
org.jetbrains.annotations.Nullable
;
import
org.jf.smali.Smali
;
import
org.jf.smali.SmaliOptions
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -54,6 +56,14 @@ public class InputFile {
addDexFile
(
new
Dex
(
file
));
return
;
}
if
(
fileName
.
endsWith
(
".smali"
))
{
Path
output
=
Files
.
createTempFile
(
"jadx"
,
".dex"
);
SmaliOptions
options
=
new
SmaliOptions
();
options
.
outputDexFile
=
output
.
toAbsolutePath
().
toString
();
Smali
.
assemble
(
options
,
file
.
getAbsolutePath
());
addDexFile
(
new
Dex
(
output
.
toFile
()));
return
;
}
if
(
fileName
.
endsWith
(
".class"
))
{
for
(
Dex
dex
:
loadFromClassFile
(
file
))
{
addDexFile
(
dex
);
...
...
jadx-core/src/test/java/jadx/tests/api/SmaliTest.java
View file @
d23f4ac1
...
...
@@ -91,10 +91,10 @@ public abstract class SmaliTest extends IntegrationTest {
private
static
boolean
compileSmali
(
File
output
,
List
<
File
>
inputFiles
)
{
try
{
SmaliOptions
param
s
=
new
SmaliOptions
();
param
s
.
outputDexFile
=
output
.
getAbsolutePath
();
SmaliOptions
option
s
=
new
SmaliOptions
();
option
s
.
outputDexFile
=
output
.
getAbsolutePath
();
List
<
String
>
inputFileNames
=
inputFiles
.
stream
().
map
(
File:
:
getAbsolutePath
).
collect
(
Collectors
.
toList
());
Smali
.
assemble
(
param
s
,
inputFileNames
);
Smali
.
assemble
(
option
s
,
inputFileNames
);
}
catch
(
Exception
e
)
{
throw
new
AssertionError
(
"Smali assemble error"
,
e
);
}
...
...
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
View file @
d23f4ac1
...
...
@@ -197,7 +197,7 @@ public class MainWindow extends JFrame {
public
void
openFileOrProject
()
{
JFileChooser
fileChooser
=
new
JFileChooser
();
fileChooser
.
setAcceptAllFileFilterUsed
(
true
);
String
[]
exts
=
{
JadxProject
.
PROJECT_EXTENSION
,
"apk"
,
"dex"
,
"jar"
,
"class"
,
"zip"
,
"aar"
,
"arsc"
};
String
[]
exts
=
{
JadxProject
.
PROJECT_EXTENSION
,
"apk"
,
"dex"
,
"jar"
,
"class"
,
"zip"
,
"aar"
,
"arsc"
,
"smali"
};
String
description
=
"supported files: "
+
Arrays
.
toString
(
exts
).
replace
(
'['
,
'('
).
replace
(
']'
,
')'
);
fileChooser
.
setFileFilter
(
new
FileNameExtensionFilter
(
description
,
exts
));
fileChooser
.
setToolTipText
(
NLS
.
str
(
"file.open_action"
));
...
...
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