Skip to Content
mobsec

Rebuild from scratch

Two artefacts describe a rebuild:

  • GUIDE-from-scratch.md — the narrative walkthrough (12 sections, beginner-friendly, includes the interactive Magisk UI steps and every download URL).
  • bootstrap.sh / fetch-deps.sh / install-device.sh / setup-keybox.sh / setup-net.sh — the automated path, in that order.

Automated path

git clone <your copy> ~/mobsec && cd ~/mobsec

./bootstrap.sh --sdk        # host deps, pipx tools, Android SDK, AVD creation, PATH block
emulator -avd pentest16 -no-snapshot -no-boot-anim &
./fetch-deps.sh             # frida-server (x86_64 + arm64), jadx, apktool, scrcpy, rootAVD
# >>> root the image with rootAVD (interactive, see GUIDE §4) <<<
./install-device.sh         # Magisk modules, frida-server staging, zygisk policy, reboot
./setup-keybox.sh           # fetch + validate + install a keybox
./setup-net.sh              # install mitm CA into the system store, proxy + tunnel
pentestctl status

Why the order is fixed

StepDepends onFails if skipped
bootstrap.sh—no SDK/adb/emulator/AVD
fetch-deps.shnetworknothing to install downstream
rootAVDbooted, unrooted deviceinstall-device.sh aborts on missing su
install-device.shrootno TrickyStore/PIF/Cert-Fixer/fsrv
setup-keybox.shTrickyStore on deviceattestation stays software/AOSP
setup-net.shCert-Fixer installed + one bootuser apps work, GMS/Play Store do not

install-device.sh finishes with a reboot; wait for adb wait-for-device before continuing.

What is interactive

Only Magisk's first-run flow: Install → Patch firmware/image → Select from storage → fakeboot.img → OK → additional setup → reboot, plus granting su to shell. GUIDE §4 has the exact taps; uitap can drive them by text, but expect to babysit it once.

Sharing the rig with a colleague

zip -qr ~/share-zip/mobsec-rig-$(date +%Y%m%d).zip ~/mobsec \
  -x '*/tools/jadx*' '*/tools/scrcpy*' '*/tools/apktool*' '*/tools/frida-server-*' \
     '*/modules/MagiskFrida*' '*/modules/archive/*' '*/apks/*' '*/tools/medusa/.venv/*' \
     '*/site/*' '*/.mobsec/*' '*/__pycache__/*'

Deliberately excluded, with reasons:

ExcludedWhy
keybox.xml, .pem, .p12key material; the recipient must fetch their own
~/.mobsec/session, ~/.mitmproxylive cookies/tokens and your private CA
AVD snapshots5 GB each, host-specific
tool binaries (jadx, scrcpy, frida-server)re-downloadable via fetch-deps.sh, keeps the zip ~25 MB
MagiskFrida-*.zip141 MB, superseded by the fsrv module

The recipient still needs their own adb device and must run setup-net.sh so their mitmproxy CA (not ours) is installed. SHARING.md in the archive carries the exact run order and this table.

Verification after a rebuild

pentestctl status                                  # every section green
frida-ps -U | head -3                              # 150+ processes
curl -s -x 127.0.0.1:18080 -o /dev/null -w '%{http_code}\n' https://example.org   # 200
fspawn tech.httptoolkit.pinning_demo intercept     # "OkHTTP pinned request - Success"
recon com.android.settings --deep                  # recon sanity check
snap save logged-in                                # your first restore point

Version pinning that matters

ComponentVersionWhy pinned
Magisk31.1Zygisk Next expects it; older Magisk has no --sqlite settings write
Zygisk Next1.5.3-880later builds changed zygiskd flags
frida-server17.27.5must match host frida exactly; 17.x removed global, changed Module API
Frida host17.27.5mismatch = "unable to communicate with remote frida-server"
PlayIntegrityFix4.9-inject-sv19 has no x86_64 zygisk lib
jadx1.5.7apkleaks shells out to it
mitmproxy12.3.1addon uses http.HTTPFlow API (stable since 9)

When you bump a version, re-run the verification list top to bottom before trusting the rig.

On this page