extractFunMatrix.py 文件源码

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

项目:IDAPython-Scripts 作者: razygon 项目源码 文件源码
def Get_FunctionFeatures():
    global ftarget, func_name_ea, dbctrl, FIRST_RUN, funlist, funfeaturelist, title, cols
    origin_ftarget = ftarget #pAllocateAndInitializeMDSURF
    ftarget = idc.AskStr(origin_ftarget, 'Type the Target String (CASE INSenstive)')
    if ftarget == '':
        print 'NO input'
        return
    if ftarget == origin_ftarget and not FIRST_RUN:
    # if target string doesn't change, then keep previous funlist, but first time run must be excluded
        DEBUG_PRINT("ftarget == origin_ftarget ")
        pass
    else:
        funlist = []        
        for f in func_name_ea.keys():
            if ftarget.lower() in f.lower():
#                 funlist.append((f,func_name_ea[f]))
                funlist.append(f)
        DEBUG_PRINT(funlist)
        funfeaturelist = []
        for fun in funlist:
            funfeature = dbctrl.find_one({"name":fun})
            if funfeature:
                featurelist = []
                for feature in funfeature:
                    if feature != '_id':
                        featurelist.append(funfeature[feature].strip('(,)').split(',')[0])
                DEBUG_PRINT(featurelist)
                funfeaturelist.append(featurelist) 
        DEBUG_PRINT(funfeaturelist)                
    if FIRST_RUN:
        FIRST_RUN = 0
#funfeaturelist prepared      
    DEBUG_PRINT("To show the window")
#     print title
#     print cols
    chooser = IdxChoose2(title, cols, funfeaturelist)  #, deflt = deflt_id
    id = chooser.show()
    if -1 == id:
        idc.Message('\n Index no change\n')
    else:
        ea = funfeaturelist[id][cols.index(['ea', 10])]
        print 'ea',ea
        type(ea)
        idaapi.jumpto(int(ea,16), -1,1)
        features = dbctrl.find_one({"ea":ea})
        for f in features:
            print '%-20s %s'%(f, features[f])
    DEBUG_PRINT("show finished")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号