How to use the archinfo.arch.register_arch function in archinfo

To help you get started, we’ve selected a few archinfo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angr / archinfo / archinfo / arch_soot.py View on Github external
ret_type = ArchSoot.decode_type_signature(ret_sig)
        l.debug("Decoded method signature '%s' as params=%s and ret=%s",
                method_sig, params_types, ret_type)
        return params_types, ret_type

    def library_search_path(self, pedantic=False):
        """
        Since Java is mostly system independent, we cannot return system
        specific paths.

        :return: empty list
        """
        return []


register_arch(['soot'], 8, Endness.LE, ArchSoot)
github angr / archinfo / archinfo / arch_avr.py View on Github external
self.registers["UCSR0B"] =  (0xc1, 1)
        self.registers["UCSR0C"] =  (0xc2, 1)
        self.registers["UBRR0H"] =  (0xc5, 1)
        self.registers["UBRR0L"] =  (0xc4, 1)
        self.registers["UDR0"] =    (0xc6, 1)

        self.registers["pc"] =      (0x80000000, 2)
        self.registers["ip"] =      (0x80000000, 2)

        self.register_names = {}
        self.register_names.update({i: "r%d" % i for i in range(0, 32)})
        self.register_names[self.registers['pc'][0]] = 'pc'

        self.ip_offset = self.registers["pc"][0]

register_arch(['avr.*|atiny.*|atmega.*|atmel.*'], 8, Endness.LE, ArchAVR)
github angr / archinfo / archinfo / arch_arm.py View on Github external
return self.capstone

    @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)
github angr / archinfo / archinfo / arch_mips32.py View on Github external
0x7000002a: 'DT_MIPS_INTERFACE',
        0x7000002b: 'DT_MIPS_DYNSTR_ALIGN',
        0x7000002c: 'DT_MIPS_INTERFACE_SIZE',
        0x7000002d: 'DT_MIPS_RLD_TEXT_RESOLVE_ADDR',
        0x7000002e: 'DT_MIPS_PERF_SUFFIX',
        0x7000002f: 'DT_MIPS_COMPACT_SIZE',
        0x70000030: 'DT_MIPS_GP_VALUE',
        0x70000031: 'DT_MIPS_AUX_DYNAMIC',
        0x70000032: 'DT_MIPS_PLTGOT'

    }
    got_section_name = '.got'
    ld_linux_name = 'ld.so.1'
    elf_tls = TLSArchInfo(1, 8, [], [0], [], 0x7000, 0x8000)

register_arch([r'mipsel|mipsle'], 32, Endness.LE , ArchMIPS32)
register_arch([r'.*mips.*'], 32, 'any' , ArchMIPS32)
github angr / archinfo / archinfo / arch_mips64.py View on Github external
# http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf
    dynamic_tag_translation = {
        0x70000001: 'DT_MIPS_RLD_VERSION',
        0x70000005: 'DT_MIPS_FLAGS',
        0x70000006: 'DT_MIPS_BASE_ADDRESS',
        0x7000000a: 'DT_MIPS_LOCAL_GOTNO',
        0x70000011: 'DT_MIPS_SYMTABNO',
        0x70000012: 'DT_MIPS_UNREFEXTNO',
        0x70000013: 'DT_MIPS_GOTSYM',
        0x70000016: 'DT_MIPS_RLD_MAP'
    }
    got_section_name = '.got'
    ld_linux_name = 'ld.so.1'
    elf_tls = TLSArchInfo(1, 16, [], [0], [], 0x7000, 0x8000)

register_arch([r'.*mipsel.*|.*mips64el|.*mipsel64'], 64, Endness.LE, ArchMIPS64)
register_arch([r'.*mips64.*|.*mips.*'], 64, 'any', ArchMIPS64)
github angr / angr-platforms / angr_platforms / sh4 / arch_sh4.py View on Github external
0xbb: 'R_SH_GOTPC_MEDHI16',
        0xbc: 'R_SH_GOTPC_HI16',
        0xbd: 'R_SH_GOTPLT10BY4',
        0xbf: 'R_SH_GOTPLT10BY8',
        0xc1: 'R_SH_COPY64',
        0xc2: 'R_SH_GLOB_DAT64',
        0xc3: 'R_SH_JMP_SLOT64',
        0xc4: 'R_SH_RELATIVE64',
        0xfe: 'R_SH_64',
        0xff: 'R_SH_64_PCREL'
    }

    got_section_name = '.got'
    ld_linux_name = 'ld-linux-sh4.so.2'

register_arch([r'.*sh4.*|.*sh.*|em_sh'], 32, 'any' , ArchSH4)
github angr / angr-platforms / angr_platforms / bf / arch_bf.py View on Github external
register_list = [
        Register(name="ip", size=8, vex_offset=0),
        Register(name="ptr", size=8, vex_offset=8),
        Register(name="inout", size=1, vex_offset=16),
        Register(name="ip_at_syscall", size=8, vex_offset=24),
    ]
    ip_offset = 0

    def __init__(self, endness=Endness.LE):

        # forces little endian
        super().__init__(Endness.LE)


register_arch(['bf|brainfuck'], 64, 'any', ArchBF)
github angr / archinfo / archinfo / arch_ppc32.py View on Github external
Register(name='texasru', size=4),
        Register(name='pspb', size=4),
    ]

    function_prologs = {
        br"[\x00-\xff]{2}\x21\x94\xa6\x02\x08\x7c",     # stwu r1, -off(r1); mflr r0
    }
    function_epilogs = {
        br"\xa6\x03[\x00-\xff]{2}([\x00-\xff]{4}){0,6}\x20\x00\x80\x4e"    # mtlr reg; ... ; blr
    }

    got_section_name = '.plt'
    ld_linux_name = 'ld.so.1'
    elf_tls = TLSArchInfo(1, 52, [], [48], [], 0x7000, 0x8000)

register_arch([r'.*p\w*pc.*be'], 32, 'Iend_BE', ArchPPC32)
register_arch([r'.*p\w*pc.*'], 32, 'any', ArchPPC32)
github angr / archinfo / archinfo / arch_mips64.py View on Github external
dynamic_tag_translation = {
        0x70000001: 'DT_MIPS_RLD_VERSION',
        0x70000005: 'DT_MIPS_FLAGS',
        0x70000006: 'DT_MIPS_BASE_ADDRESS',
        0x7000000a: 'DT_MIPS_LOCAL_GOTNO',
        0x70000011: 'DT_MIPS_SYMTABNO',
        0x70000012: 'DT_MIPS_UNREFEXTNO',
        0x70000013: 'DT_MIPS_GOTSYM',
        0x70000016: 'DT_MIPS_RLD_MAP'
    }
    got_section_name = '.got'
    ld_linux_name = 'ld.so.1'
    elf_tls = TLSArchInfo(1, 16, [], [0], [], 0x7000, 0x8000)

register_arch([r'.*mipsel.*|.*mips64el|.*mipsel64'], 64, Endness.LE, ArchMIPS64)
register_arch([r'.*mips64.*|.*mips.*'], 64, 'any', ArchMIPS64)