Information
# ReverserAI (v1.1)
Author: **Tim Blazytko**
_Provides automated reverse engineering assistance through the use of local large language models (LLMs) on consumer hardware._
## Description:
_ReverserAI_ is a research project designed to automate and enhance reverse engineering tasks through the use of locally-hosted large language models (LLMs). Operating entirely offline, this initial release features the automatic suggestion of high-level, semantically meaningful function names derived from decompiler output. _ReverserAI_ is provided as a Binary Ninja plugin; however, its architecture is designed to be extended to other reverse engineering platforms such as IDA and Ghidra.
While local LLMs do not match the performance and capabilities of their cloud-based counterparts like ChatGPT4 and require substantial computing resources, they represent a significant step forward in balancing performance with confidentiality requirements.
_ReverserAI_ serves as an initial exploration into the potential of local LLMs as aids in reverse engineering on consumer-grade hardware. It showcases what is currently achievable and plans to be a playground for future developments in the realm of AI-assisted reverse engineering. Additionally, the project explores the benefits of combining static analysis techniques with modern AI capabilities to improve the accuracy of AI-assisted reverse engineering.
Some example use cases can be found in [examples](./examples).
> [!NOTE]
> Disclaimer: My expertise in machine learning and LLMs is limited. There may exist more efficient models or methods to achieve similar tasks with greater performance. This project represents a culmination of research into viable configurations, offering a stable foundation with acceptable performance. Feedback and contributions to improve _ReverserAI_ are highly encouraged.
## Core Features
- **Offline Operation**: Runs LLMs entirely on local CPU/GPU, ensuring data privacy and security.
- **Automatic Function Naming**: Automatically suggests semantically meaningful function names from decompiler output.
- **Binary Ninja Integration**: Seamlessly integrates as a plugin with Binary Ninja.
- **Modular Architecture**: Designed for easy extension to support other reverse engineering tools like IDA and Ghidra.
- **Consumer Hardware Compatibility**: Optimized to run on consumer-grade hardware, such as Apple silicon architectures.
- **Enhanced AI with Static Analysis**: Improves AI-based analysis and suggestions by incorporating insights from static analysis, providing a richer context and more accurate results.
## Installation
_ReverserAI_ can be easily integrated via Binary Ninja's plugin manager. Alternatively, for those preferring command line installation, execute in Binary Ninja's \`plugins\` folder:
\`\`\`bash
git clone https://github.com/mrphrazer/reverser_ai.git
cd reverser_ai
# install requirements
pip3 install -r requirements.txt
# install ReverserAI
pip3 install .
\`\`\`
Upon initial launch, the tool will automatically download the (default \`mistral-7b-instruct-v0.2.Q4_K_M.gguf\` large language model file (~5GB). The download time varies based on internet connection speed. To manually initiate the download or download other models, execute the [\`model_download.py\`](scripts/model_download.py) script.
## Hardware Requirements
For optimal LLM performance on consumer-grade hardware, a setup with multiple CPU threads or a powerful GPU is advised. _ReverserAI_ runs efficiently on systems with at least 16 GB of RAM and 12 CPU threads, with queries taking about 20 to 30 seconds. GPU optimizations, especially on Apple silicon devices, can reduce this to 2 to 5 seconds per query.
## Usage
_ReverserAI_ is accessible through Binary Ninja's user interface and via command line.
### User Interface
To invoke the plugin within Binary Ninja, navigate to \`Plugins -> ReverserAI\` and, for example, run "Rename All Functions":