x64dbg / x64dbgpy

Automating x64dbg using Python, Snapshots:
https://ci.appveyor.com/project/mrexodia/x64dbg-python/build/artifacts
MIT License
1.47k stars 70 forks source link

AssembleEx can't handle RETN instructions #20

Closed wangray closed 6 years ago

wangray commented 6 years ago

I get the error

<b>Traceback (most recent call last):</b>
<b>  File "Z:\raywang\SNAP~E08\release\x32\plugins\x64dbgpy\mona.py", line 18092, in main</b>
<b>    commands[command].parseProc(opts)</b>
<b>  File "Z:\raywang\SNAP~E08\release\x32\plugins\x64dbgpy\mona.py", line 11571, in procROP</b>
<b>    findROPGADGETS(modulecriteria,criteria,endings,maxoffset,depth,split,thedistance,fast,mode)</b>
<b>  File "Z:\raywang\SNAP~E08\release\x32\plugins\x64dbgpy\mona.py", line 6305, in findROPGADGETS</b>
<b>    found_opcodes = searchInModule(search,thismodule,criteria)</b>
<b>  File "Z:\raywang\SNAP~E08\release\x32\plugins\x64dbgpy\mona.py", line 5284, in searchInModule</b>
<b>    return searchInRange(sequences, start, end, criteria)</b>
<b>  File "Z:\raywang\SNAP~E08\release\x32\plugins\x64dbgpy\mona.py", line 5206, in searchInRange</b>
<b>    buf = dbg.assemble(seq)</b>
<b>  File "Z:\raywang\SNAP~E08\release\x32\plugins\x64dbgpy\x64dbgpylib.py", line 1285, in assemble</b>
<b>    res = script.assembler.AssembleEx(address, line)</b>
<b>  File "Z:\raywang\SNAP~E08\release\x32\plugins\x64dbgpy\x64dbgpy\pluginsdk\_scriptapi\assembler.py", line 20, in AssembleEx</b>
<b>    raise Exception(error.value)</b>
<b>Exception: invalid instruction</b>

on a RETN instruction.

mrexodia commented 6 years ago

This is due to asmtk not supporting the retn instruction. I made a small note here, but basically my workaround would be to replace retn with ret

wangray commented 6 years ago

Ok, I'll do that.