#!/bin/bash
# Phase 5 — Mobile Testing
source "$(dirname "$0")/lib.sh"

phase_header "PHASE 5 — Mobile Testing (Android / iOS / BLE)"

section "Android Core"
chk "adb"                       adb
chk "apktool"                   apktool
chk "jadx"                      jadx
chk "dex2jar"                   d2j-dex2jar

section "Frida & Dynamic Analysis"
chk "frida"                     frida
chk "frida-ps"                  frida-ps
chk "frida-trace"               frida-trace
chk "objection"                 objection
chk "setup-frida-server"        setup-frida-server

section "SSL Pinning Bypass"
chk_py "reFlutter"              reflutter
chk "apk-mitm"                  apk-mitm

section "APK Repackaging"
chk "uber-apk-signer"           uber-apk-signer
chk_file "uber-apk-signer.jar"  /opt/uber-apk-signer/uber-apk-signer.jar

section "Static Analysis"
chk "apkleaks"                  apkleaks
chk_py "androguard"             androguard
chk_py "trufflehog3"            trufflehog3

section "Component Exploitation"
chk_py "drozer"                 drozer
chk_file "drozer-agent.apk"     /opt/drozer/drozer-agent.apk

section "Cross-Platform Apps"
chk_py "hermes-dec"             hermes_dec
chk_py "hbctool"                hbctool
chk_opt "doldrums"              doldrums   # no PyPI package — use git clone manually
chk_py "lz4"                    lz4
chk "monodis"                   monodis
chk "js-beautify"               js-beautify

section "Malware & C2"
chk "qrcode"                    qrcode
chk_py "qrcode"                 qrcode
chk_opt "TheFatRat"             /opt/TheFatRat  # interactive GUI tool — optional
chk "msfvenom"                  msfvenom

section "iOS"
chk "ssh"                       ssh

section "BLE"
chk_py "bleak"                  bleak
chk_dir "crackle"               /opt/crackle

phase_summary
