A complete AI-powered reverse engineering and malware analysis platform for Android APKs. It supports both static and native code analysis using Ghidra, Radare2, CodeBERT, and custom ML models.
ReverseAI-MalwareTool/
βββ backend/
β βββ app.py # Main Flask server
β βββ models/
β β βββ malware_classifier.py # ML model for predicting malware
β βββ utils/
β β βββ asm_inspector.py # Uses Radare2 for assembly inspection
β β βββ deobfuscator.py # Detects obfuscated code
β β βββ extract_methods.py # Extracts Java methods
β β βββ feature_extractor.py # Permissions, API calls, unpacking, JADX
β β βββ ghidra_runner.py # Runs Ghidra Headless analysis
β β βββ threat_classifier.py # Final verdict: malicious or not
β β βββ unzipper.py # APK structure analyzer
β βββ ghidra_scripts/
β β βββ ghidra_extract.py # Script executed by Ghidra
β βββ data/
β βββ (APK input/output folders)
βββ frontend/
β βββ public/
β βββ src/
β β βββ components/
β β β βββ ThreatReport.jsx # Component to render analysis results
β β βββ App.jsx # File upload + scan trigger
β β βββ index.js # React DOM rendering
βββ README.md # You are here
βββ requirements.txt # Python dependencies
You need the following installed on your system:
| Tool | Version Recommended |
|---|---|
| Python | 3.10+ |
| Node.js + npm | 16.x or 18.x |
| Apktool | 2.9+ |
| JADX | 1.4+ (CLI) |
| Ghidra | 11+ (headless support) |
| Radare2 | 5.9+ |
| Java | JDK 17 or 21 |
-
Clone the repo:
git clone https://github.com/your-org/ReverseAI-MalwareTool.git cd ReverseAI-MalwareTool/backend -
Create a virtual environment:
python -m venv venv venv\Scripts\activate # on Windows
-
Install dependencies:
pip install -r requirements.txt
-
Ensure tools are on PATH:
- Add these to your environment variables:
C:\Windows\Apktool\ C:\jadx\bin\ C:\Tools\radare2\radare2-5.9.8-w64\bin
- Add these to your environment variables:
-
Run backend server:
python app.py
-
Open a new terminal:
cd ../frontend npm install npm start -
React dev server runs at http://localhost:3000
- Upload APK from frontend.
- Flask receives the file β saves it.
- Extracts contents using:
apktool(manifest + smali)jadx(Java source)
- Runs:
- Permissions & API extraction
- Obfuscation check
- Native
.soscanning via:- 𧬠Ghidra (headless)
- π¬ Radare2 (assembly inspection)
- Java methods classified using CodeBERT.
- Final prediction using a trained RandomForestClassifier.
- Result JSON sent back to frontend.
- Frontend renders a beautiful report.
| Feature | Tool |
|---|---|
| APK unpacking | Apktool |
| Java decompilation | JADX |
| Native code reverse | Ghidra |
| Assembly inspection | Radare2 |
| Code classification | CodeBERT |
| Threat classification | RandomForest |
| Frontend UI | React |
| Backend API | Flask |
| File | Role |
|---|---|
app.py |
Main backend logic |
utils/feature_extractor.py |
Extracts APIs, permissions, decompiles code |
utils/asm_inspector.py |
Runs Radare2 on .so files |
utils/ghidra_runner.py |
Automates Ghidra headless execution |
utils/codebert_classifier.py |
Uses HuggingFace model to classify methods |
utils/threat_classifier.py |
Combines all signals to determine threat |
ghidra_scripts/ghidra_extract.py |
Custom Ghidra Python logic |
models/malware_classifier.py |
Our trained scikit-learn model |
- Make sure tools run in command line (like
apktool d test.apk) - Use a real APK to test β fake/test ones may not have
.sofiles. - If something fails, check:
- Output in terminal
data/folderprint()logs inapp.py
REPEAT-------------------------------------------------MORE INFO
ReverseAI is a powerful automated reverse engineering and malware analysis platform for Android apps (APKs). Designed for hackathons and real-world use, it uses AI + static analysis + reverse engineering to detect and classify malicious behavior β even in obfuscated apps with native libraries.
- β
Upload and analyze any
.apkvia a simple web interface - π¦ Reverse engineering using
apktool,jadx,Ghidra, andRadare2 - π Detect:
- Dangerous permissions
- Suspicious API calls
- Native
.solibraries - Obfuscation and asset packing
- π€ AI threat classification using:
RandomForestClassifieron feature vectorsCodeBERTon decompiled Java methods
- π Generate full threat reports in one click
ReverseAI-MalwareTool/
βββ app.py # π§ Main Flask backend (API logic & pipeline)
βββ train_model.py # π¬ (Optional) Used to train the RandomForest model from dataset.csv
βββ build_dataset.py # π§ Script to build dataset from benign/malware samples
βββ test_*.py # β
Test scripts for extractors & features
βββ data/ # π Data I/O
β βββ apks/ # Uploaded + test APKs
β βββ extracted/ # Decompiled Java + unpacked smali/native structure
β βββ ghidra_output.json # Ghidra headless output
β βββ dataset.csv # Feature vector dataset (for training)
β βββ malware/, benign/ # Sample APKs
βββ models/ # π€ AI Models
β βββ codebert_analyzer.py # Uses HuggingFace CodeBERT to classify method-level code
β βββ malware_classifier.py # Loads and uses RandomForest model
β βββ malware_model.pkl # Pre-trained RandomForest binary
βββ utils/ # π§ Reusable modules
β βββ feature_extractor.py # Runs apktool, jadx, permission/api/obfuscation scan
β βββ ghidra_runner.py # Automates Ghidra headless
β βββ asm_inspector.py # Uses Radare2 to disassemble native code
β βββ codebert_classifier.py # CodeBERT inference code
β βββ unzipper.py # Analyzes file structure/assets for malware signs
β βββ extract_methods.py # Extracts Java method bodies from Decompiled output
β βββ deobfuscator.py # Detects smali junk + naming obfuscation
β βββ threat_classifier.py # Combines all into final rule-based threat summary
βββ ghidra_scripts/
β βββ ghidra_extract.py # Ghidra Python script run during native analysis
βββ frontend/ # π¨ React Frontend
β βββ src/
β β βββ App.jsx # Main upload UI + result rendering
β β βββ components/ThreatReport.jsx # Result visualization component
β βββ package.json # React dependencies
βββ reports/ # Optional: store report exports
βββ ghidra_project/ # Ghidra project files (auto-created)
- Python 3.11+
- Node.js + npm
- Java 17+
- Tools:
cd backend/
python -m venv venv
venv\Scripts\activate # On Windows
pip install -r requirements.txtEnsure
apktool,jadx, andr2are added to your PATH and working from CMD.
cd frontend/
npm install
npm start- This runs at
http://localhost:3000 - Backend is served at
http://localhost:5000
When you upload an .apk, the following happens:
- Unpack + Decompile
apktool: Extracts AndroidManifest + smalijadx: Decompiled Java methods
- Feature Extraction
extract_permissions: Parses manifestlist_api_calls: Scans Java codedeobfuscate_code: Detects naming junk
- AI Prediction
RandomForestClassifier: Predicts malicious/benign based on permission/API count
- Ghidra + Radare2
- Native
.solibs analyzed for symbols
- Native
- CodeBERT
- Classifies Java method behavior (malicious, suspicious, benign)
- Threat Report
- All combined in a JSON response + frontend UI
- Launch both backend and frontend
- Upload an APK in the frontend
- Wait 5β15 seconds depending on file size
- See structured report in browser
- Frontend logic lives in
frontend/src/components/ThreatReport.jsx - Backend starts from
app.py - Want to add new checks? Add them inside
utils/and call fromapp.py - To train new models, use
train_model.pyandbuild_dataset.py
- π€ AI by: ChatGPT (OpenAI) + Reverse Engineering logic
- π§ Lead Integrator: [Your Name]
- π₯ Repo: https://github.com/Code-aneesh/hackfest
- Combines reverse engineering + AI + UI
- One-click, transparent reports
- Hackathon-ready, scalable, and real-world applicable
- Judges will love the technical depth, automation, and explainability
This README was auto-generated by your AI partner to guide your teammates easily.
