Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jd-cli version #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -7,10 +7,7 @@ RUN apt-get update && apt-get install -y \
unzip \
p7zip-full;

ENV JD_VERSION "1.4.0"
#ENV JD_VERSION "1.6.6"
ENV JD_CLI_VERSION "0.9.1.Final"
# ENV JD_CLI_VERSION "1.0.1.Final"
ENV JD_CLI_VERSION "1.0.1.Final"

RUN mkdir -p /opt
WORKDIR /opt
@@ -22,9 +19,6 @@ RUN wget -q -O "dex2jar-2.1.zip" https://github.com/pxb1988/dex2jar/files/186756
&& rm -f dex2jar-2.1.zip
ENV PATH $PATH:/opt/dex-tools-2.1-SNAPSHOT

# JD-GUI
RUN wget -q -O "jd-gui.jar" "https://github.com/java-decompiler/jd-gui/releases/download/v$JD_VERSION/jd-gui-$JD_VERSION.jar"

# JD-CLI
RUN wget -q -O "jd-cli.zip" "https://github.com/kwart/jd-cmd/releases/download/jd-cmd-$JD_CLI_VERSION/jd-cli-$JD_CLI_VERSION-dist.zip"
RUN unzip jd-cli.zip
21 changes: 8 additions & 13 deletions extract.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/sh

# check that 7z is installed
# Verify that 7z is installed
command -v 7z >/dev/null 2>&1 || { echo >&2 "This script requires 7z. Aborting."; exit 1; }

jdgui="/opt/jd-cli"
jd="/opt/jd-cli"
dex2jar="/opt/dex-tools-2.1-SNAPSHOT/d2j-dex2jar.sh"

if [ $# -eq 0 ]
@@ -12,25 +12,20 @@ if [ $# -eq 0 ]
exit 1
fi

# extracting the apk
# Extract the apk
echo "apk file: $1"
DIRECTORY=$(dirname ${1})
FILE=$(basename ${1})

echo "Creating directory $FILE.files"
# echo "mkdir $1.files"
echo "[7z] Extracting apk files to: $1.files/"
mkdir $1.files

echo "Extracting apk to $1.files/"
7z x $1 -o$1.files/

echo "Generating $FILE.jar in $1.files/"
# echo "$dex2jar $dexfile -o $1.files/$FILE.jar"
echo "[dex2jar] Creating temporary .jar file"
$dex2jar $1 -o $FILE.jar

echo "Opening jd-gui with .jar file"
# echo "$jdgui $1.files/$FILE.jar"
$jdgui -od $1.src $FILE.jar 2> /dev/null
echo "[jd-cli] Extracting source files to: $1.src/"
$jd --outputDir $1.src $FILE.jar 2> /dev/null

echo "Removing created .jar file"
echo "Removing temporary .jar file"
rm $FILE.jar