Beispiel #1
0
    name2addr = {}
    for l in lines:
        m = re.match(r'\s*MakeName\s*\((.*),\s*"(.*)"\)', l)
        if m:
            addr = int(m.groups()[0], 16)
            name = m.groups()[1]
            if name.startswith("$"): continue
            addr2name[addr] = name
            name2addr[name] = addr

    # MakeFunction(start, end)
    funcs = {}
    for l in lines:
        m = re.match(r'\s*MakeFunction\s*\((.*),\s*(.*)\)', l)
        if m:
            start = int(m.groups()[0], 16)
            end = int(m.groups()[1], 16)
            funcs[start] = end


    print "found %d MakeName's and %d MakeFunction's" % (len(addr2name), len(funcs))
    
    return addr2name, name2addr, funcs


if __name__ == "__main__":
    import doctest
    from disasm import prepare_test
    prepare_test()
    doctest.testmod()
Beispiel #2
0
    for a,r in R:
        if isFuncStart(r):
            DR.append(r)
    return DR
def DataRefsFrom(ea,ghost=0):
    DR = []
    R = _refsFrom(ea)
    for a,r in R:
        if not isFuncStart(r):
            DR.append(r)
    return DR


if __name__ == "__main__":
    import doctest
    disasm.prepare_test()
    D = disasm.load_dumps()
    print D
    select_dump(D[0])
    doctest.testmod()
    disasm.end_test()



# find a function addr in the code, starting from a list of possible names
def find_func(possible_names):
    print possible_names
    for ea,name in _d.A2N.iteritems():
        #~ print ea,name
        if name in possible_names:
            print "Function found at %x" % ea