Miasm2
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Properties
Macros
miasm2
core
bin_stream_ida.py
Go to the documentation of this file.
1
from
idc
import
Byte, SegEnd
2
from
idautils
import
Segments
3
4
from
miasm2.core.bin_stream
import
bin_stream_str
5
6
7
class
bin_stream_ida
(
bin_stream_str
):
8
"""
9
bin_stream implementation for IDA
10
11
Don't generate xrange using address computation:
12
It can raise error on overflow 7FFFFFFF with 32 bit python
13
"""
14
def
getbytes
(self, start, l=1):
15
o =
""
16
for
ad
in
xrange(l):
17
o += chr(Byte(ad + start - self.
shift
))
18
return
o
19
20
def
readbs
(self, l=1):
21
if
self.
offset
+ l > self.
l
:
22
raise
IOError(
"not enough bytes"
)
23
o = self.
getbytes
(self.
offset
)
24
self.
offset
+= l
25
return
p
26
27
def
__str__
(self):
28
raise
NotImplementedError(
'Not fully functional'
)
29
30
def
setoffset
(self, val):
31
self.
offset
= val
32
33
def
getlen
(self):
34
# Lazy version
35
if
hasattr(self,
"_getlen"
):
36
return
self.
_getlen
37
max_addr = SegEnd(list(Segments())[-1] - (self.
offset
+ self.
shift
))
38
self.
_getlen
= max_addr
39
return
max_addr
miasm2.core.bin_stream_ida.bin_stream_ida._getlen
_getlen
Definition:
bin_stream_ida.py:38
miasm2.core.bin_stream_ida.bin_stream_ida
Definition:
bin_stream_ida.py:7
miasm2.core.bin_stream
Definition:
bin_stream.py:1
miasm2.core.bin_stream_ida.bin_stream_ida.__str__
def __str__
Definition:
bin_stream_ida.py:27
miasm2.core.bin_stream.bin_stream.getbytes
def getbytes
Definition:
bin_stream.py:31
miasm2.core.bin_stream.bin_stream_str.l
l
Definition:
bin_stream.py:72
miasm2.core.bin_stream.bin_stream_str
Definition:
bin_stream.py:65
miasm2.core.bin_stream.bin_stream_str.shift
shift
Definition:
bin_stream.py:71
miasm2.core.bin_stream_ida.bin_stream_ida.readbs
def readbs
Definition:
bin_stream_ida.py:20
miasm2.core.bin_stream_ida.bin_stream_ida.getbytes
def getbytes
Definition:
bin_stream_ida.py:14
miasm2.core.bin_stream_ida.bin_stream_ida.getlen
def getlen
Definition:
bin_stream_ida.py:33
miasm2.core.bin_stream_ida.bin_stream_ida.setoffset
def setoffset
Definition:
bin_stream_ida.py:30
miasm2.core.bin_stream.bin_stream_str.offset
offset
Definition:
bin_stream.py:70
Generated by
1.8.8