database.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:idascripts 作者: ctfhacker 项目源码 文件源码
def array(cls, ea):
        '''Return the values of the array at address ``ea``.'''
        ea = interface.address.within(ea)
        numerics = {
            idaapi.FF_BYTE : 'B',
            idaapi.FF_WORD : 'H',
            idaapi.FF_DWRD : 'L',
            idaapi.FF_QWRD : 'Q',
            idaapi.FF_FLOAT : 'f',
            idaapi.FF_DOUBLE : 'd',
        }
        strings = {
            1 : 'c',
            2 : 'u',
        }
        fl = type.flags(ea)
        elesize = idaapi.get_full_data_elsize(ea, fl)
        if fl & idaapi.FF_ASCI == idaapi.FF_ASCI:
            t = strings[elesize]
        elif fl & idaapi.FF_STRU == idaapi.FF_STRU:
            t, size = type.structure.id(ea), idaapi.get_item_size(ea)
            return [ cls.struc(ea, id=t) for ea in __builtin__.range(ea, ea+size, structure.size(t)) ]
        else:
            ch = numerics[fl & idaapi.DT_TYPE]
            t = ch.lower() if fl & idaapi.FF_SIGN == idaapi.FF_SIGN else ch
        res = array.array(t, read(ea, type.array.size(ea)))
        if len(res) != type.array.length(ea):
            logging.warn("{:s}.get({:x}) : Unexpected length : ({:d} != {:d})".format('.'.join((__name__, cls.__name__)), ea, len(res), type.array.length(ea)))
        return res
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号