disassembler.py 文件源码

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

项目:rce-ml 作者: vadimkotov 项目源码 文件源码
def get_paths(self):
        # If there's only one node
        if nx.number_of_nodes(self.graph) == 1:
            self.shortest_path = self.longest_path = [self.function_start]
            return [[self.function_start]]

        # If there aren't any obvious exit blocks
        if len(self.exit_blocks) == 0:
            return

        # We need to go through all the possible paths from
        # function start to each of exit blocks
        all_paths = []

        longest_path_len = 0
        shortest_path_len = None

        for ret in self.exit_blocks:
            paths = (nx.all_simple_paths(self.graph, source = self.function_start, target = ret))

            for path in paths:
                if len(path) > longest_path_len:
                    longest_path_len = len(path)
                    self.longest_path = path

                if not shortest_path_len or len(path) < shortest_path_len:
                    shortest_path_len = len(path)
                    self.shortest_path = path

            all_paths.extend(paths)

        return all_paths
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号