找回密码
 立即注册
FASMthe代码注入 | C#编程 2021-06-11 456 0star收藏 版权: . 保留作者信息 . 禁止商业使用 . 禁止修改作品
FasmManaged ( managed C++ wrapper for the library version of Flat Assembler)这是 FASM 的作者在此线程中发布的 Flat Assembler 库版本的托管 C++ 包装器。包括完整的 C++ 源代码和 C# 使用示例。在 C++ 源文件 fasmdll_managed.cpp 中,还可以找到如何从非托管代码调用 FASM.OBJ(包含在源代码下载中)的示例。
它有什么作用?
基本上,它允许 C# 和 VB.NET 程序员比普通方法更容易地组装和注入代码到另一个进程中。

你能给我一个逐步使用的例子吗?

1. 使用类构造函数或 fasm.SetProcessHandle(IntPtr) 将进程句柄设置为将注入代码的进程的句柄。
2. 使用 fasm.AddLine(string) 添加到要汇编的助记符列表中。 FASM 使用 Intel 语法。您可以在此处找到 FASM 程序员手册。
3. A.调用 fasm.Assemble() ,它将以字节数组的形式返回字节码。
湾调用 fasm.Inject()、fasm.InjectAndExecute() 或 fasm.InjectAndExecuteEx() 将您的代码注入到进程中。每一个都至少有一个参数:代码将被注入的地址;可选地,您可以指定要注入代码的进程的句柄,在后两者的情况下,指定在注入时传递给代码的参数。


(This is a managed C++ wrapper for the library version of Flat Assembler released by FASM's author in this thread. Included is the full C++ source code and a C# example of use. In the C++ source file fasmdll_managed.cpp, one can also find an example of how to invoke FASM.OBJ (included in source download) from unmanaged code.

What does it do?
Basically, it allows C# and VB.NET programmers to assemble and inject code into another process with far greater ease than normal methods.

Can you give me a step-by-step example of use?

1. Use either the class constructor or fasm.SetProcessHandle(IntPtr) to set the process handle to that of the process into which code will be injected.
2. Use fasm.AddLine(string) to add to the list of mnemonics to be assembled. FASM uses Intel syntax. You can find the FASM Programmer's Manual here.
3. a. Call fasm.Assemble() which will return the bytecode in the form of a byte-array.
b. Call fasm.Inject(), fasm.InjectAndExecute(), or fasm.InjectAndExecuteEx() to inject your code into the process. Each of these takes at least one parameter: the address at which code will be injected; optionally, you can specify a handle to the process into which code will be injected and, in the case of the latter two, a parameter to be passed to the code upon injection.)

1623379831817.rar


上一篇:BlackMagic -- Managed Memory Manipulation
下一篇:WhiteMagic - Injected .NET Helper Library