本文整理汇总了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