summaryrefslogtreecommitdiff
path: root/python/collaboration
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2024-07-15 17:39:03 -0400
committerJosh Ferrell <josh@vector35.com>2024-07-15 17:39:03 -0400
commitc473dc8bbe0b224f59a0fe1b8cbde2cd67d083af (patch)
tree12922857762de56c82c4c1ae0a690ef837f901d3 /python/collaboration
parentf7be5a952b0ea2fcf4583ff8413d96e4a4148bc0 (diff)
Fix sync_test.py collaboration example
Diffstat (limited to 'python/collaboration')
-rw-r--r--python/collaboration/examples/sync_test.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/python/collaboration/examples/sync_test.py b/python/collaboration/examples/sync_test.py
index 6b81d03c..61def8de 100644
--- a/python/collaboration/examples/sync_test.py
+++ b/python/collaboration/examples/sync_test.py
@@ -19,6 +19,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
+import platform
import shutil
from pathlib import Path
@@ -27,6 +28,12 @@ import binaryninja.enterprise as enterprise
import binaryninja.collaboration as collaboration
+if platform.system() == 'Windows':
+ TEST_FILE = 'C:\\Windows\\System32\\printui.exe'
+else:
+ TEST_FILE = '/bin/ls'
+
+
def main():
with enterprise.LicenseCheckout():
# Connect to remote from Enterprise
@@ -43,13 +50,13 @@ def main():
project_dir = None
try:
print(f'Created project {project.name}')
- file = project.upload_new_file('/bin/ls')
+ file = project.upload_new_file(TEST_FILE)
print(f'Created file {project.name}/{file.name}')
- project_dir = Path(file.default_bndb_path).parent
+ project_dir = Path(file.default_path).parent
print(f'Snapshots: {[snapshot.id for snapshot in file.snapshots]}')
- bv = binaryninja.load(file.default_bndb_path)
+ bv = binaryninja.load(file.default_path)
view_type = bv.view_type
assert collaboration.RemoteFile.get_for_bv(bv) == file
@@ -62,18 +69,21 @@ def main():
# Try deleting the bndb, redownload and see if the function name is preserved
bv.file.close()
- Path(file.default_bndb_path).unlink()
+ Path(file.default_path).unlink()
print(f'Redownloading {project.name}/{file.name}...')
metadata = file.download_to_bndb()
bv = metadata.get_view_of_type(view_type)
print(f'Entry function name: {bv.entry_function.name}')
assert bv.entry_function.name == 'entry_function'
+ bv.file.close()
finally:
# Clean up
if file is not None:
project.delete_file(file)
+ if project.is_open:
+ project.core_project.close()
remote.delete_project(project)
if project_dir is not None:
shutil.rmtree(project_dir)