[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-115013":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":15,"stars30d":15,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":16,"rankGlobal":9,"rankLanguage":9,"license":17,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":20,"topics":21,"createdAt":9,"pushedAt":32,"updatedAt":33,"readmeContent":34,"aiSummary":35,"trendingCount":14,"starSnapshotCount":14,"syncStatus":36,"lastSyncTime":37,"discoverSource":38},115013,"zhidun","zhidun2027\u002Fzhidun","zhidun2027","Android APK hardening — DEX encryption, native shell engine, anti-tamper. Fully documented and auditable.",null,"C",74,5,3,0,49,67.23,"MIT License",false,"main",true,[22,23,24,25,26,27,28,29,30,31],"android","android-security","apk","app-protection","dex","hardening","obfuscation","packer","reverse-engineering","security","2026-11-12 05:16:22","2026-11-21 04:39:17","\u003Cdiv align=\"center\">\n\n# 🛡 zhidun\n\n**Android APK hardening — DEX encryption · native shell engine · anti-tamper.**\n\nEnglish&nbsp;|&nbsp;[日本語](README.ja.md)\n\n![version](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fversion-3.3.7-39d98a)\n![platform](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fplatform-Windows%20%7C%20Linux-49cfe0)\n![jdk](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FJDK-21-blue)\n![signing](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fsigning-v1%20%7C%20v2%20%7C%20v3-39d98a)\n![stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fzhidun2027\u002Fzhidun?style=flat)\n[![download](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fv\u002Frelease\u002Fzhidun2027\u002Fzhidun?label=download&color=39d98a)](https:\u002F\u002Fgithub.com\u002Fzhidun2027\u002Fzhidun\u002Freleases\u002Flatest)\n\n[Download](https:\u002F\u002Fgithub.com\u002Fzhidun2027\u002Fzhidun\u002Freleases\u002Flatest) · [Website](https:\u002F\u002Fzhidun2027.github.io\u002Fzhidun\u002F) · [Quick Start](#quick-start) · [How it works](#how-it-works) · [Verified](#verified)\n\n\u003C\u002Fdiv>\n\n---\n\nWrap your Android app in a shell. The original DEX is encrypted and hidden in `assets`, then restored at runtime by a `StubApp` and a native engine. Reverse engineers get a shell — not your code. One command runs **decompile → encrypt → inject → align → re-sign**.\n\n```console\n$ zhidun protect .\u002Fapp.apk --keystore release.jks\n[✓] decompile · apktool\n[✓] encrypt original DEX   → assets\u002Fnivye\n[✓] build cls_key          dexKey \u002F signa \u002F ...\n[✓] inject shell + .so     arm64 · v7a · x86_64 · mips64\n[✓] rewrite Manifest       com.youyou.shell.StubApp\n[✓] zipalign + re-sign     v1 \u002F v2 \u002F v3\n→ app_shell_sign.apk  hardened\n```\n\n## Features\n\n- **DEX encryption** — the original `classes.dex` is packed, encrypted, and hidden in `assets`; no plaintext code remains in the APK. Custom stream cipher, a fresh random key per build.\n- **Native engine** — `libjiaguo.so` runs across four ABIs (arm64-v8a, armeabi-v7a, x86_64, mips64). Decryption, integrity checks, and swapping back the real `Application` happen in native code.\n- **Shell loader** — `StubApp` loads the `.so` in `attachBaseContext`, reads `cls_key` to derive the `dexKey`, restores the original DEX, and swaps the real entry back via `RefInvoke`.\n- **Anti-debugging** — detects `ptrace` via `TracerPid` in `\u002Fproc\u002Fself\u002Fstatus`; a watchdog thread catches timing drift and exits on anomaly.\n- **Environment detection** — flags root, Xposed \u002F Substrate, HTTP proxy, VPN, app-cloning, USB debugging, and developer options.\n- **Multi-scheme signing** — re-signs with apksig: JAR (v1) plus APK Signature Scheme v2 \u002F v3.\n\n## How it works\n\n```mermaid\nflowchart LR\n  A([APK]) --> B[decompile\u003Cbr\u002F>apktool]\n  B --> C[encrypt DEX\u003Cbr\u002F>random key]\n  C --> D[build cls_key]\n  D --> E[inject shell\u003Cbr\u002F>StubApp + .so]\n  E --> F[rewrite\u003Cbr\u002F>Manifest]\n  F --> G[repack]\n  G --> H[zipalign]\n  H --> I[re-sign\u003Cbr\u002F>v1\u002Fv2\u002Fv3]\n  I --> J([hardened APK])\n```\n\nAt runtime, the shell reverses it: `StubApp` → load `libjiaguo.so` → read `cls_key` → decrypt the original DEX → `RefInvoke` back to the real `Application`.\n\n## Verified\n\nHardening is only useful if the shell can restore the original app. We prove it: unshell a hardened APK with the tool's **own** algorithm — derive the `dexKey` from `cls_key`, decrypt the embedded DEX, and compare it with the original.\n\n```text\noriginal dex   776 B   md5 7943a0e0964c227d5351bd4a7eccfd1b\nrecovered dex  776 B   md5 7943a0e0964c227d5351bd4a7eccfd1b\n★ byte-for-byte identical — reversible, the shell restores the original app\n```\n\nThe full pipeline (decompile → encrypt → inject → rewrite → repack → align → sign) has been run end-to-end on a real APK, and the output passes `apksigner verify` on **v1 \u002F v2 \u002F v3**.\n\n## Quick Start\n\n### Prebuilt downloads\n\nGrab the [latest release](https:\u002F\u002Fgithub.com\u002Fzhidun2027\u002Fzhidun\u002Freleases\u002Flatest). All options need **Java 21** ([Temurin](https:\u002F\u002Fadoptium.net\u002Ftemurin\u002Freleases\u002F?version=21)) installed:\n\n- **Windows, simplest** — put `zhidun.bat` next to `zhidun-3.3.7-all.jar` and double-click the `.bat`. Plain launcher script, no antivirus false positives.\n- **Windows, one file** — `zhidun.exe`, double-click.\n- **Any OS** — `zhidun-3.3.7-all.jar`, run `java -jar zhidun-3.3.7-all.jar`.\n\n> `zhidun.exe` is an unsigned [Launch4j](https:\u002F\u002Flaunch4j.sourceforge.net\u002F) wrapper, so some antivirus engines may show a false positive — use `zhidun.bat` + the jar instead; it's the same code.\n\n### Build from source\n\nA Gradle project on **JDK 21**.\n\n```bash\n# launch the GUI (pick APK + keystore, hit start)\ncd app\n.\u002Fgradlew run\n\n# or build a single runnable jar\n.\u002Fgradlew fatJar\njava -jar build\u002Flibs\u002F*-all.jar\n```\n\n### Runtime setup\n\nThe tool looks for `config.dll` (the shell resource pack) and a `tools\u002F` folder in the working directory or next to the chosen APK:\n\n```text\nworkdir\u002F\n├── config.dll              # shell resource pack\n└── tools\u002F\n    ├── apktool(.bat)       # Windows \u002F Linux\n    └── zipalign(.exe)\n```\n\nSign with your **own** keystore. On Windows use `apktool.bat` + `zipalign.exe`; on Linux the extension-less versions.\n\n## Tech spec\n\n| | |\n|---|---|\n| Cipher | custom stream `^key ^3 -5` · MD5 · Base64 |\n| DEX key | random per build, partial (first 2048 bytes) for large files |\n| Shell entry | `com.youyou.shell.StubApp` |\n| Native engine | `libjiaguo.so` × 4 ABI |\n| Signing | apksig v1 \u002F v2 \u002F v3 |\n| UI | Java Swing · FlatLaf |\n| Platform | Windows · Linux |\n\n## Project layout\n\n```text\napp\u002F                 Java source — the hardening tool (Gradle, JDK 21)\nindex.html                landing page (GitHub Pages home)\ndocs\u002F                   technical docs — the full reverse-engineering writeup\nshell-contents\u002F        extracted contents of config.dll (shell payload, auditable)\nconfig.dll.decrypted.zip       decrypted config.dll (the raw ZIP)\nlibjiaguo-decompiled.c    full Ghidra decompilation of the native engine (212 funcs)\ntechnical-manual.md             technical manual\n```\n\n## Transparency\n\nNo black box — that is the point of this release. Every binary here is documented and auditable:\n\n- **`config.dll`** is just an encrypted ZIP (`encrypt(zip, \"2025_09\")`). Its full contents are extracted under [`shell-contents\u002F`](.\u002Fshell-contents) — the `StubApp` smali, the manifest, and the per-ABI `.so` — so you can confirm there is no hidden payload. It is a **build artifact, not a committed blob**: run [`build-config-dll.py`](.\u002Fbuild-config-dll.py) `build` to regenerate it from the visible ZIP and `verify` to check it byte-for-byte (the in-tool packer is [`ConfigPacker.java`](.\u002Fapp\u002Fsrc\u002Fmain\u002Fjava\u002FConfigPacker.java)).\n- **`libjiaguo.so`** (the native engine) is fully decompiled in [`libjiaguo-decompiled.c`](.\u002Flibjiaguo-decompiled.c) — all 212 functions. It handles encryption, anti-debugging, and DEX loading, and makes **no network calls and exfiltrates no data**.\n- The complete analysis — shell mechanism, cipher, every key, anti-debug and detection, even how to unpack it — is in the [documentation site](.\u002Fdocs\u002Findex.html) and [`technical-manual.md`](.\u002Ftechnical-manual.md).\n\nThis is a practical obfuscation layer, not an unbreakable vault, so the unpacking analysis is published too. Honesty over snake oil.\n\n## Contributing\n\nA technical release — ideas, audits, and PRs are welcome. The cipher is intentionally simple (a weak XOR stream cipher with hardcoded keys), which is the most obvious thing to improve. Good starting points:\n\n- A real cipher (AES\u002FRSA) with proper key derivation instead of hardcoded keys\n- More anti-tamper \u002F integrity checks and runtime detection\n- Newer Android and additional ABI support\n- A cleaner, buildable native engine\n\nOpen an issue or a PR — reverse-engineering notes and security audits are as welcome as code.\n\n## Contact\n\n- Email: singhrubensingh@gmail.com\n- Telegram: [@java2024](https:\u002F\u002Ft.me\u002Fjava2024)\n\n## Disclaimer\n\nzhidun is an Android app **hardening** tool, for protecting the code assets of **apps you own** against reverse engineering, tampering, and piracy. Use it only on applications you own or are explicitly authorized to modify. The authors are not responsible for misuse.\n\n## License\n\nMIT — see [LICENSE](.\u002FLICENSE). Bundled and dependent third-party components keep their own licenses; see [THIRD-PARTY-NOTICES.md](.\u002FTHIRD-PARTY-NOTICES.md).\n","zhidun 是一个面向 Android 应用的安全加固工具，用于保护 APK 免受逆向分析与篡改。其核心功能包括 DEX 文件加密隐藏、基于多 ABI 原生壳（.so）的运行时解密与加载、StubApp 入口替换、反调试与环境检测（如 root、Xposed、代理、USB 调试等），并支持 v1\u002Fv2\u002Fv3 签名重签。技术上采用 C 编写原生引擎，结合随机密钥流加密与 Java 反射动态还原机制，全过程可审计且文档完备。适用于对代码资产敏感的商业 Android 应用，尤其适合需对抗静态反编译与动态调试的金融、游戏及 SDK 类场景。",2,"2026-11-24 04:50:04","CREATED_QUERY"]