To convert d8 to dex we can use d8 on itself.
d8.jar is inluded in android build tools zips. We can also download it from Google's Maven Repo, where r8 and d8 are one jar.
We can use d8.jar using java and --classpath.
To convert d8 to dex we can use d8 on itself.
d8.jar is inluded in android build tools zips. We can also download it from Google's Maven Repo, where r8 and d8 are one jar.
We can use d8.jar using java and --classpath.
This is my notes on compiling java source code on android itself.
dx dalvikvm -CompileOnHost -TEST_ART_RUN_TEST_DEPENDENCIES -TEST_NAME -GC_CONCURRENT -SHA1-Digest -SHA1-Digest-Manifest -formbuilder -dysentery -WebChat -ThomasGross -SurfaceFlinger
| #!/bin/sh | |
| DIR="tmp_"$$ | |
| JAR=`echo $1 | tr '.' ' ' | awk '{ print $1 }'` | |
| rm -rf $JAR.jar | |
| mkdir $DIR | |
| cp $1 $DIR | |
| cd $DIR | |
| echo "** Compiling java file..." | |
| javac -d . -g $1 | |
| echo "** Creating temporary jar..." |
for /f %f in ('dir /b *.reg') do reg import %f
for /f %f in ('dir /b *.reg') do regedit /S %f| # https://securitychops.com/2019/08/31/dev/random/one-liner-to-install-burp-cacert-into-android.html | |
| # | |
| curl --proxy http://127.0.0.1:8080 -o cacert.der http://burp/cert \ | |
| && openssl x509 -inform DER -in cacert.der -out cacert.pem \ | |
| && cp cacert.der $(openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1).0 \ | |
| && adb root \ | |
| && adb remount \ | |
| && adb push $(openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1).0 /sdcard/ \ | |
| && echo -n "mv /sdcard/$(openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1).0 /system/etc/security/cacerts/" | adb shell \ | |
| && echo -n "chmod 644 /system/etc/security/cacerts/$(openssl x509 -inform PEM -subject_hash_old -in cacert.pem |head -1).0" | adb shell \ |
While reversing a few stuff i found it tedious to decompile a lot of functions and copy them, so i found a way to decompile them with IDA Pro at once and write to one .C file.
You'll need IDA Pro 7.x.
First Export Headers
Open the file and let IDA Analyze it.
Go to File -> Produce file -> Create C header file to a file.
| #!/usr/bin/env bash | |
| version="0.0.1" | |
| TARGET_PROCESS=$1 | |
| if [ ! $TARGET_PROCESS ]; then | |
| echo | |
| echo "Usage: sticker [process name]" | |
| echo |
adb push ~/android-sdk-linux/ndk-bundle/prebuilt/android-<arch>/gdbserver/gdbserver /data/local/tmp
adb shell "chmod 777 /data/local/tmp/gdbserver"
adb shell "ls -l /data/local/tmp/gdbserver"
adb forward tcp:1337 tcp:1337
| Nexus 5 4.4.4 | |
| 1. setup: | |
| a. need to downgrade to 4.4.4, root | |
| b. luckypactcher, GG, xposed | |
| c. put libhook.so and android_server and libsubstrate.so in /data/local/tmp/ and install aadbg | |
| d. patch with luckypatcher the middle 2 | |
| 2. adb shell su -> android_server | |
| 3. adb forward tcp:23946 tcp: 23946 | |
| 4. adb forward tcp:8700 jdwp:PID_OF_GAME | |
| jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8700 |
| rmdir "%LocalAppData%\nvim" /s /q | |
| rmdir "%LocalAppData%\nvim-data" /s /q | |
| mkdir "%LocalAppData%\nvim" | |
| mkdir "%LocalAppData%\nvim-data\" | |
| mkdir "%LocalAppData%\nvim-data\site\" | |
| mkdir "%LocalAppData%\nvim-data\site\autoload\" | |
| REM curl https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim > "%LocalAppData%\nvim-data\site\autoload\plug.vim" | |
| powershell "iwr -outf '%LocalAppData%\nvim-data\site\autoload\plug.vim' https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" |