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

Class Snapshot

python/database.py:121–236  ·  view source on GitHub ↗

``class Snapshot`` is a model of an individual database snapshot, created on save.

Source from the content-addressed store, hash-verified

119
120
121class Snapshot:
122 """
123 ``class Snapshot`` is a model of an individual database snapshot, created on save.
124 """
125 def __init__(self, handle):
126 self.handle = core.handle_of_type(handle, core.BNSnapshot)
127
128 def __del__(self):
129 core.BNFreeSnapshot(self.handle)
130
131 @property
132 def database(self) -> 'Database':
133 """Get the owning database (read-only)"""
134 return Database(handle=core.BNGetSnapshotDatabase(self.handle))
135
136 @property
137 def id(self) -> int:
138 """Get the numerical id (read-only)"""
139 return core.BNGetSnapshotId(self.handle)
140
141 @property
142 def name(self) -> str:
143 """Get the displayed snapshot name"""
144 return core.BNGetSnapshotName(self.handle)
145
146 @name.setter
147 def name(self, value: str) -> None:
148 """Set the displayed snapshot name"""
149 core.BNSetSnapshotName(self.handle, value)
150
151 @property
152 def is_auto_save(self) -> bool:
153 """If the snapshot was the result of an auto-save (read-only)"""
154 return core.BNIsSnapshotAutoSave(self.handle)
155
156 @property
157 def has_contents(self) -> bool:
158 """If the snapshot has contents, and has not been trimmed (read-only)"""
159 return core.BNSnapshotHasContents(self.handle)
160
161 @property
162 def has_undo(self) -> bool:
163 """If the snapshot has undo data (read-only)"""
164 return core.BNSnapshotHasUndo(self.handle)
165
166 @property
167 def first_parent(self) -> Optional['Snapshot']:
168 """Get the first parent of the snapshot, or None if it has no parents (read-only)"""
169 handle = core.BNGetSnapshotFirstParent(self.handle)
170 if handle is None:
171 return None
172 return Snapshot(handle=handle)
173
174 @property
175 def parents(self) -> List['Snapshot']:
176 """Get a list of all parent snapshots of the snapshot (read-only)"""
177 count = ctypes.c_ulonglong(0)
178 parents = core.BNGetSnapshotParents(self.handle, count)

Callers 10

first_parentMethod · 0.70
parentsMethod · 0.70
childrenMethod · 0.70
get_snapshotMethod · 0.70
snapshotsMethod · 0.70
current_snapshotMethod · 0.70
base_snapshotMethod · 0.50
first_snapshotMethod · 0.50
second_snapshotMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected