diff options
| author | Brian Potchik <brian@vector35.com> | 2024-05-27 15:29:48 -0400 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2024-05-27 15:29:48 -0400 |
| commit | a348dab8b14b8ddd36c400ae39a7a48b6a28e829 (patch) | |
| tree | c5aa3b6274b57660d263de44ac1eccc9bfa8739d /python | |
| parent | 309d606f1c51168c0ef30ccf7850d483429fa35b (diff) | |
Update load APIs to take a JSON string for options.
Diffstat (limited to 'python')
| -rw-r--r-- | python/binaryview.py | 22 | ||||
| -rw-r--r-- | python/metadata.py | 3 |
2 files changed, 14 insertions, 11 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index 39cd344d..0df5a2b1 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -2136,12 +2136,12 @@ class MemoryMap: size: 0x4 objects: 'origin<Mapped>' | Mapped<Absolute> - + <region: 0xc0000000 - 0xc0001000> size: 0x1000 objects: 'origin<Mapped>' | Unmapped | FILL<0x0> - + <region: 0xc0001000 - 0xc0001014> size: 0x14 objects: @@ -2153,13 +2153,13 @@ class MemoryMap: size: 0x4 objects: 'origin<Mapped>' | Mapped<Absolute> - + <region: 0xc0000000 - 0xc0001000> size: 0x1000 objects: 'rom' | Mapped 'origin<Mapped>' | Unmapped | FILL<0x0> - + <region: 0xc0001000 - 0xc0001014> size: 0x14 objects: @@ -2175,20 +2175,20 @@ class MemoryMap: size: 0x4 objects: 'origin<Mapped>' | Mapped<Absolute> - + <region: 0xc0000000 - 0xc0000008> size: 0x8 objects: 'pad' | Mapped<Relative> 'rom' | Mapped<Relative> 'origin<Mapped>' | Unmapped | FILL<0x0> - + <region: 0xc0000008 - 0xc0001000> size: 0xff8 objects: 'rom' | Mapped<Relative> 'origin<Mapped>' | Unmapped | FILL<0x0> - + <region: 0xc0001000 - 0xc0001014> size: 0x14 objects: @@ -2751,14 +2751,14 @@ class BinaryView: if isinstance(source, os.PathLike): source = str(source) if isinstance(source, BinaryView): - handle = core.BNLoadBinaryView(source.handle, update_analysis, progress_cfunc, metadata.Metadata(options).handle, source.file.has_database) + handle = core.BNLoadBinaryView(source.handle, update_analysis, json.dumps(options), progress_cfunc) elif isinstance(source, project.ProjectFile): - handle = core.BNLoadProjectFile(source._handle, update_analysis, progress_cfunc, metadata.Metadata(options).handle) + handle = core.BNLoadProjectFile(source._handle, update_analysis, json.dumps(options), progress_cfunc) elif isinstance(source, str): - handle = core.BNLoadFilename(source, update_analysis, progress_cfunc, metadata.Metadata(options).handle) + handle = core.BNLoadFilename(source, update_analysis, json.dumps(options), progress_cfunc) elif isinstance(source, bytes) or isinstance(source, bytearray) or isinstance(source, databuffer.DataBuffer): raw_view = BinaryView.new(source) - handle = core.BNLoadBinaryView(raw_view.handle, update_analysis, progress_cfunc, metadata.Metadata(options).handle, False) + handle = core.BNLoadBinaryView(raw_view.handle, update_analysis, json.dumps(options), progress_cfunc) else: raise NotImplementedError return BinaryView(handle=handle) if handle else None diff --git a/python/metadata.py b/python/metadata.py index e87c5cbb..77e3e98c 100644 --- a/python/metadata.py +++ b/python/metadata.py @@ -216,6 +216,9 @@ class Metadata: result[key] = self[key] return result + def get_json_string(self): + return str(core.BNMetadataGetJsonString(self.handle)) + @property def type(self): return MetadataType(core.BNMetadataGetType(self.handle)) |
