rovellipaolo/NinjaDroid

-e/--extract option not working correctly with flatpak

rovellipaolo opened this issue · 0 comments

Using the flatpak version, the -e/--extract option does not work correctly.
In particular, the APK is parsed and its entries extracted correctly, apktool seems to be executed without issues, but dex2jar execution is failing.

flatpak-builder --run flatpak/build flatpak/com.github.rovellipaolo.NinjaDroid.yaml ninjadroid regression/data/Example.apk --all --extract output/ --verbose
  >> NinjaDroid: [DEBUG] Reading regression/data/Example.apk...
  >> NinjaDroid: [DEBUG] Parsing APK file: filepath="regression/data/Example.apk"
  >> NinjaDroid: [DEBUG] Reading file: filepath="regression/data/Example.apk"
  >> NinjaDroid: [DEBUG] Extracting APK resource AndroidManifest.xml to /tmp/tmp0h57g3hh.ninjadroid/AndroidManifest.xml
  >> NinjaDroid: [DEBUG] AndroidManifest.xml looks like an AndroidManifest.xml file
  >> NinjaDroid: [DEBUG] Parsing AndroidManifest.xml file: filepath="/tmp/tmp0h57g3hh.ninjadroid/AndroidManifest.xml"
  >> NinjaDroid: [DEBUG] Reading file: filepath="/tmp/tmp0h57g3hh.ninjadroid/AndroidManifest.xml"
  >> NinjaDroid: [DEBUG] Parsing AndroidManifest.xml from DOM...
  >> NinjaDroid: [DEBUG] Extracting APK resource res/drawable-hdpi-v4/ic_launcher.png to /tmp/tmp0h57g3hh.ninjadroid/res/drawable-hdpi-v4/ic_launcher.png
  >> NinjaDroid: [DEBUG] res/drawable-hdpi-v4/ic_launcher.png looks like a generic file
  >> NinjaDroid: [DEBUG] Reading file: filepath="/tmp/tmp0h57g3hh.ninjadroid/res/drawable-hdpi-v4/ic_launcher.png"
  >> NinjaDroid: [DEBUG] Extracting APK resource res/drawable-hdpi-v4/ic_launcher_logo.png to /tmp/tmp0h57g3hh.ninjadroid/res/drawable-hdpi-v4/ic_launcher_logo.png
  >> NinjaDroid: [DEBUG] res/drawable-hdpi-v4/ic_launcher_logo.png looks like a generic file
  >> NinjaDroid: [DEBUG] Reading file: filepath="/tmp/tmp0h57g3hh.ninjadroid/res/drawable-hdpi-v4/ic_launcher_logo.png"
  >> NinjaDroid: [DEBUG] Extracting APK resource res/drawable-ldpi-v4/ic_launcher.png to /tmp/tmp0h57g3hh.ninjadroid/res/drawable-ldpi-v4/ic_launcher.png
  >> NinjaDroid: [DEBUG] res/drawable-ldpi-v4/ic_launcher.png looks like a generic file
  >> NinjaDroid: [DEBUG] Reading file: filepath="/tmp/tmp0h57g3hh.ninjadroid/res/drawable-ldpi-v4/ic_launcher.png"
  >> NinjaDroid: [DEBUG] Extracting APK resource res/drawable-ldpi-v4/ic_launcher_logo.png to /tmp/tmp0h57g3hh.ninjadroid/res/drawable-ldpi-v4/ic_launcher_logo.png
  >> NinjaDroid: [DEBUG] res/drawable-ldpi-v4/ic_launcher_logo.png looks like a generic file
  >> NinjaDroid: [DEBUG] Reading file: filepath="/tmp/tmp0h57g3hh.ninjadroid/res/drawable-ldpi-v4/ic_launcher_logo.png"
  >> NinjaDroid: [DEBUG] Extracting APK resource res/drawable-mdpi-v4/ic_launcher.png to /tmp/tmp0h57g3hh.ninjadroid/res/drawable-mdpi-v4/ic_launcher.png
  >> NinjaDroid: [DEBUG] res/drawable-mdpi-v4/ic_launcher.png looks like a generic file
  >> NinjaDroid: [DEBUG] Reading file: filepath="/tmp/tmp0h57g3hh.ninjadroid/res/drawable-mdpi-v4/ic_launcher.png"
  >> NinjaDroid: [DEBUG] Extracting APK resource res/drawable-mdpi-v4/ic_launcher_logo.png to /tmp/tmp0h57g3hh.ninjadroid/res/drawable-mdpi-v4/ic_launcher_logo.png
  >> NinjaDroid: [DEBUG] res/drawable-mdpi-v4/ic_launcher_logo.png looks like a generic file
  >> NinjaDroid: [DEBUG] Reading file: filepath="/tmp/tmp0h57g3hh.ninjadroid/res/drawable-mdpi-v4/ic_launcher_logo.png"
  >> NinjaDroid: [DEBUG] Extracting APK resource res/drawable-xhdpi-v4/ic_launcher.png to /tmp/tmp0h57g3hh.ninjadroid/res/drawable-xhdpi-v4/ic_launcher.png
  >> NinjaDroid: [DEBUG] res/drawable-xhdpi-v4/ic_launcher.png looks like a generic file
  >> NinjaDroid: [DEBUG] Reading file: filepath="/tmp/tmp0h57g3hh.ninjadroid/res/drawable-xhdpi-v4/ic_launcher.png"
  >> NinjaDroid: [DEBUG] Extracting APK resource res/drawable-xhdpi-v4/ic_launcher_logo.png to /tmp/tmp0h57g3hh.ninjadroid/res/drawable-xhdpi-v4/ic_launcher_logo.png
  >> NinjaDroid: [DEBUG] res/drawable-xhdpi-v4/ic_launcher_logo.png looks like a generic file
  >> NinjaDroid: [DEBUG] Reading file: filepath="/tmp/tmp0h57g3hh.ninjadroid/res/drawable-xhdpi-v4/ic_launcher_logo.png"
  >> NinjaDroid: [DEBUG] Extracting APK resource res/layout/main.xml to /tmp/tmp0h57g3hh.ninjadroid/res/layout/main.xml
  >> NinjaDroid: [DEBUG] res/layout/main.xml looks like a generic file
  >> NinjaDroid: [DEBUG] Reading file: filepath="/tmp/tmp0h57g3hh.ninjadroid/res/layout/main.xml"
  >> NinjaDroid: [DEBUG] Extracting APK resource resources.arsc to /tmp/tmp0h57g3hh.ninjadroid/resources.arsc
  >> NinjaDroid: [DEBUG] resources.arsc looks like a generic file
  >> NinjaDroid: [DEBUG] Reading file: filepath="/tmp/tmp0h57g3hh.ninjadroid/resources.arsc"
  >> NinjaDroid: [DEBUG] Extracting APK resource classes.dex to /tmp/tmp0h57g3hh.ninjadroid/classes.dex
  >> NinjaDroid: [DEBUG] classes.dex looks like a dex file
  >> NinjaDroid: [DEBUG] Parsing dex file: filepath="/tmp/tmp0h57g3hh.ninjadroid/classes.dex", filename="classes.dex"
  >> NinjaDroid: [DEBUG] Reading file: filepath="/tmp/tmp0h57g3hh.ninjadroid/classes.dex"
  >> NinjaDroid: [DEBUG] Extracting strings...
  >> NinjaDroid: [DEBUG] Strings extracted: 21
  >> NinjaDroid: [DEBUG] Extracting URLs...
  >> NinjaDroid: [DEBUG] URLs extracted: 0 
  >> NinjaDroid: [DEBUG] Extracting shell commands...
  >> NinjaDroid: [DEBUG] Shell commands extracted: 1
  >> NinjaDroid: [DEBUG] Extracting APK resource META-INF/MANIFEST.MF to /tmp/tmp0h57g3hh.ninjadroid/META-INF/MANIFEST.MF
  >> NinjaDroid: [DEBUG] META-INF/MANIFEST.MF looks like a generic file
  >> NinjaDroid: [DEBUG] Reading file: filepath="/tmp/tmp0h57g3hh.ninjadroid/META-INF/MANIFEST.MF"
  >> NinjaDroid: [DEBUG] Extracting APK resource META-INF/CERT.SF to /tmp/tmp0h57g3hh.ninjadroid/META-INF/CERT.SF
  >> NinjaDroid: [DEBUG] META-INF/CERT.SF looks like a generic file
  >> NinjaDroid: [DEBUG] Reading file: filepath="/tmp/tmp0h57g3hh.ninjadroid/META-INF/CERT.SF"
  >> NinjaDroid: [DEBUG] Extracting APK resource META-INF/CERT.RSA to /tmp/tmp0h57g3hh.ninjadroid/META-INF/CERT.RSA
  >> NinjaDroid: [DEBUG] META-INF/CERT.RSA looks like a CERT file
  >> NinjaDroid: [DEBUG] Parsing CERT file: filepath="/tmp/tmp0h57g3hh.ninjadroid/META-INF/CERT.RSA", filename="META-INF/CERT.RSA"
  >> NinjaDroid: [DEBUG] Reading file: filepath="/tmp/tmp0h57g3hh.ninjadroid/META-INF/CERT.RSA"
  >> NinjaDroid: [INFO] Creating output/...
  >> NinjaDroid: [DEBUG] apktool path: /app/NinjaDroid/ninjadroid/use_cases/../apktool/apktool.jar
  >> NinjaDroid: [INFO] Executing apktool...
  >> NinjaDroid: [INFO] Creating output/smali/...
  >> NinjaDroid: [INFO] Creating output/AndroidManifest.xml...
  >> NinjaDroid: [INFO] Creating output/res/...
  >> NinjaDroid: [INFO] Creating output/assets/...
  >> NinjaDroid: [DEBUG] apktool command: `java -jar /app/NinjaDroid/ninjadroid/use_cases/../apktool/apktool.jar -q decode -f regression/data/Example.apk -o output`
  >> NinjaDroid: [DEBUG] dex2jar path: /app/NinjaDroid/ninjadroid/use_cases/../dex2jar/d2j-dex2jar.sh
  >> NinjaDroid: [INFO] Executing dex2jar...
  >> NinjaDroid: [INFO] Creating output/Example.jar...
  >> NinjaDroid: [DEBUG] dex2jar command: `/app/NinjaDroid/ninjadroid/use_cases/../dex2jar/d2j-dex2jar.sh -f regression/data/Example.apk -o output/Example.jar`
/app/NinjaDroid/ninjadroid/use_cases/../dex2jar/d2j-dex2jar.sh: line 32: dirname: command not found
/app/NinjaDroid/ninjadroid/use_cases/../dex2jar/d2j-dex2jar.sh: line 36: /d2j_invoke.sh: No such file or directory
  >> NinjaDroid: [INFO] Extracting certificate file...
  >> NinjaDroid: [INFO] Creating output/META-INF/CERT.RSA...
  >> NinjaDroid: [INFO] Extracting DEX files...
  >> NinjaDroid: [INFO] Creating output/classes.dex...
  >> NinjaDroid: [INFO] Generating JSON report file...
  >> NinjaDroid: [INFO] Creating output/report-Example.json...