當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。