FunctionMatrix.py 文件源码

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

项目:IDAPython-Scripts 作者: razygon 项目源码 文件源码
def _feature_paths(self, f_ea):
        '''
        Number of paths from startEA to 'ret'
        The target point cannot simplely just ust the 'last' node, in most conditions, the last node is not the ret point.
        For the start point, I really also doubt whether the first node is start node.... 

        prior feature: returnpoints
        '''
        return 0
        paths_count = 0
        start = sorted(self.ftable["dg"].nodes())[0]
        DEBUG_PRINT('start')
        DEBUG_PRINT(start)
        cutoff = len(self.ftable["dg"])/2
        if cutoff > 70:
            return 100
        for ret in self.ftable["returnpoints"]:
            tar = None
            for (x,y) in self.ftable["dg"].nodes():
                if y == ret:
                    tar = (x,y)
                    break
            if tar != None:
                DEBUG_PRINT((start, tar, cutoff))
                paths_count = paths_count + simple_paths_count(self.ftable["dg"], start, tar, cutoff)
                if paths_count > 100:
                    break
        DEBUG_PRINT(paths_count)
        return paths_count        
#         start = sorted(self.ftable["dg"].nodes())[0]
#         print 'start' 
#         print start
#         cutoff = len(self.ftable["dg"]) -1
#         DEBUG_PRINT( 'feature_paths' + hex(f_ea))
#         for ret in self.ftable["returnpoints"]:
#             tar = None
#             for (x,y) in self.ftable["dg"].nodes():
#                 if y ==ret:
#                     tar = (x,y)
#                     break
#             #only only node will be returned
#             if tar!=None:
#                 print tar
#                 count_conn = Queue()
#                 
#                 freeze_support()
#                 PYTHON_EXE = os.path.join(sys.exec_prefix, 'pythonw.exe') #if you use python.exe you get a command window
#                 multiprocessing.set_executable(PYTHON_EXE)
#                 p = Process(target = calc_path, args = (self.ftable["dg"], start, tar, cutoff)) #,count_conn
#                 p.start()
#   
#                 p.join(5)
#                 if p.is_alive():
#                     p.terminate()
#                     count_paths = -1
# #                 else:
# #                     try:
# #                         count_paths = count_conn.get()
# #                         print 'not main_)__'
# #                     except:
# #                         count_paths = -1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号