How detached64/hijackgen works
Project Type & Purpose
• HijackGen is a desktop utility built on .NET (C#) that generates DLL source code tailored for DLL hijacking. It is composed of a GUI application (HijackGen.GUI) and a core engine (the HijackGen project) that handles the generation logic.
• The README and references indicate that it leverages techniques and inspirations from projects like PeNet, dll-hijack-by-proxying, and AheadLib-x86-x64.
Main Components to Identify
a. GUI Layer (HijackGen.GUI):
• Contains Windows Forms (e.g., MainForm, AboutBox, Options forms) that allow user interaction.
• Acts as the presentation layer, gathering user input and displaying the generated results or options.
• Responsible for interfacing with the core engine through API calls or direct method invocations.
b. Core Engine (HijackGen):
• Holds the business logic, including key modules such as:
• DllParser – likely responsible for analyzing DLL structures.
• Generator – the module that processes information along with templates to produce the hijackable DLL code.
• DataItem and Message classes – manage data structures and user messages or resource handling.
• It is independent of the UI and encapsulates the actual DLL hijacking code generation logic.
c. Template System:
• The Templates directory contains various text files (ExternX64.txt, Free.txt, etc.) and a Templates.cs file, which are used to define and manage the source code templates for DLL generation.
• This is a configurable piece that can be extended or modified without impacting core logic.
d. Supporting Elements:
• Configurations and resources (e.g., App.config, resource files such as *.resx) that support localization (e.g., zh-Hans resources) and application settings.
Relationships & Interactions
• The core engine interacts with the Template System by reading the appropriate template files to produce DLL source code.
• Dependencies between the core engine and potential external references (as per the README, external libraries like PeNet may be used for parsing).
Architectural Patterns or Design Principles
• Separation of Concerns: Clear decoupling between the UI (HijackGen.GUI) and the business logic (HijackGen core).
• Modularity: The Template System is modular (templates stored as text files) allowing for flexibility and easy extension.
• Reusability and Maintainability: Encapsulate all DLL parsing and generation logic within dedicated modules, facilitating testing and future enhancements.