How lauriewired/malimite works
Project Type & Purpose
• Malimite is a reverse-engineering tool designed for decompiling IPA files and application bundles for iOS/macOS.
• Its core functionality includes decompilation (leveraging Ghidra), resource extraction (such as Swift class reconstruction, Mach-O and InfoPlist handling), and even built-in LLM method translation.
• It supports multi-platform usage (Mac, Windows, Linux) and integrates several subsystems (parsing, configuration, database management).
Key Components
• User Interface (UI) Layer: Found under src/main/java/.../ui. This includes classes for analysis windows, dialogs (e.g., EntrypointsDialog, PreferencesDialog, etc.), custom token makers, and menus.
• Core Decompilation Engine: Located in src/main/java/.../decompile (and its antlr subdirectory). This part handles the actual decompilation process, including dynamic decompilation, demangling Swift symbols, and syntax parsing (ANTLR based). Also include integration with the "DecompilerBridge" folder that holds Ghidra related components.
• Configuration Module: Found under src/main/java/.../configuration. This handles project settings, library definitions, and initialization of project environments.
• Database Handling: The src/main/java/.../database module (e.g., SQLiteDBHandler) manages metadata storage or other persistent data.
• File Handling & Resource Processing: Modules in src/main/java/.../files deal with IPA elements, Mach-O files, and mobile provisioning data.
• Security & Tools: Include the security package (e.g., KeyEncryption) and tools such as AIBackend and RuntimeMethodHandler, which may be responsible for the built-in LLM method translation feature.
• Utility Modules: Classes in the utils package (e.g., FileProcessing, GhidraSetup, ResourceParser) support various parts of the system by providing common functionality.
• External Dependencies: Represent integration with Ghidra (notably using the provided lib/ghidra.jar) and the ANTLR4 grammar files in src/main/antlr4.
Relationships & Interactions
• The UI layer interacts with the core decompilation engine to trigger decompilation, display results, and handle user interactions.
• The core engine calls the configuration module for setup and retrieves project-specific definitions, while also engaging the database handler to store or fetch analysis data.
• The decompilation engine leverages the ANTLR-based parser to process code syntax and interacts with file handling modules to extract and analyze IPA/App Bundle contents.
• Security modules protect sensitive operations, and tools such as AIBackend interact with the core engine to enhance method translation.
• An external “DecompilerBridge” connects with Ghidra, enabling deeper decompilation capabilities.
Architectural Patterns & Technologies
• Layered Architecture: Clearly distinguish between UI, business logic (core decompilation and configuration), persistence (database), and infrastructure (external tools like Ghidra).
• Use of Parsing and Compiler-like Phases: With ANTLR4 used for C++ grammar parsing, show a compilation/intermediate representation phase feeding into decompilation.
• Integration with External Tools: Ghidra integration comes through a bridge system.
• Technologies: Java (project code), Maven (pom.xml for build), SQLite (in database), and ANTLR4 (for syntax parsing).