当前位置: 首页>>代码示例>>Python>>正文


Python Misc.function_boundaries方法代码示例

本文整理汇总了Python中jarvis.core.helpers.Misc.function_boundaries方法的典型用法代码示例。如果您正苦于以下问题:Python Misc.function_boundaries方法的具体用法?Python Misc.function_boundaries怎么用?Python Misc.function_boundaries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jarvis.core.helpers.Misc的用法示例。


在下文中一共展示了Misc.function_boundaries方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_dangerous_functions

# 需要导入模块: from jarvis.core.helpers import Misc [as 别名]
# 或者: from jarvis.core.helpers.Misc import function_boundaries [as 别名]
    def get_dangerous_functions(self):
        """
        Gets a list of functions calling
        dangerous ones
        @returns: a *set* of func_addr's
        """
        # TODO: use a centralized list for the dangerous functions?
        # TODO: this whole process must be O(mfg).
        bad_funcs = set([])

        dangerous_funcs = ["wcsncpy", "strcpy", "_strcpy", "_strcpy_0",
                           "strncpy", "_strncpy", "_strncpy_0",
                           "memmove", "memcpy", "_memcpy", "_memcpy_0"]

        # Loop from start to end within the current segment
        for func_name in dangerous_funcs:
            func_addr = LocByName(func_name)

            if func_addr == BADADDR:
                continue

            # find all code references to the function
            for ref in CodeRefsTo(func_addr, True):
                func_addr = misc.function_boundaries(ref)[0]
                bad_funcs.add(func_addr)

        return bad_funcs
开发者ID:carlosgprado,项目名称:JARVIS,代码行数:29,代码来源:BinaryAnalysis.py

示例2: _showAllFunctions

# 需要导入模块: from jarvis.core.helpers import Misc [as 别名]
# 或者: from jarvis.core.helpers.Misc import function_boundaries [as 别名]
    def _showAllFunctions(self):
        """
        Populates the functions list.
        From this it is possible to select endpoints to
        create a ConnectGraph for example
        """
        self._console_output("Displaying all known functions...")

        current_ea, _ = misc.function_boundaries()

        func_list = self.ba.get_all_functions()
        if not func_list:
            return

        self.table.setColumnCount(2)
        self.table.setHorizontalHeaderLabels(("Address", "Name"))

        self.table_label.setText("Functions in current binary")
        self.table.clearContents()
        self.table.setRowCount(0)

        # Current table index
        c_idx = 0

        for idx, (f_ea, f_name) in enumerate(func_list):
            self.table.insertRow(idx)

            addr_item = QTableWidgetItem("%08x" % f_ea)
            addr_item.setFlags(addr_item.flags() ^ QtCore.Qt.ItemIsEditable)
            name_item = QTableWidgetItem("%s" % f_name)

            if f_ea == current_ea:
                current_ea_item = addr_item
                c_idx = idx

            self.table.setItem(idx, 0, addr_item)
            self.table.setItem(idx, 1, name_item)

        # Conveniently scroll to the current EA
        self.table.scrollToItem(
            #current_ea_item,
            self.table.item(c_idx, 0),
            QtGui.QAbstractItemView.PositionAtTop
            )
开发者ID:h0wl,项目名称:JARVIS,代码行数:46,代码来源:BinaryAnalysisWidget.py

示例3: export_current_function

# 需要导入模块: from jarvis.core.helpers import Misc [as 别名]
# 或者: from jarvis.core.helpers.Misc import function_boundaries [as 别名]
    def export_current_function(self):
        """
        Exports the current function code, ascii hex encoded
        This is useful to import into tools like miasm and alike
        """
        # TODO: Reading one byte at a time must be EXTREMELY INEFFICIENT!!! o.O

        begin, end = misc.function_boundaries()

        try:
            filename = AskFile(1, "function_bytes.txt", "File to save the code?")
            code_s = ''.join(["%02x" % get_byte(x) for x in xrange(begin, end)])
            with open(filename, 'w') as f:
                f.write(code_s)

            return True

        except:
            return False
开发者ID:0xr0ot,项目名称:JARVIS,代码行数:21,代码来源:ImportExport.py

示例4: input_to_function

# 需要导入模块: from jarvis.core.helpers import Misc [as 别名]
# 或者: from jarvis.core.helpers.Misc import function_boundaries [as 别名]
    def input_to_function(self, ea = None):
        """
        Gets all functions calling IO (net & file) whose downgraph
        is connected to the specified function
        If none is specified, then use current function
        @returns: a list of f_ea's (io callers)
        """
        connected_input_list = []

        if not ea:
            # Called without arguments
            # Use current function
            ea = misc.function_boundaries()[0]

        io_list = self.locate_file_io().keys() + self.locate_net_io().keys()

        for caller_ea in io_list:
            cg = self.get_connect_graph(caller_ea, ea)
            if cg:
                connected_input_list.append(caller_ea)

        return connected_input_list
开发者ID:carlosgprado,项目名称:JARVIS,代码行数:24,代码来源:BinaryAnalysis.py


注:本文中的jarvis.core.helpers.Misc.function_boundaries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。