Assembler library for .NET, assembling runtime-variable strings into machine code for injection

后端 未结 8 1014
醉酒成梦
醉酒成梦 2020-12-14 09:23

Is there such a thing as an x86 assembler that I can call through C#? I want to be able to pass x86 instructions as a string and get a byte array back. If one doesn\'t exist

8条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 09:54

    See this project:

    https://github.com/ZenLulz/MemorySharp

    This project wraps the FASM assembler, which is written in assembly and as a compiled as Microsoft coff object, wrapped by a C++ project, and then again wrapped in C#. This can do exactly what you want: given a string of x86/x64 assembly, this will produce the bytes needed.

    If you require the opposite, there is a port of the Udis86 disassembler, fully ported to C#, here:

    https://github.com/spazzarama/SharpDisasm

    This will convert an array of bytes into the instruction strings for x86/x64

提交回复
热议问题