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

Method store_metadata

python/binaryview.py:9756–9787  ·  view source on GitHub ↗

`store_metadata` stores an object for the given key in the current BinaryView. Objects stored using `store_metadata` can be retrieved when the database is reopened. Objects stored are not arbitrary python objects! The values stored must be able to be held in a Metadata object. See :py:class:`

(self, key: str, md: metadata.MetadataValueType, isAuto: bool = False)

Source from the content-addressed store, hash-verified

9754 return metadata.Metadata(handle=md_handle).value
9755
9756 def store_metadata(self, key: str, md: metadata.MetadataValueType, isAuto: bool = False) -> None:
9757 """
9758 `store_metadata` stores an object for the given key in the current BinaryView. Objects stored using
9759 `store_metadata` can be retrieved when the database is reopened. Objects stored are not arbitrary python
9760 objects! The values stored must be able to be held in a Metadata object. See :py:class:`~binaryninja.metadata.Metadata`
9761 for more information. Python objects could obviously be serialized using pickle but this intentionally
9762 a task left to the user since there is the potential security issues.
9763
9764 :param str key: key value to associate the Metadata object with
9765 :param Varies md: object to store.
9766 :param bool isAuto: whether the metadata is an auto metadata. Most metadata should \
9767 keep this as False. Only those automatically generated metadata should have this set \
9768 to True. Auto metadata is not saved into the database and is presumably re-generated \
9769 when re-opening the database.
9770 :rtype: None
9771
9772 :Example:
9773
9774 >>> bv.store_metadata("integer", 1337)
9775 >>> bv.query_metadata("integer")
9776 1337L
9777 >>> bv.store_metadata("list", [1,2,3])
9778 >>> bv.query_metadata("list")
9779 [1L, 2L, 3L]
9780 >>> bv.store_metadata("string", "my_data")
9781 >>> bv.query_metadata("string")
9782 'my_data'
9783 """
9784 _md = md
9785 if not isinstance(_md, metadata.Metadata):
9786 _md = metadata.Metadata(_md)
9787 core.BNBinaryViewStoreMetadata(self.handle, key, _md.handle, isAuto)
9788
9789 def remove_metadata(self, key: str) -> None:
9790 """

Callers

nothing calls this directly

Calls 1

MetadataMethod · 0.80

Tested by

no test coverage detected