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.
- package/LICENSE +21 -0
- package/README.md +249 -0
- package/anais.sh +669 -0
- package/analysis_tools/__pycache__/apk_basic_info.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/apk_basic_info.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/check_zip_encryption.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/check_zip_encryption.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/detect_obfuscation.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/detect_obfuscation.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/dex_payload_hunter.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/entropy_analyzer.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/error_logger.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/error_logger.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/find_encrypted_payload.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/fix_apk_headers.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/fix_apk_headers.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/manifest_analyzer.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/manifest_analyzer.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/network_analyzer.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/network_analyzer.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/report_generator.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/report_generator.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/report_generator_modular.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/sast_scanner.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/sast_scanner.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/so_string_analyzer.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/yara_enhanced_analyzer.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/yara_results_processor.cpython-314.pyc +0 -0
- package/analysis_tools/apk_basic_info.py +85 -0
- package/analysis_tools/check_zip_encryption.py +142 -0
- package/analysis_tools/detect_obfuscation.py +650 -0
- package/analysis_tools/dex_payload_hunter.py +734 -0
- package/analysis_tools/entropy_analyzer.py +335 -0
- package/analysis_tools/error_logger.py +75 -0
- package/analysis_tools/find_encrypted_payload.py +485 -0
- package/analysis_tools/fix_apk_headers.py +154 -0
- package/analysis_tools/manifest_analyzer.py +214 -0
- package/analysis_tools/network_analyzer.py +287 -0
- package/analysis_tools/report_generator.py +506 -0
- package/analysis_tools/report_generator_modular.py +885 -0
- package/analysis_tools/sast_scanner.py +412 -0
- package/analysis_tools/so_string_analyzer.py +406 -0
- package/analysis_tools/yara_enhanced_analyzer.py +330 -0
- package/analysis_tools/yara_results_processor.py +368 -0
- package/analyzer_config.json +113 -0
- package/apkid/__init__.py +32 -0
- package/apkid/__pycache__/__init__.cpython-313.pyc +0 -0
- package/apkid/__pycache__/__init__.cpython-314.pyc +0 -0
- package/apkid/__pycache__/apkid.cpython-313.pyc +0 -0
- package/apkid/__pycache__/apkid.cpython-314.pyc +0 -0
- package/apkid/__pycache__/main.cpython-313.pyc +0 -0
- package/apkid/__pycache__/main.cpython-314.pyc +0 -0
- package/apkid/__pycache__/output.cpython-313.pyc +0 -0
- package/apkid/__pycache__/rules.cpython-313.pyc +0 -0
- package/apkid/apkid.py +266 -0
- package/apkid/main.py +98 -0
- package/apkid/output.py +177 -0
- package/apkid/rules/apk/common.yara +68 -0
- package/apkid/rules/apk/obfuscators.yara +118 -0
- package/apkid/rules/apk/packers.yara +1197 -0
- package/apkid/rules/apk/protectors.yara +301 -0
- package/apkid/rules/dex/abnormal.yara +104 -0
- package/apkid/rules/dex/anti-vm.yara +568 -0
- package/apkid/rules/dex/common.yara +60 -0
- package/apkid/rules/dex/compilers.yara +434 -0
- package/apkid/rules/dex/obfuscators.yara +602 -0
- package/apkid/rules/dex/packers.yara +761 -0
- package/apkid/rules/dex/protectors.yara +520 -0
- package/apkid/rules/dll/common.yara +38 -0
- package/apkid/rules/dll/obfuscators.yara +43 -0
- package/apkid/rules/elf/anti-vm.yara +43 -0
- package/apkid/rules/elf/common.yara +54 -0
- package/apkid/rules/elf/obfuscators.yara +991 -0
- package/apkid/rules/elf/packers.yara +1128 -0
- package/apkid/rules/elf/protectors.yara +794 -0
- package/apkid/rules/res/common.yara +43 -0
- package/apkid/rules/res/obfuscators.yara +46 -0
- package/apkid/rules/res/protectors.yara +46 -0
- package/apkid/rules.py +77 -0
- package/bin/anais +3 -0
- package/dist/cli.js +82 -0
- package/dist/index.js +123 -0
- package/dist/types/index.js +2 -0
- package/dist/utils/index.js +21 -0
- package/dist/utils/output.js +44 -0
- package/dist/utils/paths.js +107 -0
- package/docs/ARCHITECTURE.txt +353 -0
- package/docs/Workflow and Reference.md +445 -0
- package/package.json +70 -0
- package/rules/yara_general_rules.yar +323 -0
- package/scripts/dynamic_analysis_helper.sh +334 -0
- package/scripts/frida/dpt_dex_dumper.js +145 -0
- package/scripts/frida/frida_dex_dump.js +145 -0
- package/scripts/frida/frida_hooks.js +437 -0
- package/scripts/frida/frida_websocket_extractor.js +154 -0
- package/scripts/setup.sh +206 -0
- package/scripts/validate_framework.sh +224 -0
- package/src/cli.ts +91 -0
- package/src/index.ts +123 -0
- package/src/types/index.ts +44 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/output.ts +50 -0
- package/src/utils/paths.ts +72 -0
- 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
|
+
[](https://www.npmjs.com/package/anais-apk-forensic)
|
|
6
|
+
[](https://nodejs.org)
|
|
7
|
+
[](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
|