Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, endness=Endness.LE):
if endness != Endness.LE:
raise ArchError('Arch i386 must be little endian')
super(ArchX86, self).__init__(endness)
if self.vex_archinfo:
self.vex_archinfo['x86_cr0'] = 0xFFFFFFFF
vex_arch = "VexArchAMD64"
vex_endness = "VexEndnessLE"
name = "AMD64"
qemu_name = 'x86_64'
ida_processor = 'metapc'
linux_name = 'x86_64'
triplet = 'x86_64-linux-gnu'
max_inst_bytes = 15
ret_offset = 16
vex_conditional_helpers = True
syscall_num_offset = 16
call_pushes_ret = True
stack_change = -8
initial_sp = 0x7ffffffffff0000
call_sp_fix = -8
memory_endness = Endness.LE
register_endness = Endness.LE
sizeof = {'short': 16, 'int': 32, 'long': 64, 'long long': 64}
if _capstone:
cs_arch = _capstone.CS_ARCH_X86
cs_mode = _capstone.CS_MODE_64 + _capstone.CS_MODE_LITTLE_ENDIAN
_cs_x86_syntax = None # Set it to 'att' in order to use AT&T syntax for x86
if _keystone:
ks_arch = _keystone.KS_ARCH_X86
ks_mode = _keystone.KS_MODE_64 + _keystone.KS_MODE_LITTLE_ENDIAN
_ks_x86_syntax = None
uc_arch = _unicorn.UC_ARCH_X86 if _unicorn else None
uc_mode = (_unicorn.UC_MODE_64 + _unicorn.UC_MODE_LITTLE_ENDIAN) if _unicorn else None
uc_const = _unicorn.x86_const if _unicorn else None
uc_prefix = "UC_X86_" if _unicorn else None
function_prologs = {
br"\x55\x48\x89\xe5", # push rbp; mov rbp, rsp
Register(name='cmlen', size=4),
Register(name='nraddr', size=4),
Register(name='sc_class', size=4),
Register(name='ip_at_syscall', size=4),
]
symbol_type_translation = {
10: 'STT_GNU_IFUNC',
'STT_LOOS': 'STT_GNU_IFUNC'
}
lib_paths = ['/lib32', '/usr/lib32']
got_section_name = '.got.plt'
ld_linux_name = 'ld-linux.so.2'
elf_tls = TLSArchInfo(2, 56, [8], [4], [0], 0, 0)
register_arch([r'.*i?\d86|.*x32|.*x86|.*metapc'], 32, Endness.LE, ArchX86)
def __init__(self, endness=Endness.LE):
if endness != Endness.LE:
raise ArchError('Arch i386 must be little endian')
super(ArchX86, self).__init__(endness)
if self.vex_archinfo:
self.vex_archinfo['x86_cr0'] = 0xFFFFFFFF
def __init__(self, endness=Endness.LE):
super(ArchPPC64, self).__init__(endness)
if endness == Endness.BE:
self.function_prologs = {
br"\x94\x21[\x00-\xff]{2}\x7c\x08\x02\xa6", # stwu r1, -off(r1); mflr r0
br"(?!\x94\x21[\x00-\xff]{2})\x7c\x08\x02\xa6", # mflr r0
br"\xf8\x61[\x00-\xff]{2}", # std r3, -off(r1)
}
self.function_epilogs = {
br"[\x00-\xff]{2}\x03\xa6([\x00-\xff]{4}){0,6}\x4e\x80\x00\x20" # mtlr reg; ... ; blr
}
self.triplet = 'powerpc-linux-gnu'
self.argument_register_positions = {
self.registers['r3'][0]: 0,
self.registers['r4'][0]: 1,
self.registers['r5'][0]: 2,
self.registers['r6'][0]: 3,
def __init__(self, endness=Endness.LE):
super(ArchSH4, self).__init__(endness)
self.ip_offset = 72
self.sp_offset = 68
self.call_pushes_ret = True
self.stack_change = -4
self.branch_delay_slot = True # jmp is delayed branch instruction in sh4
self.memory_endness = endness
self.register_endness = endness
self.default_register_values = [
( 'pc', 0xA0000000, True, 'global' ),
( 'fpscr', 0x40001, False, None ),
( 'vbr', 0x0, False, None ),
( 'fpscr', 0x40001, False, None ),
]
def __init__(self, endness=Endness.LE):
if endness != Endness.LE:
raise ArchError('Arch AMD64 must be little endian')
super(ArchAMD64, self).__init__(endness)
self.argument_register_positions = {
self.registers['rdi'][0]: 0,
self.registers['rsi'][0]: 1,
self.registers['rdx'][0]: 2,
self.registers['rcx'][0]: 3, # Used for user calls
self.registers['r10'][0]: 3, # Used for Linux kernel calls
self.registers['r8'][0]: 4,
self.registers['r9'][0]: 5,
# fp registers
self.registers['xmm0'][0]: 0,
self.registers['xmm1'][0]: 1,
self.registers['xmm2'][0]: 2,
self.registers['xmm3'][0]: 3,
@property
def keystone_thumb(self):
return self.keystone
def __init__(self, *args, **kwargs):
super(ArchARMCortexM, self).__init__(*args, **kwargs)
# TODO: Make arm_spotter use these
# TODO: Make SimOS use these.
# TODO: Add.... the NVIC? to SimOS
register_arch([r'.*cortexm|.*cortex\-m.*|.*v7\-m.*'], 32, 'any', ArchARMCortexM)
register_arch([r'.*armhf.*'], 32, 'any', ArchARMHF)
register_arch([r'.*armeb|.*armbe'], 32, Endness.BE, ArchARM)
register_arch([r'.*armel|arm.*'], 32, Endness.LE, ArchARMEL)
register_arch([r'.*arm.*|.*thumb.*'], 32, 'any', ArchARM)