Git Product home page Git Product logo

xedparse's Introduction

XEDParse

Build status

XEDParse is a library to parse MASM-like plaintext instructions to the XED instruction format. The library is meant to have quick access to assembly in certain low-level programs (such as debuggers).

Currently finished:

  • Parsing instructions to an internal data structure
  • Translate the instruction base to XED2
  • Translate registers to XED2
  • Encode the translated structure
  • Translate values
  • Translate memory arguments

Todo:

  • Handle instructions with more than two operands correctly

Currently the parser can be considered reasonably fast, parsing about 200,000 instructions in 1.5 seconds.

xedparse's People

Contributors

mrexodia avatar nukem9 avatar smilingwolf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xedparse's Issues

sys

how to use this in windowsx64 kernel project?

mov rax, 0x100000000

I updated today to the new version of XEDParse and noticed it is handling incorrectly the following instruction:

mov rax, 0x100000000 ;generated bytes: "48 C7 C0 00 00 00 00" = mov rax, 0

If I'm not doing something wrong it should be: 48 b8 00 00 00 00 01 00 00 00

error with buildding

严重性 代码 说明 项目 文件 行 Suppression State
错误 LNK2019 无法解析的外部符号 __iob_func,该符号在函数 xed_internal_assert 中被引用 XEDParse C:\Users\Administrator\Desktop\XEDParse-master\libxed_x64.lib(xed-util.obj) 1

__iob_func error in vs 2017

assembling instruction, summing up multiple registers and numbers, goes wrong

  • Debugger version (can be found on right hand side of menu bar of debugger).
    Current - 2020/02/23
  • Operating system version and Service Pack (including 32 or 64 bits).
    Win10 Pro x64 1909

Dear x64dbg team,
dear mrexodia,

I was in need to assemble an instruction with mutliple registers and offsets and went into some strange problems. The problem appears on both, x86 and x64 versions but only with XEDParse. asmjit is working fine. (so I think it's better placed here than as an x64dbg issue)

When trying to assemble the following instruction,
x64
cmp word ptr ds:[rbx+rsi+0x1c+0x16], 0x1337
x86
cmp word ptr ds:[ebx+esi+0x1c+0x16], 0x1337)

it assembles to the following instruction,
cmp word ptr ds:[rbx+rsi*1+0x16], 0x1337

the opcodes are fine though (66 81 7C 33 16 37 13), except the byte with the offset that should not be +16 but +32 instead. Even when summing up the offsets by hand and trying to assemble,
cmp word ptr ds:[rbx+rsi+0x32], 0x1337

the offset now ist correct but following instruction will be shown when trying to assemble the instruction,
cmp word ptr ds:[rbx+rsi*1+0x32], 0x1337

I also tried some different instructions, for example
mov ax, word ptr ds:[ebx+esi+0x1c+0x16]
but the same problem appears, he always converts all offset, if more than one is available, except the last one to rsi*1

I hope the problem is explained well enough, in case of any questions feel free to contact me.

Thanks in advance for fixing this issue.

With best regards

John

add support for the 0x66 prefix

The bytes 66 68 59 22 (push word 2259) is not possible to emit with XEDParse (possibly add a pushw and popw mnemonic is enough)

bug in converting relative address in x64

when assemble instruction like this
000007FEF1475C50 | 48 89 1D 11 F9 0F 00 | mov qword ptr ds:[7FEF1575568],rbx
i get this
000007FEF1475C50 | 48 89 1D 12 F9 0F 00 | mov qword ptr ds:[7FEF1575569],rbx
so it wrong calculate relative offset of instruction
problem how i see in OperandMem.cpp at 153 line
LONGLONG newDisp = TranslateRelativeCip(Parse, Operand->Mem.DispVal - 6, true);
Operand->Mem.DispVal - 6 if instruction have size 6 all good , if instruction bigger then 6 we have a error.
So it must be something like that
LONGLONG newDisp = TranslateRelativeCip(Parse, Operand->Mem.DispVal -Operand->Size, true);

Bad LEA syntax accepted by XEDParse

A minor issue with XEDParse:

    int 3
    lea rcx, [rdx + rax + 123h] ; source
    ; lea rcx, [rax + rdx + 0x123]  ; as seen by disassembler
    ; lea rcx, [eax + rdx + 0x123]  ; hit space and change rax to eax: accepted by XEDParse
    ; lea rcx, [eax + 0x123]    ; resulting code

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.