Vector35 / Vector35/binaryninja-api

Create (Save) Database To ProjectFile Handle

Open
#7,848 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

What is the feature you'd like to have?
A single step from a new analysis to saving it to a database in a project. At the moment, to get a database into a project, it needs to be saved somewhere else first and then imported into the project using Project.create_file_from_path(). There should be a way to take an empty project file handle and pass it to bv.create_database. And/Or Project.create_file should be able to accept a bv? Or the appropriate handle that lets a ProjectFile be created directly from a new analysis.

Is your feature request related to a problem?
The current two step process seems inefficient and not straightforward.

Are any alternative solutions acceptable?

for pf in tqdm.notebook.tqdm(to_do):
    with tempfile.TemporaryDirectory() as td:
        bv = binaryninja.load(pf)
        bv.update_analysis_and_wait()
        tdp = pathlib.Path(td)
        dest = tdp.joinpath(f'{pf.name}.bndb')
        bv.create_database(dest)
        bv.file.close()
        p.create_file_from_path(dest, f, dest.name)

to_do here contains a list of ProjectFile handles to raw files in the project.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing Project.create_file_from_path(), Project.create_file(), and bv.create_database() entry points, using the Python example in the issue as the behavior to understand. Determine how a ProjectFile handle could be created directly from a new analysis, and consider the intended API boundary. Done means a new analysis can be saved into a project without the temporary-file and import steps.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
api, reverse-engineering
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.