当前位置: 首页>>代码示例>>Python>>正文


Python keystone.KS_OPT_SYNTAX_ATT属性代码示例

本文整理汇总了Python中keystone.KS_OPT_SYNTAX_ATT属性的典型用法代码示例。如果您正苦于以下问题:Python keystone.KS_OPT_SYNTAX_ATT属性的具体用法?Python keystone.KS_OPT_SYNTAX_ATT怎么用?Python keystone.KS_OPT_SYNTAX_ATT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在keystone的用法示例。


在下文中一共展示了keystone.KS_OPT_SYNTAX_ATT属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: assemble

# 需要导入模块: import keystone [as 别名]
# 或者: from keystone import KS_OPT_SYNTAX_ATT [as 别名]
def assemble(asm_code: string, mode: int) -> Tuple[bytearray, int]:
    """
    Helper function to assemble code receive in parameter `asm_code` using Keystone.

    @param asm_code : assembly code in bytes (multiple instructions must be separated by ';')
    @param mode : defines the mode to use Keystone with
    @return a tuple of bytecodes as bytearray, along with the number of instruction compiled. If failed, the
    bytearray will be empty, the count of instruction will be the negative number for the faulty line.
    """
    arch, mode, endian = get_arch_mode("keystone", mode)
    ks = keystone.Ks(arch, mode | endian)
    if is_x86(mode) and mode.syntax == Syntax.ATT:
        ks.syntax = keystone.KS_OPT_SYNTAX_ATT

    try:
        bytecode, cnt = ks.asm(asm_code, as_bytes=True)
    except keystone.keystone.KsError as kse:
        return (b'', kse.get_asm_count())

    return (bytecode, cnt) 
开发者ID:hugsy,项目名称:cemu,代码行数:22,代码来源:utils.py

示例2: get_function

# 需要导入模块: import keystone [as 别名]
# 或者: from keystone import KS_OPT_SYNTAX_ATT [as 别名]
def get_function(code):
    import keystone as ks

    ksa = ks.Ks(ks.KS_ARCH_X86, ks.KS_MODE_64)
    ksa.syntax = ks.KS_OPT_SYNTAX_ATT
    asm, count = ksa.asm(code)

    asm = bytes(asm)

    func = Function("P7AllocTrace", 0x1000, len(asm), asm)
    func.disasm()

    container = Container()
    container.add_function(func)

    return container 
开发者ID:HexHive,项目名称:retrowrite,代码行数:18,代码来源:test_register_analysis.py

示例3: set_syntax

# 需要导入模块: import keystone [as 别名]
# 或者: from keystone import KS_OPT_SYNTAX_ATT [as 别名]
def set_syntax(self, atandt=False):
        if atandt:
            self.ks.syntax = keystone.KS_OPT_SYNTAX_ATT
            self.cs.syntax = capstone.CS_OPT_SYNTAX_ATT
        else:
            self.ks.syntax = keystone.KS_OPT_SYNTAX_INTEL
            self.cs.syntax = capstone.CS_OPT_SYNTAX_INTEL 
开发者ID:takeshixx,项目名称:deen,代码行数:9,代码来源:x86.py

示例4: get_function

# 需要导入模块: import keystone [as 别名]
# 或者: from keystone import KS_OPT_SYNTAX_ATT [as 别名]
def get_function(code):
    import keystone as ks

    ksa = ks.Ks(ks.KS_ARCH_X86, ks.KS_MODE_64)
    ksa.syntax = ks.KS_OPT_SYNTAX_ATT
    asm, count = ksa.asm(code)

    asm = bytes(asm)

    func = Function("DYNCODE", 0x1000, len(asm), asm)

    container = Container()
    container.add_function(func)

    return container 
开发者ID:HexHive,项目名称:retrowrite,代码行数:17,代码来源:test_asan_memcheck.py

示例5: _configure_keystone

# 需要导入模块: import keystone [as 别名]
# 或者: from keystone import KS_OPT_SYNTAX_ATT [as 别名]
def _configure_keystone(self):
        if self._ks_x86_syntax == 'at&t':
            self._ks.syntax = _keystone.KS_OPT_SYNTAX_ATT
        elif self._ks_x86_syntax == 'nasm':
            self._ks.syntax = _keystone.KS_OPT_SYNTAX_NASM
        elif self._ks_x86_syntax == 'masm':
            self._ks.syntax = _keystone.KS_OPT_SYNTAX_MASM
        elif self._ks_x86_syntax == 'gas':
            self._ks.syntax = _keystone.KS_OPT_SYNTAX_GAS
        elif self._ks_x86_syntax == 'radix16':
            self._ks.syntax = _keystone.KS_OPT_SYNTAX_RADIX16
        else:
            self._ks.syntax = _keystone.KS_OPT_SYNTAX_INTEL 
开发者ID:angr,项目名称:archinfo,代码行数:15,代码来源:arch_x86.py


注:本文中的keystone.KS_OPT_SYNTAX_ATT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。