anais-apk-forensic 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +249 -0
  3. package/anais.sh +669 -0
  4. package/analysis_tools/__pycache__/apk_basic_info.cpython-313.pyc +0 -0
  5. package/analysis_tools/__pycache__/apk_basic_info.cpython-314.pyc +0 -0
  6. package/analysis_tools/__pycache__/check_zip_encryption.cpython-313.pyc +0 -0
  7. package/analysis_tools/__pycache__/check_zip_encryption.cpython-314.pyc +0 -0
  8. package/analysis_tools/__pycache__/detect_obfuscation.cpython-313.pyc +0 -0
  9. package/analysis_tools/__pycache__/detect_obfuscation.cpython-314.pyc +0 -0
  10. package/analysis_tools/__pycache__/dex_payload_hunter.cpython-314.pyc +0 -0
  11. package/analysis_tools/__pycache__/entropy_analyzer.cpython-314.pyc +0 -0
  12. package/analysis_tools/__pycache__/error_logger.cpython-313.pyc +0 -0
  13. package/analysis_tools/__pycache__/error_logger.cpython-314.pyc +0 -0
  14. package/analysis_tools/__pycache__/find_encrypted_payload.cpython-314.pyc +0 -0
  15. package/analysis_tools/__pycache__/fix_apk_headers.cpython-313.pyc +0 -0
  16. package/analysis_tools/__pycache__/fix_apk_headers.cpython-314.pyc +0 -0
  17. package/analysis_tools/__pycache__/manifest_analyzer.cpython-313.pyc +0 -0
  18. package/analysis_tools/__pycache__/manifest_analyzer.cpython-314.pyc +0 -0
  19. package/analysis_tools/__pycache__/network_analyzer.cpython-313.pyc +0 -0
  20. package/analysis_tools/__pycache__/network_analyzer.cpython-314.pyc +0 -0
  21. package/analysis_tools/__pycache__/report_generator.cpython-313.pyc +0 -0
  22. package/analysis_tools/__pycache__/report_generator.cpython-314.pyc +0 -0
  23. package/analysis_tools/__pycache__/report_generator_modular.cpython-314.pyc +0 -0
  24. package/analysis_tools/__pycache__/sast_scanner.cpython-313.pyc +0 -0
  25. package/analysis_tools/__pycache__/sast_scanner.cpython-314.pyc +0 -0
  26. package/analysis_tools/__pycache__/so_string_analyzer.cpython-314.pyc +0 -0
  27. package/analysis_tools/__pycache__/yara_enhanced_analyzer.cpython-314.pyc +0 -0
  28. package/analysis_tools/__pycache__/yara_results_processor.cpython-314.pyc +0 -0
  29. package/analysis_tools/apk_basic_info.py +85 -0
  30. package/analysis_tools/check_zip_encryption.py +142 -0
  31. package/analysis_tools/detect_obfuscation.py +650 -0
  32. package/analysis_tools/dex_payload_hunter.py +734 -0
  33. package/analysis_tools/entropy_analyzer.py +335 -0
  34. package/analysis_tools/error_logger.py +75 -0
  35. package/analysis_tools/find_encrypted_payload.py +485 -0
  36. package/analysis_tools/fix_apk_headers.py +154 -0
  37. package/analysis_tools/manifest_analyzer.py +214 -0
  38. package/analysis_tools/network_analyzer.py +287 -0
  39. package/analysis_tools/report_generator.py +506 -0
  40. package/analysis_tools/report_generator_modular.py +885 -0
  41. package/analysis_tools/sast_scanner.py +412 -0
  42. package/analysis_tools/so_string_analyzer.py +406 -0
  43. package/analysis_tools/yara_enhanced_analyzer.py +330 -0
  44. package/analysis_tools/yara_results_processor.py +368 -0
  45. package/analyzer_config.json +113 -0
  46. package/apkid/__init__.py +32 -0
  47. package/apkid/__pycache__/__init__.cpython-313.pyc +0 -0
  48. package/apkid/__pycache__/__init__.cpython-314.pyc +0 -0
  49. package/apkid/__pycache__/apkid.cpython-313.pyc +0 -0
  50. package/apkid/__pycache__/apkid.cpython-314.pyc +0 -0
  51. package/apkid/__pycache__/main.cpython-313.pyc +0 -0
  52. package/apkid/__pycache__/main.cpython-314.pyc +0 -0
  53. package/apkid/__pycache__/output.cpython-313.pyc +0 -0
  54. package/apkid/__pycache__/rules.cpython-313.pyc +0 -0
  55. package/apkid/apkid.py +266 -0
  56. package/apkid/main.py +98 -0
  57. package/apkid/output.py +177 -0
  58. package/apkid/rules/apk/common.yara +68 -0
  59. package/apkid/rules/apk/obfuscators.yara +118 -0
  60. package/apkid/rules/apk/packers.yara +1197 -0
  61. package/apkid/rules/apk/protectors.yara +301 -0
  62. package/apkid/rules/dex/abnormal.yara +104 -0
  63. package/apkid/rules/dex/anti-vm.yara +568 -0
  64. package/apkid/rules/dex/common.yara +60 -0
  65. package/apkid/rules/dex/compilers.yara +434 -0
  66. package/apkid/rules/dex/obfuscators.yara +602 -0
  67. package/apkid/rules/dex/packers.yara +761 -0
  68. package/apkid/rules/dex/protectors.yara +520 -0
  69. package/apkid/rules/dll/common.yara +38 -0
  70. package/apkid/rules/dll/obfuscators.yara +43 -0
  71. package/apkid/rules/elf/anti-vm.yara +43 -0
  72. package/apkid/rules/elf/common.yara +54 -0
  73. package/apkid/rules/elf/obfuscators.yara +991 -0
  74. package/apkid/rules/elf/packers.yara +1128 -0
  75. package/apkid/rules/elf/protectors.yara +794 -0
  76. package/apkid/rules/res/common.yara +43 -0
  77. package/apkid/rules/res/obfuscators.yara +46 -0
  78. package/apkid/rules/res/protectors.yara +46 -0
  79. package/apkid/rules.py +77 -0
  80. package/bin/anais +3 -0
  81. package/dist/cli.js +82 -0
  82. package/dist/index.js +123 -0
  83. package/dist/types/index.js +2 -0
  84. package/dist/utils/index.js +21 -0
  85. package/dist/utils/output.js +44 -0
  86. package/dist/utils/paths.js +107 -0
  87. package/docs/ARCHITECTURE.txt +353 -0
  88. package/docs/Workflow and Reference.md +445 -0
  89. package/package.json +70 -0
  90. package/rules/yara_general_rules.yar +323 -0
  91. package/scripts/dynamic_analysis_helper.sh +334 -0
  92. package/scripts/frida/dpt_dex_dumper.js +145 -0
  93. package/scripts/frida/frida_dex_dump.js +145 -0
  94. package/scripts/frida/frida_hooks.js +437 -0
  95. package/scripts/frida/frida_websocket_extractor.js +154 -0
  96. package/scripts/setup.sh +206 -0
  97. package/scripts/validate_framework.sh +224 -0
  98. package/src/cli.ts +91 -0
  99. package/src/index.ts +123 -0
  100. package/src/types/index.ts +44 -0
  101. package/src/utils/index.ts +6 -0
  102. package/src/utils/output.ts +50 -0
  103. package/src/utils/paths.ts +72 -0
  104. package/tsconfig.json +14 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 reezcode
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,249 @@
1
+ # Anais APK Forensic Automation
2
+
3
+ > Comprehensive APK security analysis and SAST scanner for Android applications
4
+
5
+ [![npm version](https://img.shields.io/npm/v/anais-apk-forensic.svg)](https://www.npmjs.com/package/anais-apk-forensic)
6
+ [![Node.js Version](https://img.shields.io/node/v/anais-apk-forensic.svg)](https://nodejs.org)
7
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
8
+
9
+ ## 🔍 Overview
10
+
11
+ Anais is an automated APK forensic analysis framework designed for mobile security researchers, penetration testers, and malware analysts. It provides comprehensive static and dynamic analysis capabilities with support for various protection bypass techniques.
12
+
13
+ ### Key Features
14
+
15
+ - 🛡️ **Advanced Obfuscation Detection** - ProGuard, R8, DPT-Shell, DexProtector, and more
16
+ - 🔬 **Multi-Tool Integration** - APKTool, JADX, YARA, Androguard
17
+ - 🎯 **SAST Engine** - Static Application Security Testing with pattern matching
18
+ - 📊 **Detailed Reporting** - Markdown and JSON formatted analysis reports
19
+ - 🔄 **Dynamic Analysis** - Frida-based runtime analysis and DEX dumping
20
+ - 🌐 **Network Analysis** - Traffic pattern detection and URL extraction
21
+ - 🔐 **Crypto Detection** - Weak cryptography and security vulnerability identification
22
+
23
+ ## 📁 Project Structure
24
+
25
+ ```
26
+ Anais/
27
+ ├── anais.sh # Main analysis orchestrator
28
+ ├── analyzer_config.json # Configuration file
29
+ ├── package.json # npm package configuration
30
+ ├── README.md # This file
31
+ ├── bin/anais # CLI executable
32
+ ├── src/ # TypeScript CLI source
33
+ │ ├── cli.ts # CLI entry point
34
+ │ ├── index.ts # Main logic
35
+ │ └── utils/ # Utility functions
36
+ │ └── src/ # CLI source code
37
+ ├── analysis_tools/ # Python analysis modules
38
+ │ ├── apk_basic_info.py # APK information extractor
39
+ │ ├── detect_obfuscation.py # Obfuscation detector
40
+ │ ├── sast_scanner.py # SAST engine
41
+ │ ├── manifest_analyzer.py # Manifest analyzer
42
+ │ ├── network_analyzer.py # Network traffic analyzer
43
+ │ └── report_generator.py # Report generator
44
+ ├── scripts/ # Utility scripts
45
+ │ ├── setup.sh # Environment setup
46
+ │ ├── validate_framework.sh # Framework validation
47
+ │ ├── dynamic_analysis_helper.sh # Dynamic analysis helper
48
+ │ └── frida/ # Frida scripts
49
+ │ ├── frida_dex_dump.js # DEX dumper
50
+ │ ├── frida_hooks.js # General hooks
51
+ │ └── dpt_dex_dumper.js # DPT shell dumper
52
+ ├── rules/ # YARA rules
53
+ │ └── yara_general_rules.yar # General malware detection rules
54
+ ├── apkid/ # APKiD integration
55
+ └── docs/ # Documentation
56
+ ├── ARCHITECTURE.txt # Architecture documentation
57
+ ├── Workflow and Reference.md # Workflow reference
58
+ └── DECRYPT_DPT_SHELL.md # DPT shell decryption guide
59
+ ```
60
+
61
+ ## 🚀 Quick Start
62
+
63
+ ### Prerequisites
64
+
65
+ - **macOS/Linux** operating system
66
+ - **Python 3.8+** with pip
67
+ - **Java JDK 8+**
68
+ - **Node.js 14+**
69
+ - **Android SDK Platform Tools** (for dynamic analysis)
70
+ - **Frida** (optional, for dynamic analysis)
71
+
72
+ **Required Tools:**
73
+
74
+ - [APKTool](https://ibotpeaches.github.io/Apktool/) - APK decompilation
75
+ - [JADX](https://github.com/skylot/jadx) - DEX to Java decompiler
76
+ - [YARA](https://virustotal.github.io/yara/) - Malware pattern matching
77
+
78
+ ### Installation
79
+
80
+ #### Option 1: Install via npm (Recommended)
81
+
82
+ ```bash
83
+ npm install -g anais-apk-forensic
84
+ ```
85
+
86
+ Then run:
87
+
88
+ ```bash
89
+ anais /path/to/app.apk
90
+ ```
91
+
92
+ #### Option 2: Install from Source
93
+
94
+ 1. **Clone the repository**
95
+
96
+ ```bash
97
+ git clone https://github.com/reezcode/Anais-APK-Forensic-Automation.git
98
+ cd Anais-APK-Forensic-Automation
99
+ ```
100
+
101
+ 2. **Install dependencies**
102
+
103
+ ```bash
104
+ npm install
105
+ npm run build
106
+ npm link
107
+ ```
108
+
109
+ 3. **Run setup script**
110
+
111
+ ```bash
112
+ ./scripts/setup.sh
113
+ ```
114
+
115
+ 4. **Validate installation**
116
+ ```bash
117
+ ./scripts/validate_framework.sh
118
+ ```
119
+
120
+ ### Basic Usage
121
+
122
+ **Analyze an APK file:**
123
+
124
+ ```bash
125
+ ./anais.sh /path/to/app.apk
126
+ ```
127
+
128
+ **Using the CLI wrapper:**
129
+
130
+ ```bash
131
+ cd anais-apk-forensic-cli
132
+ npm install
133
+ npm link
134
+ anais /path/to/app.apk
135
+ ```
136
+
137
+ **View the generated report:**
138
+
139
+ ```bash
140
+ cat ~/Documents/Anais-Reports/app_name_*/report.md
141
+ ```
142
+
143
+ ## 📖 Usage Examples
144
+
145
+ ### Static Analysis
146
+
147
+ ```bash
148
+ # Full static analysis
149
+ ./anais.sh suspicious.apk
150
+
151
+ # View JSON report for programmatic access
152
+ cat ~/Documents/Anais-Reports/suspicious_*/report.json
153
+ ```
154
+
155
+ ### Dynamic Analysis
156
+
157
+ ```bash
158
+ # Install Frida on device
159
+ ./scripts/dynamic_analysis_helper.sh install-frida
160
+
161
+ # Dump DEX from running app
162
+ ./scripts/dynamic_analysis_helper.sh dex-dump com.package.name
163
+
164
+ # Hook crypto functions
165
+ ./scripts/dynamic_analysis_helper.sh hook-crypto com.package.name
166
+
167
+ # Pull dumped files
168
+ ./scripts/dynamic_analysis_helper.sh pull-dumps
169
+ ```
170
+
171
+ ## 🔧 Configuration
172
+
173
+ Edit `analyzer_config.json` to customize:
174
+
175
+ - **Paths** - Workspace, tools, and reports locations
176
+ - **Tools** - Enable/disable APKTool, JADX, YARA
177
+ - **Analysis** - Toggle specific analysis modules
178
+ - **YARA** - Configure rule scanning options
179
+
180
+ ## 📊 Report Output
181
+
182
+ Analysis reports are saved to `~/Documents/Anais-Reports/` with:
183
+
184
+ - **report.md** - Human-readable Markdown report
185
+ - **report.json** - Machine-readable JSON report
186
+ - **Detailed findings** - SAST, YARA, entropy, manifest, network analysis
187
+ - **Recommendations** - Security improvement suggestions
188
+
189
+ ### Severity Levels
190
+
191
+ | Level | Score | Description |
192
+ | ----------- | ------ | ------------------------------------------------------- |
193
+ | 🔴 CRITICAL | 70-100 | Confirmed malicious activity, immediate action required |
194
+ | 🟠 HIGH | 40-69 | Suspicious patterns detected, investigation needed |
195
+ | 🟡 MEDIUM | 20-39 | Security concerns, review recommended |
196
+ | 🟢 LOW | 0-19 | Minor issues, informational |
197
+
198
+ ## 🛠️ Advanced Features
199
+
200
+ ### Supported Protection Types
201
+
202
+ - **ProGuard/R8** - Basic obfuscation (static analysis)
203
+ - **DPT-Shell** - Native DEX encryption (dynamic unpacking required)
204
+ - **DexProtector** - Control flow obfuscation (memory dump)
205
+ - **Bangcle** - Application wrapper (runtime analysis)
206
+
207
+ ### YARA Rules
208
+
209
+ Custom YARA rules in `rules/yara_general_rules.yar` for detecting:
210
+
211
+ - Malware families
212
+ - Suspicious behaviors
213
+ - Known exploits
214
+ - Privacy violations
215
+
216
+ ## 🤝 Contributing
217
+
218
+ Contributions are welcome! Please:
219
+
220
+ 1. Fork the repository
221
+ 2. Create a feature branch
222
+ 3. Make your changes
223
+ 4. Submit a pull request
224
+
225
+ ## 📝 License
226
+
227
+ This project is licensed under the MIT License - see the LICENSE file for details.
228
+
229
+ ## ⚠️ Disclaimer
230
+
231
+ This tool is intended for security research and educational purposes only. Always obtain proper authorization before analyzing applications you do not own.
232
+
233
+ ## 👤 Author
234
+
235
+ **Mobile CySec Expert**
236
+
237
+ - GitHub: [@reezcode](https://github.com/reezcode)
238
+
239
+ ## 🙏 Acknowledgments
240
+
241
+ - APKTool
242
+ - JADX
243
+ - YARA
244
+ - Androguard
245
+ - Frida
246
+
247
+ ---
248
+
249
+ **Anais Static Core v1.0** | Comprehensive APK Security Analysis & SAST