Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
60701b1
[idb_import] Rebase BaseSection against lowest segment, not lowest se…
ChrisKader Jun 5, 2026
125f386
[idb_import] Remove orphaned types.rs translator
ChrisKader Jun 5, 2026
d69d3c7
[idb_import] Improve TIL type translation fidelity
ChrisKader Jun 5, 2026
e9dbe80
[idb_import] Resolve parse.rs TODOs
ChrisKader Jun 5, 2026
ed2d932
[idb_import] Resolve mapper/commands TODOs and surface IDB SHA256
ChrisKader Jun 5, 2026
5782c43
[idb_import] Verify IDB matches the loaded binary by SHA256
ChrisKader Jun 5, 2026
cd71603
[idb_import] Recover argument locations and register variables
ChrisKader Jun 5, 2026
dfe2670
[idb_import] Import IDA stack frames as stack variables
ChrisKader Jun 5, 2026
51a30f0
[idb_import] Apply no-return functions and local labels
ChrisKader Jun 5, 2026
8cffc1c
[idb_import] Import IDA function folders as Binary Ninja components
ChrisKader Jun 5, 2026
541cd9f
[idb_import] Resolve register-based argument locations
ChrisKader Jun 5, 2026
ee7c94f
[idb_import] Make folder mapping robust and observable
ChrisKader Jun 5, 2026
d61c0d8
[idb_import] Resolve function return-value locations
ChrisKader Jun 5, 2026
a0ad3f0
[idb_import] Dedup segments by exact range as well as name
ChrisKader Jun 5, 2026
06fb9b0
[idb_import] Generalize base-address comment to all formats
ChrisKader Jun 5, 2026
dd3e8e0
[idb_import] Translate unknown-unsized basic type as void
ChrisKader Jun 5, 2026
610f28c
[idb_import] Import typed data variables from byte flags
ChrisKader Jun 5, 2026
a608745
[idb_import] Import per-operand number formats (opt-in)
ChrisKader Jun 5, 2026
f0142e4
[idb_import] Type struct data items with their real type
ChrisKader Jun 5, 2026
a61a757
[idb_import] Type string data with their character width
ChrisKader Jun 5, 2026
6edeedb
[idb_import] Display enum operands against their enumeration
ChrisKader Jun 5, 2026
d01e768
[idb_import] Probe enum altval directly instead of gating on operand …
ChrisKader Jun 5, 2026
53a8d79
Fix use-after-free of enum type id in set_int_display_type
ChrisKader Jun 6, 2026
ced97c8
[idb_import] Apply operand display overrides after functions exist
ChrisKader Jun 6, 2026
fc17355
[idb_import] Split enum-operand and number-format settings
ChrisKader Jun 6, 2026
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
66 changes: 66 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion plugins/idb_import/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ binaryninjacore-sys.workspace = true
idb-rs = { git = "https://github.com/Vector35/idb-rs", tag = "0.1.13" }
tracing = "0.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_json = "1.0"
sha2 = "0.10"
3 changes: 2 additions & 1 deletion plugins/idb_import/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ impl LoadFileField {
pub fn field(&self) -> FormInputField {
FormInputField::OpenFileName {
prompt: "File Path".to_string(),
// TODO: This is called extension but is really a filter.
// NOTE: Binary Ninja's `OpenFileName` field names this `extension`, but it accepts a
// full file filter expression (e.g. "*.idb;*.i64"), which is what we pass here.
extension: Some(self.filter.clone()),
default: self.default.clone(),
value: None,
Expand Down
32 changes: 30 additions & 2 deletions plugins/idb_import/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
use crate::mapper::IDBMapper;
use crate::parse::IDBFileParser;
use crate::settings::LoadSettings;
use binaryninja::binary_view::AnalysisContext;
use binaryninja::binary_view::{
register_binary_view_event, AnalysisContext, BinaryView, BinaryViewEventHandler,
BinaryViewEventType,
};
use binaryninja::workflow::{activity, Activity, Workflow};
use std::fs::File;
use std::io::BufReader;

/// Applies the per-operand display overrides (number formats and enum displays) that the import
/// deferred because they require the view's functions to exist. By the time initial analysis
/// completes the functions are present, so the overrides can be set and a re-analysis requested to
/// render them.
struct OperandDisplayApplier;

impl BinaryViewEventHandler for OperandDisplayApplier {
fn on_event(&self, view: &BinaryView) {
if crate::mapper::apply_pending_operand_display(view) {
// The overrides only affect rendering once analysis re-runs over the functions.
view.update_analysis();
}
}
}

mod commands;
pub mod mapper;
pub mod parse;
Expand All @@ -24,6 +42,12 @@ fn plugin_init() -> Result<(), ()> {
// Register settings globally.
LoadSettings::register();

// Apply deferred per-operand display overrides once functions exist.
register_binary_view_event(
BinaryViewEventType::BinaryViewInitialAnalysisCompletionEvent,
OperandDisplayApplier,
);

let loader_activity = |ctx: &AnalysisContext| {
let view = ctx.view();
let load_settings = LoadSettings::from_view_settings(&view);
Expand All @@ -39,7 +63,11 @@ fn plugin_init() -> Result<(), ()> {
let file_parser = IDBFileParser::new();
match file_parser.parse(&mut file_reader) {
Ok(idb_info) => {
IDBMapper::new(idb_info).map_to_view(&view);
IDBMapper::new(idb_info)
.with_operand_enums(load_settings.apply_operand_enums)
.with_operand_formats(load_settings.apply_operand_formats)
.with_skip_default_operand_formats(load_settings.skip_default_operand_formats)
.map_to_view(&view);
}
Err(e) => {
tracing::error!("Failed to parse IDB file: {}", e);
Expand Down
Loading