Skip to content

Commit

Permalink
add reverse engineering tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
nkraetzschmar committed Feb 5, 2024
1 parent 6f7781a commit 1f9acc6
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions reverse_engineering/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!.gitignore
!Containerfile
!extract
6 changes: 6 additions & 0 deletions reverse_engineering/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM debian:testing
RUN apt-get update && apt-get install --no-install-recommends -y apktool ca-certificates curl default-jdk
RUN cd /opt && curl -sSL https://download-cdn.jetbrains.com/idea/ideaIC-2023.3.3.tar.gz | gzip -d | tar -x
RUN cd /opt && curl -sSL https://github.com/pxb1988/dex2jar/releases/download/v2.4/dex-tools-v2.4.zip > dex2jar.zip && unzip dex2jar.zip && rm dex2jar.zip
COPY extract /
CMD /extract
32 changes: 32 additions & 0 deletions reverse_engineering/extract
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -euo pipefail
shopt -s nullglob

dir="$(realpath .)"
tmp="$(mktemp -d)"
cd "$tmp"

for apk in "$dir"/*.apk; do
name="$(basename "$apk" .apk)"
apktool decode --no-res --no-src --output "$name" "$apk"
cd "$name"
mkdir classes

for f in *.dex; do
/opt/dex-tools-v2.4/d2j-dex2jar.sh --output "$f.jar" "$f"
(cd classes && jar -xvf "../$f.jar")
done

mkdir src
java -cp \
'/opt/idea-IC-233.14015.106/plugins/java-decompiler/lib/java-decompiler.jar' org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler \
-dgs=true \
classes/com/ikawacoffee src/

cd ..
cp -r "$name" "$dir/"
done

cd /
rm -rf "$tmp"

0 comments on commit 1f9acc6

Please sign in to comment.