dex2jar Package Description

dex2jar contains following components:

  • dex-reader is designed to read the Dalvik Executable (.dex/.odex) format. It has a light weight API similar with ASM.
  • dex-translator is designed to do the convert job. It reads the dex instruction to dex-ir format, after some optimize, convert to ASM format.
  • dex-ir used by dex-translator, is designed to represent the dex instruction
  • dex-tools tools to work with .class files. here are examples: Modify a apk, DeObfuscate a jar
  • d2j-smali [To be published] disassemble dex to smali files and assemble dex from smali files. different implementation to smali/baksmali, same syntax, but we support escape in type desc “Lcom/dex2jar\t\u1234;”
  • dex-writer [To be published] write dex same way as dex-reader.

Source: https://github.com/pxb1988/dex2jar/
dex2jar Homepage | Kali dex2jar Repo

  • Author: Panxiaobo
  • License: Apache-2.0

Tools included in the dex2jar package

d2j-jar2dex – Convert jar to dex by invoking dx
root@kali:~# d2j-jar2dex -h
d2j-jar2dex -- Convert jar to dex by invoking dx.
usage: d2j-jar2dex [options] <dir>
options:
 -f,--force                   force overwrite
 -h,--help                    Print this help message
 -o,--output <out-dex-file>   output .dex file, default is $current_dir/[jar-nam
                              e]-jar2dex.dex
version: 0.0.9.15

d2j-jar-remap – Rename package/class/method/field name in a jar

root@kali:~# d2j-jar-remap -h
d2j-jar-remap -- rename package/class/method/field name in a jar
usage: d2j-jar-remap [options] jar
options:
 -c,--config <config>    config file for remap, this is REQUIRED
 -f,--force              force overwrite
 -h,--help               Print this help message
 -o,--output <out-jar>   output .jar file, default is $current_dir/[jar-name]-re
                         map.jar
version: 0.0.9.15
online help: https://code.google.com/p/dex2jar/wiki/DeObfuscateJarWithDexTool

d2j-dex2jar – Convert dex to jar

root@kali:~# d2j-dex2jar -h
d2j-dex2jar -- convert dex to jar
usage: d2j-dex2jar [options] <file0> [file1 ... fileN]
options:
 -d,--debug-info              translate debug info
 -e,--exception-file <file>   detail exception file, default is $current_dir/[fi
                              le-name]-error.zip
 -f,--force                   force overwrite
 -h,--help                    Print this help message
 -n,--not-handle-exception    not handle any exception throwed by dex2jar
 -o,--output <out-jar-file>   output .jar file, default is $current_dir/[file-na
                              me]-dex2jar.jar
 -os,--optmize-synchronized   optmize-synchronized
 -p,--print-ir                print ir to Syste.out
 -r,--reuse-reg               reuse regiter while generate java .class file
 -s                           same with --topological-sort/-ts
 -ts,--topological-sort       sort block by topological, that will generate more
                               readable code
 -v,--verbose                 show progress
version: reader-1.15, translator-0.0.9.15, ir-1.12

dex2jar – This cmd is deprecated, use the d2j-dex2jar if possible

root@kali:~# dex2jar
this cmd is deprecated, use the d2j-dex2jar if possible
dex2jar version: translator-0.0.9.15
dex2jar file1.dexORapk file2.dexORapk ...

d2j-jasmin2jar – Assemble .j files to .class file

root@kali:~# d2j-jasmin2jar -h
d2j-jasmin2jar -- d2j-jasmin2jar - assemble .j files to .class file
usage: d2j-jasmin2jar [options] <dir>
options:
 -e,--encoding <enc>             encoding for .j files, default is UTF-8
 -f,--force                      force overwrite
 -g,--autogenerate-linenumbers   autogenerate-linenumbers
 -h,--help                       Print this help message
 -o,--output <out-jar-file>      output .jar file, default is $current_dir/[jar-
                                 name]-jasmin2jar.jar
version: 0.0.9.15

d2j-jar-access – Add or remove class/method/field access in jar file

root@kali:~# d2j-jar-access -h
d2j-jar-access -- add or remove class/method/field access in jar file
usage: d2j-jar-access [options] <jar>
options:
 -ac,--add-class-access <ACC>       add access from class
 -af,--add-field-access <ACC>       add access from field
 -am,--add-method-access <ACC>      add access from method
 -f,--force                         force overwrite
 -h,--help                          Print this help message
 -o,--output <out-dir>              output dir of .j files, default is $current_
                                    dir/[jar-name]-access.jar
 -rc,--remove-class-access <ACC>    remove access from class
 -rd,--remove-debug                 remove debug info
 -rf,--remove-field-access <ACC>    remove access from field
 -rm,--remove-method-access <ACC>   remove access from method
version: 0.0.9.15

d2j-asm-verify – Verify .class in jar

root@kali:~# d2j-asm-verify -h
d2j-asm-verify -- Verify .class in jar
usage: d2j-asm-verify [options] <jar0> [jar1 ... jarN]
options:
 -d,--detail   Print detail error message
 -h,--help     Print this help message
version: 0.0.9.15

d2j-dex-dump

root@kali:~# d2j-dex-dump -h
Dump in.dexORapk out.dump.jar

d2j-init-deobf – Generate an init config file for deObfuscate a jar

root@kali:~# d2j-init-deobf -h
d2j-init-deobf -- generate an init config file for deObfuscate a jar
usage: d2j-init-deobf [options] <jar>
options:
 -f,--force                force overwrite
 -h,--help                 Print this help message
 -max,--max-length <MAX>   do the rename if the length > MIN, default is 40
 -min,--min-length <MIN>   do the rename if the length < MIN, default is 2
 -o,--output <out-file>    output .jar file, default is $current_dir/[file-name]
                           -deobf-init.txt
version: 0.0.9.15

d2j-apk-sign – Sign an android apk file use a test certificate

root@kali:~# d2j-apk-sign -h
d2j-apk-sign -- Sign an android apk file use a test certificate.
usage: d2j-apk-sign [options] <apk>
options:
 -f,--force                   force overwrite
 -h,--help                    Print this help message
 -o,--output <out-apk-file>   output .apk file, default is $current_dir/[apk-nam
                              e]-signed.apk
 -w,--sign-whole              Sign whole apk file
version: 0.0.9.15

d2j-jar2jasmin – Disassemble .class in jar file to jasmin file

root@kali:~# d2j-jar2jasmin -h
d2j-jar2jasmin -- Disassemble .class in jar file to jasmin file
usage: d2j-jar2jasmin [options] <jar>
options:
 -d,--debug              disassemble debug info
 -e,--encoding <enc>     encoding for .j files, default is UTF-8
 -f,--force              force overwrite
 -h,--help               Print this help message
 -o,--output <out-dir>   output dir of .j files, default is $current_dir/[jar-na
                         me]-jar2jasmin/
version: 0.0.9.15

d2j-dex2jar Usage Example

root@kali:~# d2j-dex2jar /usr/share/metasploit-framework/data/android/apk/classes.dex
dex2jar /usr/share/metasploit-framework/data/android/apk/classes.dex -> classes-dex2jar.jar
Menu