1.7 KiB
1.7 KiB
Why
BlackMagic replaced FASM for code-payload generation but lost two useful capabilities:
-
Non-blocking remote execution (
InjectAndExecuteEx): FASM's managed wrapper returned a thread handle without waiting. BlackMagic only has blockingExecute(). For DLL injection, a non-blocking variant avoids hanging when the target is slow to load. -
Text-based assembly: FASM allowed building code payloads from assembly text (
AddLine("pushad")). BlackMagic requires hand-assembledbyte[]. For prototyping, debugging, and one-off code payloads, text assembly is faster to write and easier to review. A managed assembler eliminates the native FASM DLL dependency while keeping the ergonomic benefit.
What Changes
- Add
InjectAndExecuteEx()toBlackMagicandBMThread: inject code then create a remote thread without waiting, returning the thread handle. - Add
AsmBuilderclass: pure C# x86 text assembler that converts instruction text tobyte[]machine code. Supports common payload instructions (mov, push, pop, call, jmp, ret, nop, pushad/popad, test, je, jne, inc, add, sub, xor, etc.). - Add
InjectAndExecute(string asm)andInjectAndExecuteEx(string asm)overloads that accept assembly text, assemble viaAsmBuilder, then inject+execute. - Add
SetPassLimit()toAsmBuilderfor label resolution iteration control.
Capabilities
New Capabilities
non-blocking-execute: Non-blocking remote thread creation that returns a handle without waiting for exit.text-assembler: Pure C# x86 text assembler converting assembly source to byte arrays without native dependencies.