MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / Section

Class Section

python/binaryview.py:1545–1663  ·  view source on GitHub ↗

The ``Section`` object is returned during BinaryView creation and should not be directly instantiated.

Source from the content-addressed store, hash-verified

1543
1544
1545class Section:
1546 """
1547 The ``Section`` object is returned during BinaryView creation and should not be directly instantiated.
1548 """
1549 def __init__(self, handle: core.BNSectionHandle):
1550 self.handle = handle
1551
1552 def __del__(self):
1553 if core is not None:
1554 core.BNFreeSection(self.handle)
1555
1556 def __repr__(self):
1557 return f"<section {self.name}: {self.start:#x}-{self.end:#x}>"
1558
1559 def __bool__(self):
1560 return True
1561
1562 def __eq__(self, other):
1563 if not isinstance(other, self.__class__):
1564 return NotImplemented
1565 return ctypes.addressof(self.handle.contents) == ctypes.addressof(other.handle.contents)
1566
1567 def __ne__(self, other):
1568 if not isinstance(other, self.__class__):
1569 return NotImplemented
1570 return not (self == other)
1571
1572 def __hash__(self):
1573 return hash(ctypes.addressof(self.handle.contents))
1574
1575 def __contains__(self, i: int):
1576 return i >= self.start and i < self.end
1577
1578 @classmethod
1579 @deprecation.deprecated(deprecated_in="4.3.6653", details="Use `SectionDescriptorList` instead.")
1580 def serialize(cls, image_base: int, name: str, start: int, length: int, semantics: SectionSemantics=SectionSemantics.DefaultSectionSemantics, type: str="", align: int=1, entry_size: int=0, link: str="", info_section: str="", info_data: int=0, auto_defined: bool=True, sections: str="[]"):
1581 """
1582 Serialize section parameters into a JSON string. This is useful for generating a properly formatted section description as options when using `load`.
1583
1584 :param int image_base: The base address of the image.
1585 :param str name: The name of the section.
1586 :param int start: The start address of the section.
1587 :param int length: The length of the section.
1588 :param SectionSemantics semantics: The semantics of the section.
1589 :param str type: The type of the section.
1590 :param int align: The alignment of the section.
1591 :param int entry_size: The entry size of the section.
1592 :param str link: The linked section of the section.
1593 :param str info_section: The info section of the section.
1594 :param int info_data: The info data of the section.
1595 :param bool auto_defined: Whether the section is auto-defined.
1596 :param str sections: An optional, existing array of sections to append to.
1597 :return: A JSON string representing the section.
1598 :rtype: str
1599 """
1600 sections_list = json.loads(sections)
1601 section_info = {
1602 "align": align,

Callers 6

_section_addedMethod · 0.70
_section_updatedMethod · 0.70
_section_removedMethod · 0.70
sectionsMethod · 0.70
get_sections_atMethod · 0.70
get_section_by_nameMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected