Populates the [MatcherSettings] to the current Binary Ninja settings instance. Call this once when you initialize so that the settings exist. NOTE: If you are using this as a library then just modify the MatcherSettings directly in the matcher instance, that way you don't need to round-trip through Binary Ninja.
()
| 398 | /// NOTE: If you are using this as a library then just modify the MatcherSettings directly |
| 399 | /// in the matcher instance, that way you don't need to round-trip through Binary Ninja. |
| 400 | pub fn register() { |
| 401 | let bn_settings = binaryninja::settings::Settings::new(); |
| 402 | |
| 403 | let trivial_function_len_props = json!({ |
| 404 | "title" : "Trivial Function Length", |
| 405 | "type" : "number", |
| 406 | "default" : Self::TRIVIAL_FUNCTION_LEN_DEFAULT, |
| 407 | "description" : "Functions below this length in bytes will be required to match on constraints.", |
| 408 | "ignore" : ["SettingsProjectScope", "SettingsResourceScope"] |
| 409 | }); |
| 410 | bn_settings.register_setting_json( |
| 411 | Self::TRIVIAL_FUNCTION_LEN_SETTING, |
| 412 | trivial_function_len_props.to_string(), |
| 413 | ); |
| 414 | |
| 415 | let minimum_function_len_props = json!({ |
| 416 | "title" : "Minimum Function Length", |
| 417 | "type" : "number", |
| 418 | "default" : Self::MINIMUM_FUNCTION_LEN_DEFAULT, |
| 419 | "description" : "Functions below this length will not be matched.", |
| 420 | "ignore" : ["SettingsProjectScope", "SettingsResourceScope"] |
| 421 | }); |
| 422 | bn_settings.register_setting_json( |
| 423 | Self::MINIMUM_FUNCTION_LEN_SETTING, |
| 424 | minimum_function_len_props.to_string(), |
| 425 | ); |
| 426 | |
| 427 | let maximum_function_len_props = json!({ |
| 428 | "title" : "Maximum Function Length", |
| 429 | "type" : "number", |
| 430 | "default" : Self::MAXIMUM_FUNCTION_LEN_DEFAULT, |
| 431 | "description" : "Functions above this length will not be matched. A value of 0 will disable this check.", |
| 432 | "ignore" : ["SettingsProjectScope", "SettingsResourceScope"] |
| 433 | }); |
| 434 | bn_settings.register_setting_json( |
| 435 | Self::MAXIMUM_FUNCTION_LEN_SETTING, |
| 436 | maximum_function_len_props.to_string(), |
| 437 | ); |
| 438 | |
| 439 | let minimum_matched_constraints_props = json!({ |
| 440 | "title" : "Minimum Matched Constraints", |
| 441 | "type" : "number", |
| 442 | "default" : Self::MINIMUM_MATCHED_CONSTRAINTS_DEFAULT, |
| 443 | "description" : "When function constraints are checked the amount of constraints matched must be at-least this.", |
| 444 | "ignore" : ["SettingsProjectScope", "SettingsResourceScope"] |
| 445 | }); |
| 446 | bn_settings.register_setting_json( |
| 447 | Self::MINIMUM_MATCHED_CONSTRAINTS_SETTING, |
| 448 | minimum_matched_constraints_props.to_string(), |
| 449 | ); |
| 450 | |
| 451 | let trivial_function_adjacent_allowed_props = json!({ |
| 452 | "title" : "Trivial Function Adjacent Constraints Allowed", |
| 453 | "type" : "boolean", |
| 454 | "default" : Self::TRIVIAL_FUNCTION_ADJACENT_ALLOWED_DEFAULT, |
| 455 | "description" : "When function constraints are checked if this is enabled functions can match based off trivial adjacent functions.", |
| 456 | "ignore" : ["SettingsProjectScope", "SettingsResourceScope"] |
| 457 | }); |
no test coverage detected