Transform executables into readable C code using Ghidra and Gemini AI.
Built for UofTHacks 13.
- Drag-and-Drop Upload: Simply drag your
.exeor ELF binary onto the page - Chrome Extension: Automatically intercepts downloaded executables for analysis
- Real-time Progress: Watch the decompilation process with live console output
- Two-Pass AI Refactoring: Gemini 3 Pro fixes logic, Gemini Flash improves readability
- Split View Comparison: See the raw vs. refactored code side-by-side
- Export: Download the clean, refactored code as a
.cfile
- Frontend: Next.js 14, TailwindCSS, Monaco Editor, Framer Motion
- Backend: Python FastAPI
- Decompiler: PyGhidra (Ghidra's Python bindings)
- AI: Google Gemini 3 Pro + Gemini Flash (two-pass refactoring)
- Node.js 18+
- Python 3.10+
- Java 17+ (for Ghidra)
- Ghidra 11.x installed
- Clone the repository:
git clone https://github.com/yourusername/uofthacks13.git
cd uofthacks13- Set up environment variables:
# Create .env file in server directory
echo "GEMINI_API_KEY=your-gemini-api-key-here" > server/.env
echo "GHIDRA_INSTALL_DIR=/path/to/ghidra" >> server/.envcd server
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run the server
uvicorn main:app --reload --host 0.0.0.0 --port 8000cd client
# Install dependencies
npm install
# Run development server
npm run devVisit http://localhost:3000 in your browser.
For production deployment with sandboxed binary analysis:
# Set your Gemini API key
export GEMINI_API_KEY=your-gemini-api-key-here
# Build and run with Docker Compose
docker-compose up --builduofthacks13/
├── client/ # Next.js frontend
│ ├── app/
│ │ ├── page.tsx # Main page
│ │ ├── layout.tsx # Root layout
│ │ └── globals.css # Cyberpunk theme styles
│ ├── components/
│ │ ├── FileDropzone.tsx # Drag-drop upload
│ │ ├── ProgressStepper.tsx
│ │ ├── ConsoleStream.tsx
│ │ └── CodeViewer.tsx # Monaco split view
│ └── lib/
│ └── api.ts # API client
├── server/ # FastAPI backend
│ ├── main.py # FastAPI app
│ ├── routers/
│ │ └── decompile.py # Upload & job endpoints
│ ├── services/
│ │ ├── ghidra_service.py # PyGhidra integration
│ │ └── ai_service.py # GPT-4o refactoring
│ └── models/
│ └── schemas.py # Pydantic models
└── docker-compose.yml # Production deployment
| Endpoint | Method | Description |
|---|---|---|
/api/upload |
POST | Upload a binary file for decompilation |
/api/job/{id} |
GET | Get job status and logs |
/api/job/{id}/result |
GET | Get decompilation results |
- Binaries are never executed, only analyzed
- Uploaded files are deleted after processing
- Docker containers run with minimal privileges
- Rate limiting on upload endpoint
- Upload: User uploads a PE (.exe) or ELF binary
- Analyze: PyGhidra loads and auto-analyzes the binary
- Decompile: Each user-written function is decompiled to pseudo-C (library functions are filtered out)
- Refactor (Two-Pass):
- Pass 1 (Gemini 3 Pro): Fixes control flow, reconstructs data structures, corrects logic
- Pass 2 (Gemini Flash): Renames variables, improves readability, adds comments
- Display: Split view shows before/after comparison
For the best hackathon demo:
- Use a small, simple binary (< 1MB)
- Pre-upload a sample binary to show the full flow
- Have the split view ready to show the transformation
Built at UofTHacks 13 by Leo Zhang, Sean Zhao, and Lukas Li