Demo entry 6358447

python

   

Submitted by anonymous on Apr 25, 2017 at 11:33
Language: Python. Code size: 1.2 kB.

def search_interface_per_function(function):
    # 获得该函数的调用关系表
    value = collect_function_call_called_dict.get(function)                
    if value == None:
        return
    else:
        # 查找该函数第一层调用了哪些子函数
        called_functions = collect_function_call_called_dict[function]     
        # 判断该子函数是否已被检查过:若是,则可跳过,以此提高查找效率
        if function in have_analysised_set:                                
            return
        # 此处代码用于规避循环调用的影响,例如 A()->B()->C()->A()
        my_set.add(function)                                               
                                                   
        have_analysised_set.add(function)
        for pattern in called_functions:
            item = pattern[0]
            module = pattern[1]
            if module == "other" or module == "fs" or module == "include":
                if item not in my_set:
                    # 利用深度优先遍历查找所有的接口函数调用点
                    search_interface_per_function(item)
                else:
                    continue
            else:
                str = function + " " + item + " " + module
                result_set.add(str)
        my_set.remove(function)
        return

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).