A web-based interface for real-time function injection with file monitoring support.
- Hot Patching: Modify target functions in real-time without reflashing
- Marker-based Development: Add
/* FPB_INJECT */markers to auto-detect patchable functions - File Monitoring: Auto-inject on file save
- Modern UI: VS Code-style web interface
- Built-in Terminal: Serial monitor and interaction terminal
- Python 3.8+
- ARM GCC Toolchain (
arm-none-eabi-gcc) - pyserial
cd Tools/WebServer
pip install -r requirements.txtpython3 main.py
# Default: http://127.0.0.1:5500- Serial Port: Device port (e.g.,
/dev/ttyACM0,COM3) - ELF Path: Compiled firmware ELF file path
- Toolchain Path: Cross-compiler prefix (e.g.,
arm-none-eabi-) - Compile Commands: Path to
compile_commands.jsonfor include paths and defines - Ghidra Path: Path to Ghidra installation directory for decompilation (optional)
Click Connect to establish device connection.
Add marker comments before patchable functions:
/* FPB_INJECT */
__attribute__((section(".fpb.text"), used))
void my_function(int arg) {
// Patch implementation
}Supported markers:
/* FPB_INJECT *//* FPB-INJECT */// FPB_INJECT/*FPB_INJECT*/(case-insensitive)
- Open the web interface
- Configure and connect to device
- Edit source files with FPB_INJECT markers
- Save file → automatic injection
The WebServer monitors source files and:
- Detects FPB_INJECT markers
- Compiles injection code
- Uploads to device RAM
- Configures FPB redirection
Use the interface to manually select functions and inject patches.
- Browse project files
- View file tree structure
- Monaco-based code editor
- Syntax highlighting for C/C++
- Serial output monitor
- Interactive command input
- Connection configuration
- Build settings
| Endpoint | Method | Description |
|---|---|---|
/api/connect |
POST | Connect to device |
/api/disconnect |
POST | Disconnect |
/api/info |
GET | Get FPB info |
/api/inject |
POST | Inject patch |
/api/unpatch |
POST | Remove patch |
/api/files |
GET | List files |
Real-time updates via WebSocket at /ws:
- Serial output streaming
- File change notifications
- Injection status updates
# Check serial port permissions
sudo chmod 666 /dev/ttyACM0
# Or add user to dialout group
sudo usermod -a -G dialout $USEREnsure:
- ARM toolchain is in PATH
compile_commands.jsonexists and is correct- Include paths are accessible
Check:
- Device is in function loader mode
- ELF file matches running firmware
- RAM allocation has space
WebServer/
├── main.py # Flask application entry
├── fpb_inject.py # Core injection logic
├── fpb_cli.py # CLI interface
├── templates/ # HTML templates
├── static/ # JS/CSS assets
└── tests/ # Test suite
- CLI Tool - Command-line interface & AI integration guide
- Architecture - Technical details