Skip to content

Commit

Permalink
Merge pull request #54 from firmianay/dev3
Browse files Browse the repository at this point in the history
fix dexToJava on Mac/Windows
  • Loading branch information
nkbai authored Oct 13, 2023
2 parents 318b46f + 6caee3b commit a74eea8
Show file tree
Hide file tree
Showing 52 changed files with 137 additions and 52 deletions.
18 changes: 14 additions & 4 deletions config/config.json5
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
{
//apk to anlayze
"apkPath": "/Users/aaa/Downloads/app.apk",

//result output directory
// "out": "out",
// "out": "out",

//specifies the rules, default is all *.json files in the $rulePath directory
// "rules": "unZipSlip.json",
// "rules": "unZipSlip.json",

//specifies the rule's parent directory, default is ./config/rules
// "rulePath": "config/rules"
// "rulePath": "config/rules",

//print more info about this rule
// "debugRule": "unZipSlip"
// "debugRule": "unZipSlip",

//output log level
// "logLevel": 0,

//display the decompiled java code in the results
// "javaSource": true,
}
39 changes: 25 additions & 14 deletions config/tools/jadx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
## JADX

[![Build status](https://github.com/skylot/jadx/workflows/Build/badge.svg)](https://github.com/skylot/jadx/actions?query=workflow%3ABuild)
[![Alerts from lgtm.com](https://img.shields.io/lgtm/alerts/g/skylot/jadx.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/skylot/jadx/alerts/)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
![GitHub contributors](https://img.shields.io/github/contributors/skylot/jadx)
![GitHub all releases](https://img.shields.io/github/downloads/skylot/jadx/total)
![GitHub release (latest by SemVer)](https://img.shields.io/github/downloads/skylot/jadx/latest/total)
![Latest release](https://img.shields.io/github/release/skylot/jadx.svg)
[![Maven Central](https://img.shields.io/maven-central/v/io.github.skylot/jadx-core)](https://search.maven.org/search?q=g:io.github.skylot%20AND%20jadx)
[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)

Expand Down Expand Up @@ -33,8 +35,9 @@ See these features in action here: [jadx-gui features overview](https://github.c
<img src="https://user-images.githubusercontent.com/118523/142730720-839f017e-38db-423e-b53f-39f5f0a0316f.png" width="700"/>

### Download
- release from [github: ![Latest release](https://img.shields.io/github/release/skylot/jadx.svg)](https://github.com/skylot/jadx/releases/latest)
- latest [unstable build](https://nightly.link/skylot/jadx/workflows/build/master)
- release
from [github: ![Latest release](https://img.shields.io/github/release/skylot/jadx.svg)](https://github.com/skylot/jadx/releases/latest)
- latest [unstable build ![GitHub commits since tagged version (branch)](https://img.shields.io/github/commits-since/skylot/jadx/latest/master)](https://nightly.link/skylot/jadx/workflows/build-artifacts/master)

After download unpack zip file go to `bin` directory and run:
- `jadx` - command line version
Expand All @@ -45,14 +48,18 @@ On Windows run `.bat` files with double-click\
For Windows, you can download it from [oracle.com](https://www.oracle.com/java/technologies/downloads/#jdk17-windows) (select x64 Installer).

### Install
1. Arch linux
1. Arch linux ![Arch Linux package](https://img.shields.io/archlinux/v/community/any/jadx?label=)
```bash
sudo pacman -S jadx
sudo pacman -S jadx
```
2. macOS
2. macOS ![homebrew version](https://img.shields.io/homebrew/v/jadx?label=)
```bash
brew install jadx
brew install jadx
```
3. [Flathub ![Flathub](https://img.shields.io/flathub/v/com.github.skylot.jadx?label=)](https://flathub.org/apps/details/com.github.skylot.jadx)
```bash
flatpak install flathub com.github.skylot.jadx
```

### Use jadx as a library
You can use jadx in your java projects, check details on [wiki page](https://github.com/skylot/jadx/wiki/Use-jadx-as-a-library)
Expand Down Expand Up @@ -95,6 +102,7 @@ options:
--add-debug-lines - add comments with debug line numbers if available
--no-inline-anonymous - disable anonymous classes inline
--no-inline-methods - disable methods inline
--no-finally - don't extract finally block
--no-replace-consts - don't replace constant value with matching constant field
--escape-unicode - escape non latin characters in strings (with \u)
--respect-bytecode-access-modifiers - don't change original access modifiers
Expand All @@ -107,9 +115,12 @@ options:
'read-or-save' - read if found, save otherwise (don't overwrite)
'overwrite' - don't read, always save
'ignore' - don't read and don't save
--deobf-rewrite-cfg - set '--deobf-cfg-file-mode' to 'overwrite' (deprecated)
--deobf-use-sourcename - use source file name as class name alias
--deobf-parse-kotlin-metadata - parse kotlin metadata to class and package names
--deobf-res-name-source - better name source for resources:
'auto' - automatically select best name (default)
'resources' - use resources names
'code' - use R class fields names
--use-kotlin-methods-for-var-names - use kotlin intrinsic methods to rename variables, values: disable, apply, apply-and-hide, default: apply
--rename-flags - fix options (comma-separated list of):
'case' - fix case sensitivity issues (according to --fs-case-sensitive option),
Expand All @@ -130,11 +141,11 @@ options:
-h, --help - print this help

Plugin options (-P<name>=<value>):
1) dex-input (Load .dex and .apk files)
-Pdex-input.verify-checksum - Verify dex file checksum before load, values: [yes, no], default: yes
2) java-convert (Convert .jar and .class files to dex)
-Pjava-convert.mode - Convert mode, values: [dx, d8, both], default: both
-Pjava-convert.d8-desugar - Use desugar in d8, values: [yes, no], default: no
1) dex-input: Load .dex and .apk files
- dex-input.verify-checksum - verify dex file checksum before load, values: [yes, no], default: yes
2) java-convert: Convert .class, .jar and .aar files to dex
- java-convert.mode - convert mode, values: [dx, d8, both], default: both
- java-convert.d8-desugar - use desugar in d8, values: [yes, no], default: no

Examples:
jadx -d out classes.dex
Expand Down
20 changes: 15 additions & 5 deletions config/tools/jadx/bin/jadx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}.." && pwd -P ) || exit

APP_NAME="jadx"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}.." && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and JADX_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xms128M" "-XX:MaxRAMPercentage=70.0" "-XX:+UseG1GC"'
Expand Down Expand Up @@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/lib/jadx-cli-1.3.5.jar:$APP_HOME/lib/jadx-core-1.3.5.jar:$APP_HOME/lib/logback-classic-1.2.11.jar:$APP_HOME/lib/jadx-java-convert-1.3.5.jar:$APP_HOME/lib/jadx-smali-input-1.3.5.jar:$APP_HOME/lib/jadx-dex-input-1.3.5.jar:$APP_HOME/lib/jadx-java-input-1.3.5.jar:$APP_HOME/lib/jadx-plugins-api-1.3.5.jar:$APP_HOME/lib/raung-disasm-0.0.2.jar:$APP_HOME/lib/raung-common-0.0.2.jar:$APP_HOME/lib/slf4j-api-1.7.36.jar:$APP_HOME/lib/baksmali-2.5.2.jar:$APP_HOME/lib/smali-2.5.2.jar:$APP_HOME/lib/util-2.5.2.jar:$APP_HOME/lib/jcommander-1.82.jar:$APP_HOME/lib/gson-2.9.0.jar:$APP_HOME/lib/aapt2-proto-4.2.1-7147631.jar:$APP_HOME/lib/protobuf-java-3.11.4.jar:$APP_HOME/lib/logback-core-1.2.11.jar:$APP_HOME/lib/dexlib2-2.5.2.jar:$APP_HOME/lib/guava-30.1.1-jre.jar:$APP_HOME/lib/dalvik-dx-11.0.0_r3.jar:$APP_HOME/lib/r8-3.3.28.jar:$APP_HOME/lib/asm-9.3.jar:$APP_HOME/lib/antlr-3.5.2.jar:$APP_HOME/lib/ST4-4.0.8.jar:$APP_HOME/lib/antlr-runtime-3.5.2.jar:$APP_HOME/lib/stringtemplate-3.2.1.jar:$APP_HOME/lib/jsr305-3.0.2.jar:$APP_HOME/lib/failureaccess-1.0.1.jar:$APP_HOME/lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:$APP_HOME/lib/checker-qual-3.8.0.jar:$APP_HOME/lib/error_prone_annotations-2.5.1.jar:$APP_HOME/lib/j2objc-annotations-1.3.jar:$APP_HOME/lib/antlr-2.7.7.jar
CLASSPATH=$APP_HOME/lib/jadx-cli-1.4.7.jar:$APP_HOME/lib/jadx-core-1.4.7.jar:$APP_HOME/lib/logback-classic-1.3.5.jar:$APP_HOME/lib/jadx-java-convert-1.4.7.jar:$APP_HOME/lib/jadx-smali-input-1.4.7.jar:$APP_HOME/lib/jadx-dex-input-1.4.7.jar:$APP_HOME/lib/jadx-java-input-1.4.7.jar:$APP_HOME/lib/jadx-plugins-api-1.4.7.jar:$APP_HOME/lib/raung-disasm-0.0.3.jar:$APP_HOME/lib/raung-common-0.0.3.jar:$APP_HOME/lib/slf4j-api-2.0.6.jar:$APP_HOME/lib/baksmali-2.5.2.jar:$APP_HOME/lib/smali-2.5.2.jar:$APP_HOME/lib/util-2.5.2.jar:$APP_HOME/lib/jcommander-1.82.jar:$APP_HOME/lib/gson-2.10.1.jar:$APP_HOME/lib/aapt2-proto-7.3.1-8691043.jar:$APP_HOME/lib/protobuf-java-3.21.12.jar:$APP_HOME/lib/logback-core-1.3.5.jar:$APP_HOME/lib/dexlib2-2.5.2.jar:$APP_HOME/lib/guava-30.1.1-jre.jar:$APP_HOME/lib/dalvik-dx-11.0.0_r3.jar:$APP_HOME/lib/r8-4.0.48.jar:$APP_HOME/lib/asm-9.4.jar:$APP_HOME/lib/antlr-3.5.2.jar:$APP_HOME/lib/ST4-4.0.8.jar:$APP_HOME/lib/antlr-runtime-3.5.2.jar:$APP_HOME/lib/stringtemplate-3.2.1.jar:$APP_HOME/lib/jsr305-3.0.2.jar:$APP_HOME/lib/failureaccess-1.0.1.jar:$APP_HOME/lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:$APP_HOME/lib/checker-qual-3.8.0.jar:$APP_HOME/lib/error_prone_annotations-2.5.1.jar:$APP_HOME/lib/j2objc-annotations-1.3.jar:$APP_HOME/lib/antlr-2.7.7.jar


# Determine the Java command to use to start the JVM.
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -204,6 +208,12 @@ set -- \
jadx.cli.JadxCLI \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
22 changes: 16 additions & 6 deletions config/tools/jadx/bin/jadx-gui
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,13 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}.." && pwd -P ) || exit

APP_NAME="jadx-gui"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}.." && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and JADX_GUI_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xms128M" "-XX:MaxRAMPercentage=70.0" "-XX:+UseG1GC" "-Dawt.useSystemAAFontSettings=lcd" "-Dswing.aatext=true"'
DEFAULT_JVM_OPTS='"-Xms128M" "-XX:MaxRAMPercentage=70.0" "-XX:+UseG1GC" "-Dawt.useSystemAAFontSettings=lcd" "-Dswing.aatext=true" "-Djava.util.Arrays.useLegacyMergeSort=true"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/lib/jadx-gui-1.3.5.jar:$APP_HOME/lib/jfontchooser-1.0.5.jar:$APP_HOME/lib/jadx-cli-1.3.5.jar:$APP_HOME/lib/jadx-core-1.3.5.jar:$APP_HOME/lib/logback-classic-1.2.11.jar:$APP_HOME/lib/jadx-java-convert-1.3.5.jar:$APP_HOME/lib/jadx-smali-input-1.3.5.jar:$APP_HOME/lib/jadx-dex-input-1.3.5.jar:$APP_HOME/lib/jadx-java-input-1.3.5.jar:$APP_HOME/lib/jadx-plugins-api-1.3.5.jar:$APP_HOME/lib/raung-disasm-0.0.2.jar:$APP_HOME/lib/raung-common-0.0.2.jar:$APP_HOME/lib/slf4j-api-1.7.36.jar:$APP_HOME/lib/baksmali-2.5.2.jar:$APP_HOME/lib/smali-2.5.2.jar:$APP_HOME/lib/util-2.5.2.jar:$APP_HOME/lib/jcommander-1.82.jar:$APP_HOME/lib/rsyntaxtextarea-3.2.0.jar:$APP_HOME/lib/image-viewer-1.2.3.jar:$APP_HOME/lib/flatlaf-intellij-themes-2.1.jar:$APP_HOME/lib/flatlaf-extras-2.1.jar:$APP_HOME/lib/flatlaf-2.1.jar:$APP_HOME/lib/svgSalamander-1.1.3.jar:$APP_HOME/lib/gson-2.9.0.jar:$APP_HOME/lib/commons-text-1.9.jar:$APP_HOME/lib/commons-lang3-3.12.0.jar:$APP_HOME/lib/rxjava2-swing-0.3.7.jar:$APP_HOME/lib/rxjava-2.2.21.jar:$APP_HOME/lib/apksig-4.2.1.jar:$APP_HOME/lib/jdwp-1.0.jar:$APP_HOME/lib/aapt2-proto-4.2.1-7147631.jar:$APP_HOME/lib/protobuf-java-3.11.4.jar:$APP_HOME/lib/logback-core-1.2.11.jar:$APP_HOME/lib/reactive-streams-1.0.3.jar:$APP_HOME/lib/dexlib2-2.5.2.jar:$APP_HOME/lib/guava-30.1.1-jre.jar:$APP_HOME/lib/dalvik-dx-11.0.0_r3.jar:$APP_HOME/lib/r8-3.3.28.jar:$APP_HOME/lib/asm-9.3.jar:$APP_HOME/lib/antlr-3.5.2.jar:$APP_HOME/lib/ST4-4.0.8.jar:$APP_HOME/lib/antlr-runtime-3.5.2.jar:$APP_HOME/lib/stringtemplate-3.2.1.jar:$APP_HOME/lib/jsr305-3.0.2.jar:$APP_HOME/lib/failureaccess-1.0.1.jar:$APP_HOME/lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:$APP_HOME/lib/checker-qual-3.8.0.jar:$APP_HOME/lib/error_prone_annotations-2.5.1.jar:$APP_HOME/lib/j2objc-annotations-1.3.jar:$APP_HOME/lib/antlr-2.7.7.jar
CLASSPATH=$APP_HOME/lib/jadx-gui-1.4.7.jar:$APP_HOME/lib/jfontchooser-1.0.5.jar:$APP_HOME/lib/mapping-io-0.4.0-SNAPSHOT.jar:$APP_HOME/lib/jadx-cli-1.4.7.jar:$APP_HOME/lib/jadx-core-1.4.7.jar:$APP_HOME/lib/logback-classic-1.3.5.jar:$APP_HOME/lib/jadx-java-convert-1.4.7.jar:$APP_HOME/lib/jadx-smali-input-1.4.7.jar:$APP_HOME/lib/jadx-dex-input-1.4.7.jar:$APP_HOME/lib/jadx-java-input-1.4.7.jar:$APP_HOME/lib/jadx-plugins-api-1.4.7.jar:$APP_HOME/lib/raung-disasm-0.0.3.jar:$APP_HOME/lib/raung-common-0.0.3.jar:$APP_HOME/lib/slf4j-api-2.0.6.jar:$APP_HOME/lib/baksmali-2.5.2.jar:$APP_HOME/lib/smali-2.5.2.jar:$APP_HOME/lib/util-2.5.2.jar:$APP_HOME/lib/jcommander-1.82.jar:$APP_HOME/lib/rsyntaxtextarea-3.3.2.jar:$APP_HOME/lib/image-viewer-1.2.3.jar:$APP_HOME/lib/flatlaf-intellij-themes-3.0.jar:$APP_HOME/lib/flatlaf-extras-3.0.jar:$APP_HOME/lib/flatlaf-3.0.jar:$APP_HOME/lib/svgSalamander-1.1.4.jar:$APP_HOME/lib/gson-2.10.1.jar:$APP_HOME/lib/commons-text-1.10.0.jar:$APP_HOME/lib/commons-lang3-3.12.0.jar:$APP_HOME/lib/rxjava2-swing-0.3.7.jar:$APP_HOME/lib/rxjava-2.2.21.jar:$APP_HOME/lib/apksig-7.4.1.jar:$APP_HOME/lib/jdwp-2.0.0.jar:$APP_HOME/lib/aapt2-proto-7.3.1-8691043.jar:$APP_HOME/lib/protobuf-java-3.21.12.jar:$APP_HOME/lib/logback-core-1.3.5.jar:$APP_HOME/lib/reactive-streams-1.0.3.jar:$APP_HOME/lib/dexlib2-2.5.2.jar:$APP_HOME/lib/guava-30.1.1-jre.jar:$APP_HOME/lib/dalvik-dx-11.0.0_r3.jar:$APP_HOME/lib/r8-4.0.48.jar:$APP_HOME/lib/asm-9.4.jar:$APP_HOME/lib/antlr-3.5.2.jar:$APP_HOME/lib/ST4-4.0.8.jar:$APP_HOME/lib/antlr-runtime-3.5.2.jar:$APP_HOME/lib/stringtemplate-3.2.1.jar:$APP_HOME/lib/jsr305-3.0.2.jar:$APP_HOME/lib/failureaccess-1.0.1.jar:$APP_HOME/lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:$APP_HOME/lib/checker-qual-3.8.0.jar:$APP_HOME/lib/error_prone_annotations-2.5.1.jar:$APP_HOME/lib/j2objc-annotations-1.3.jar:$APP_HOME/lib/antlr-2.7.7.jar


# Determine the Java command to use to start the JVM.
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -204,6 +208,12 @@ set -- \
jadx.gui.JadxGUI \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
Loading

0 comments on commit a74eea8

Please sign in to comment.