diff options
| author | Brandon Miller <brandon@vector35.com> | 2024-05-28 11:11:34 -0700 |
|---|---|---|
| committer | Brandon Miller <brandon@vector35.com> | 2024-05-28 11:11:34 -0700 |
| commit | fbf782fcd84aa77f8765589bdda491646a957044 (patch) | |
| tree | fd65303ca3abe3b2a538f23d4afe473d9e08a12b /python/examples | |
| parent | 9537f33da6b8de883a45c4b7758f0dc5c1438ed7 (diff) | |
Use Architecture type for BASE arch param
Diffstat (limited to 'python/examples')
| -rw-r--r-- | python/examples/raw_binary_base_detection.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/python/examples/raw_binary_base_detection.py b/python/examples/raw_binary_base_detection.py index b584903c..1180b672 100644 --- a/python/examples/raw_binary_base_detection.py +++ b/python/examples/raw_binary_base_detection.py @@ -25,7 +25,7 @@ raw position-dependent firmware binaries import argparse import json from os import walk, path -from binaryninja import BaseAddressDetection, log_to_stderr, LogLevel, log_info, log_error +from binaryninja import BaseAddressDetection, log_to_stderr, LogLevel, log_info, log_error, Architecture def _get_directory_listing(_path: str) -> list[str]: @@ -48,7 +48,7 @@ def _parse_args() -> argparse.Namespace: parser.add_argument("--debug", action="store_true", help="enable debug logging") parser.add_argument("--reasons", action="store_true", help="show reasons for base address selection") parser.add_argument("--analysis", type=str, help="analysis level", default="full") - parser.add_argument("--arch", type=str, default="", help="architecture of the binary") + parser.add_argument("--arch", type=str, help="architecture of the binary") return parser.parse_args() @@ -68,7 +68,8 @@ def main() -> None: for _file in files: log_info(f"Running base address detection analysis on '{_file}'...") bad = BaseAddressDetection(_file) - if not bad.detect_base_address(analysis=args.analysis, arch=args.arch): + arch = Architecture[args.arch] if args.arch else None + if not bad.detect_base_address(analysis=args.analysis, arch=arch): log_error("Base address detection analysis failed") continue |
