diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2019-02-25 11:09:54 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2019-03-05 16:52:49 +0100 |
| commit | 02bbb30efea4980c9d133947cbbf69fb599071ad (patch) | |
| tree | 3fea6826fcc5354840a27cb1dc99ff31eef81896 /miasm2/core/bin_stream_ida.py | |
| parent | eab809932871f91d6f4aa770fc321af9e156e0f5 (diff) | |
| download | miasm-02bbb30efea4980c9d133947cbbf69fb599071ad.tar.gz miasm-02bbb30efea4980c9d133947cbbf69fb599071ad.zip | |
Support python2/python3
Diffstat (limited to 'miasm2/core/bin_stream_ida.py')
| -rw-r--r-- | miasm2/core/bin_stream_ida.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/miasm2/core/bin_stream_ida.py b/miasm2/core/bin_stream_ida.py index fcd89f9f..44cf9367 100644 --- a/miasm2/core/bin_stream_ida.py +++ b/miasm2/core/bin_stream_ida.py @@ -1,7 +1,9 @@ +from builtins import range from idc import Byte, SegEnd from idautils import Segments from idaapi import is_mapped +from miasm2.core.utils import int_to_byte from miasm2.core.bin_stream import bin_stream_str @@ -13,13 +15,13 @@ class bin_stream_ida(bin_stream_str): It can raise error on overflow 7FFFFFFF with 32 bit python """ def _getbytes(self, start, l=1): - o = "" - for ad in xrange(l): + out = [] + for ad in range(l): offset = ad + start + self.base_address if not is_mapped(offset): raise IOError("not enough bytes") - o += chr(Byte(offset)) - return o + out.append(int_to_byte(Byte(offset))) + return b''.join(out) def readbs(self, l=1): if self.offset + l > self.l: |