本文整理匯總了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)
示例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
示例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
示例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
示例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