Executing assembler code with python

后端 未结 7 1698
长情又很酷
长情又很酷 2021-02-01 18:00

I want to execute assembly code inside a python script. Is that possible?

In C programming would be like this

static inline getesp(){
        __asm__(\"m         


        
7条回答
  •  滥情空心
    2021-02-01 18:29

    You can embed assembly directly inside your Python program:

    • https://github.com/Maratyszcza/PeachPy
    • https://github.com//pycca/pycca
    • http://codeflow.org/entries/2009/jul/31/pyasm-python-x86-assembler/
    • https://github.com/AmihaiN/pyAsm

    These work by compiling the assembly and loading it into executable memory at runtime. The first three projects implement x86-64 or x86 assemblers in Python, whereas the last calls out to an external compiler.

提交回复
热议问题