biome: 1.9.2 -> 1.9.3 (#349335)
[NixPkgs.git] / pkgs / development / python-modules / miasm / 0002-core-remove-IDAPython-dependency.patch
blob20262d8102b10b8c9a67ea66478b51870eb3bf49
1 From fd2a6b2899c8b836a086b43ec9ebccf726f71ec4 Mon Sep 17 00:00:00 2001
2 From: Moritz Sanft <58110325+msanft@users.noreply.github.com>
3 Date: Sat, 11 May 2024 11:04:19 +0200
4 Subject: [PATCH] core: remove IDAPython dependency
6 Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com>
7 ---
8 miasm/core/bin_stream_ida.py | 45 ------------------------------------
9 1 file changed, 45 deletions(-)
10 delete mode 100644 miasm/core/bin_stream_ida.py
12 diff --git a/miasm/core/bin_stream_ida.py b/miasm/core/bin_stream_ida.py
13 deleted file mode 100644
14 index 15bd9d8b..00000000
15 --- a/miasm/core/bin_stream_ida.py
16 +++ /dev/null
17 @@ -1,45 +0,0 @@
18 -from builtins import range
19 -from idc import get_wide_byte, get_segm_end
20 -from idautils import Segments
21 -from idaapi import is_mapped
23 -from miasm.core.utils import int_to_byte
24 -from miasm.core.bin_stream import bin_stream_str
27 -class bin_stream_ida(bin_stream_str):
28 - """
29 - bin_stream implementation for IDA
31 - Don't generate xrange using address computation:
32 - It can raise error on overflow 7FFFFFFF with 32 bit python
33 - """
34 - def _getbytes(self, start, l=1):
35 - out = []
36 - for ad in range(l):
37 - offset = ad + start + self.base_address
38 - if not is_mapped(offset):
39 - raise IOError(f"not enough bytes @ offset {offset:x}")
40 - out.append(int_to_byte(get_wide_byte(offset)))
41 - return b''.join(out)
43 - def readbs(self, l=1):
44 - if self.offset + l > self.l:
45 - raise IOError("not enough bytes")
46 - content = self.getbytes(self.offset)
47 - self.offset += l
48 - return content
50 - def __str__(self):
51 - raise NotImplementedError('Not fully functional')
53 - def setoffset(self, val):
54 - self.offset = val
56 - def getlen(self):
57 - # Lazy version
58 - if hasattr(self, "_getlen"):
59 - return self._getlen
60 - max_addr = get_segm_end(list(Segments())[-1] - (self.offset - self.base_address))
61 - self._getlen = max_addr
62 - return max_addr
63 --
64 2.44.0