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

Class Project

python/project.py:313–679  ·  view source on GitHub ↗

Class representing a project

Source from the content-addressed store, hash-verified

311
312
313class Project:
314 """
315 Class representing a project
316 """
317 def __init__(self, handle: core.BNProjectHandle):
318 self._handle = handle
319
320 def __del__(self):
321 if core is not None:
322 core.BNFreeProject(self._handle)
323
324 def __repr__(self) -> str:
325 return f'<Project: {self.name}>'
326
327 def __str__(self) -> str:
328 return f'<Project: {self.name}>'
329
330 @staticmethod
331 def open_project(path: AsPath) -> 'Project':
332 """
333 Open an existing project
334
335 :param path: Path to the project directory (.bnpr) or project metadata file (.bnpm)
336 :return: Opened project
337 :raises ProjectException: If there was an error opening the project
338 """
339 binaryninja._init_plugins()
340 project_handle = core.BNOpenProject(str(path))
341 if project_handle is None:
342 raise ProjectException("Failed to open project")
343 return Project(handle=project_handle)
344
345 @staticmethod
346 def create_project(path: AsPath, name: str) -> 'Project':
347 """
348 Create a new project
349
350 :param path: Path to the project directory (.bnpr)
351 :param name: Name of the new project
352 :return: Opened project
353 :raises ProjectException: If there was an error creating the project
354 """
355 binaryninja._init_plugins()
356 project_handle = core.BNCreateProject(str(path), name)
357 if project_handle is None:
358 raise ProjectException("Failed to create project")
359 return Project(handle=project_handle)
360
361 def open(self) -> bool:
362 """
363 Open a closed project
364
365 :return: True if the project is now open, False otherwise
366 """
367 return core.BNProjectOpen(self._handle)
368
369 def close(self) -> bool:
370 """

Callers 4

projectMethod · 0.70
projectMethod · 0.70
open_projectMethod · 0.70
create_projectMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected