collaboration.snapshot module

binaryninja.collaboration.snapshot.CollabSnapshot(handle)

Class representing a remote Snapshot

binaryninja.collaboration.snapshot.UndoEntry(handle)

Class representing a remote undo entry

class CollabSnapshot(handle: LP_BNCollaborationSnapshot)[source]

Bases: object

Class representing a remote Snapshot

Parameters:

handle (LP_BNCollaborationSnapshot) –

create_undo_entry(parent: int | None, data: str) UndoEntry[source]

Create a new Undo Entry in this snapshot.

Parameters:
  • parent (int | None) – Id of parent Undo Entry

  • data (str) – Undo Entry contents

Returns:

Created Undo Entry

Raises:

RuntimeError if there was an error

Return type:

UndoEntry

download(progress: ~typing.Callable[[int, int], bool] = <function nop>) bytes[source]

Download the snapshot fields blob, compatible with KeyValueStore.

Parameters:

progress (Callable[[int, int], bool]) – Function to call for progress updates. Cancels if the function returns False.

Returns:

Snapshot contents data

Raises:

RuntimeError if there was an error or the operation was cancelled

Return type:

bytes

download_analysis_cache(progress: ~typing.Callable[[int, int], bool] = <function nop>) bytes[source]

Download the analysis cache fields blob, compatible with KeyValueStore.

Parameters:

progress (Callable[[int, int], bool]) – Function to call for progress updates. Cancels if the function returns False.

Returns:

Snapshot analysis cache data

Raises:

RuntimeError if there was an error or the operation was cancelled

Return type:

bytes

download_snapshot_file(progress: ~typing.Callable[[int, int], bool] = <function nop>) bytes[source]

Download the contents of the file in the Snapshot.

Parameters:

progress (Callable[[int, int], bool]) – Function to call for progress updates. Cancels if the function returns False.

Returns:

File contents data

Raises:

RuntimeError if there was an error or the operation was cancelled

Return type:

bytes

finalize()[source]

Mark a snapshot as Finalized, committing it to the Remote, preventing future updates, and allowing snapshots to be children of it.

Raises:

RuntimeError if there was an error

static get_for_local_snapshot(snapshot: Snapshot) CollabSnapshot | None[source]

Get the remote snapshot associated with a local snapshot (if it exists)

Parameters:
  • snap – Local snapshot

  • snapshot (Snapshot) –

Returns:

Remote snapshot if it exists, or None if not

Raises:

RuntimeError – If there was an error

Return type:

CollabSnapshot | None

get_local_snapshot(bv: BinaryView) Snapshot | None[source]

Get the local snapshot associated with a remote snapshot (if it exists)

Parameters:

bv (BinaryView) – BinaryView with database to search

Returns:

Local snapshot, if one exists. Else, None

Raises:

RuntimeError if there was an error

Return type:

Snapshot | None

get_undo_entry_by_id(id: int) UndoEntry | None[source]

Get a specific Undo Entry in the Snapshot by its id

Note

If undo entries have not been pulled, they will be pulled upon calling this.

Parameters:

id (int) – Id of Undo Entry

Returns:

UndoEntry object, if one with that id exists. Else, None

Raises:

RuntimeError if there was an error pulling undo entries

Return type:

UndoEntry | None

pull_undo_entries(progress: ~typing.Callable[[int, int], bool] = <function nop>)[source]

Pull the list of Undo Entries from the Remote.

Parameters:

progress (Callable[[int, int], bool]) – Function to call for progress updates

Raises:

RuntimeError if there was an error pulling undo entries

property author: str

Get the user id of the author of a snapshot

Returns:

Snapshot author user id

property author_username: str

Get the username of the author of a snapshot, if possible (vs author which is user id)

Returns:

Snapshot author username

property child_ids: List[str]

List of ids of all remote child Snapshots

Returns:

List of id strings

Raises:

RuntimeError if there was an error

property children: List[CollabSnapshot]

List of all child Snapshot objects

Returns:

List of Snapshot objects

Raises:

RuntimeError if there was an error

property created: datetime

Created date of Snapshot

Returns:

Created date

property description: str

Get the description of a snapshot: the lines of its name after the first line

Returns:

Snapshot description as described

property file: RemoteFile

Owning File

Returns:

File object

property has_pulled_undo_entires: bool

If the snapshot has pulled undo entries yet

Returns:

True if they have been pulled

property hash: str

Hash of snapshot data (analysis and markup, etc) No specific hash algorithm is guaranteed

Returns:

Hash string

property id: str

Unique id

Returns:

Id string

property is_finalized: bool

If the snapshot has been finalized on the server and is no longer editable

Returns:

True if finalized

property last_modified: datetime

Date of last modification to the snapshot

Returns:

Last modified date

property name: str

Name of snapshot

Returns:

Name string

property parent_ids: List[str]

List of ids of all remote parent Snapshots

Returns:

List of id strings

Raises:

RuntimeError if there was an error

property parents: List[CollabSnapshot]

List of all parent Snapshot objects

Returns:

List of Snapshot objects

Raises:

RuntimeError if there was an error

property project: RemoteProject

Owning Project

Returns:

Project object

property remote: Remote

Owning Remote

Returns:

Remote object

property snapshot_file_hash: str

Hash of file contents in snapshot No specific hash algorithm is guaranteed

Returns:

Hash string

property title: str

Get the title of a snapshot: the first line of its name

Returns:

Snapshot title as described

property undo_entries: List[UndoEntry]

Get the list of undo entries stored in this snapshot.

Note

If undo entries have not been pulled, they will be pulled upon calling this.

Returns:

List of UndoEntry objects

Raises:

RuntimeError if there was an error pulling undo entries

property url: str

Web api endpoint url

Returns:

class UndoEntry(handle: LP_BNCollaborationUndoEntry)[source]

Bases: object

Class representing a remote undo entry

Parameters:

handle (LP_BNCollaborationUndoEntry) –

property data: str

Undo entry contents data

Returns:

Data string

property file: RemoteFile

Owning File

Returns:

File object

property id: int

Unique id

Returns:

Id number

property parent: UndoEntry | None

Parent Undo Entry object

Returns:

Undo Entry object, if there is one, None otherwise

property parent_id: int | None

Id of parent undo entry

Returns:

Parent id number, if there is one, None otherwise

property project: RemoteProject

Owning Project

Returns:

Project object

property remote: Remote

Owning Remote

Returns:

Remote object

property snapshot: CollabSnapshot

Owning Snapshot

Returns:

Snapshot object

property url: str

Web api endpoint url

Returns:

URL String