Skip to content

update to use binaryninja-api generate stubs #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 41 additions & 9 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,40 @@ jobs:
matrix:
include:
- os: ubuntu-22.04
- os: macos-12
boost_platform_version: 22.04
boost_toolset: gcc
boost_arch: x86
- os: macos-13
boost_platform_version: 13
boost_toolset: clang
boost_arch: x86
- os: macos-14
boost_platform_version: 14
boost_toolset: clang
boost_arch: aarch64
- os: windows-2022
boost_platform_version: 2022
boost_toolset: msvc
boost_arch: x86
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Install ninja-build tool
uses: turtlesec-no/get-ninja@1.1.0
uses: seanmiddleditch/gha-setup-ninja@v6

- name: Create Build Environment
env:
IDASDK_SECRET: ${{ secrets.IDASDK_SECRET }}
- name: Create Build Directory
working-directory: ${{ github.workspace }}
shell: bash
run: mkdir -p "${{ runner.workspace }}/build"

- name: Unzip IDA SDK
working-directory: ${{ github.workspace }}
env:
IDASDK_SECRET: ${{ secrets.IDASDK_SECRET }}
if: env.IDASDK_SECRET != ''
run: |
mkdir -p "${{ runner.workspace }}/build"
./.github/scripts/decrypt_secret.sh
unzip -q "${{ runner.workspace }}/build/idasdk_teams82.zip" \
-d "${{ runner.workspace }}/build/"
Expand All @@ -37,17 +54,32 @@ jobs:
if: matrix.os == 'windows-2022'
uses: ilammy/[email protected]

- name: Install Boost
uses: MarkusJx/install-boost@v2
id: install-boost
with:
arch: ${{ matrix.boost_arch }}
boost_version: 1.83.0
platform_version: ${{ matrix.boost_platform_version }}
toolset: ${{ matrix.boost_toolset }}

- name: Enable mold linker (Linux)
if: matrix.os == 'ubuntu-22.04'
uses: rui314/setup-mold@v1

- name: Configure CMake
working-directory: ${{ runner.workspace }}/build
env:
BOOST_ROOT: ${{steps.install-boost.outputs.BOOST_ROOT}}
shell: bash
run: |
cmake "${{ github.workspace }}" -G Ninja \
"-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" \
"-DIdaSdk_ROOT_DIR=${{ runner.workspace }}/build/idasdk_teams82"
"-DBINEXPORT_ENABLE_IDAPRO=${{ secrets.IDASDK_SECRET != '' && 'ON' || 'OFF'}}" \
"-DIdaSdk_ROOT_DIR=${{ runner.workspace }}/build/idasdk_teams82" \
"-DBINEXPORT_ENABLE_BINARYNINJA=ON" \
"-DBINEXPORT_BINARYNINJA_CHANNEL=stable" \
"-DBoost_INCLUDE_DIR=${{steps.install-boost.outputs.BOOST_ROOT}}/include"

- name: Build
working-directory: ${{ runner.workspace }}/build
Expand All @@ -60,9 +92,9 @@ jobs:
run: ctest --build-config "${BUILD_TYPE}" --output-on-failure -R '^[A-Z]'

- name: Upload Build Artifacts
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v4.6.2
with:
name: BinExport-${{ runner.os }}
name: BinExport-${{ runner.os }}-${{ runner.arch }}
path: |
${{ runner.workspace }}/build/binaryninja/binexport*
${{ runner.workspace }}/build/ida/binexport*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
gradle buildExtension -PGHIDRA_INSTALL_DIR=${{ env.GHIDRA_INSTALL_DIR }}

- name: Upload build artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v4.6.2
with:
name: BinExport_Ghidra_${{ matrix.ghidra }}
path: |
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ mv third_party/idasdk/idasdk_pro82/* third_party/idasdk
rmdir third_party/idasdk/idasdk_pro82
```

#### Binary Ninja

If building the Binary Ninja plugin, set `-DBINEXPORT_BINARYNINJA_CHANNEL` to either `stable` or `dev` to build against pinned versions of those channels.

`-DBINEXPORT_BINARYNINJA_LATEST=ON` can be used to instead build against the latest commit from [GitHub](https://github.com/Vector35/binaryninja-api).

#### Build BinExport

With all prerequisites in place, configure and build BinExport and run
Expand Down
19 changes: 6 additions & 13 deletions binaryninja/main_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -567,18 +567,11 @@ bool Plugin::Init() {

} // namespace security::binexport

extern "C" BINARYNINJAPLUGIN uint32_t CorePluginABIVersion() {
// Previously, BinExport worked around Binary Ninja's ABI version handling,
// to make sure to have it try and load the plugin unconditionally. This
// was done in order to be able to support both the fast moving "dev"
// channel as well as the stable one. The intention was for BinExport to
// use "mostly stable" API functions to work on both and have Binary Ninja
// ignore the plugin if it used functionality that was not available.
// However, this proved to be no longer feasible at some point with
// BinExport leading to crashes.
return BN_MINIMUM_CORE_ABI_VERSION;
}
extern "C"
{
BN_DECLARE_CORE_ABI_VERSION

extern "C" BINARYNINJAPLUGIN bool CorePluginInit() {
return security::binexport::Plugin::instance()->Init();
BINARYNINJAPLUGIN bool CorePluginInit() {
return security::binexport::Plugin::instance()->Init();
}
}
Loading