Miasm2
 All Classes Namespaces Files Functions Variables Typedefs Properties Macros
Public Member Functions | Public Attributes | List of all members
miasm2.core.bin_stream.bin_stream_elf Class Reference
+ Inheritance diagram for miasm2.core.bin_stream.bin_stream_elf:
+ Collaboration diagram for miasm2.core.bin_stream.bin_stream_elf:

Public Member Functions

def is_addr_in
 
def getlen
 
def readbs
 
def getbytes
 
def __str__
 
def setoffset
 
def __repr__
 
def hexdump
 
def getbits
 

Public Attributes

 bin
 
 l
 
 offset
 

Detailed Description

Definition at line 162 of file bin_stream.py.

Member Function Documentation

def miasm2.core.bin_stream.bin_stream.__repr__ (   self)
inherited

Definition at line 25 of file bin_stream.py.

25 
26  def __repr__(self):
27  return "<%s !!>" % self.__class__.__name__
def miasm2.core.bin_stream.bin_stream_container.__str__ (   self)
inherited

Definition at line 150 of file bin_stream.py.

151  def __str__(self):
152  out = self.bin(self.offset, self.l)
153  return out
def miasm2.core.bin_stream.bin_stream.getbits (   self,
  start,
  n 
)
inherited
Return the bits from the bit stream
@start: the offset in bits
@n: number of bits to read

Definition at line 34 of file bin_stream.py.

34 
35  def getbits(self, start, n):
36  """Return the bits from the bit stream
37  @start: the offset in bits
38  @n: number of bits to read
39  """
40  if not n:
41  return 0
42  o = 0
43  if n > self.getlen() * 8:
44  raise IOError('not enough bits %r %r' % (n, len(self.bin) * 8))
45  while n:
46  # print 'xxx', n, start
47  i = start / 8
48  c = self.getbytes(i)
49  if not c:
50  raise IOError('cannot get bytes')
51  c = ord(c)
52  # print 'o', hex(c)
53  r = 8 - start % 8
54  c &= (1 << r) - 1
55  # print 'm', hex(c)
56  l = min(r, n)
57  # print 'd', r-l
58  c >>= (r - l)
59  o <<= l
60  o |= c
61  n -= l
62  start += l
63  return o
64 

+ Here is the call graph for this function:

def miasm2.core.bin_stream.bin_stream_container.getbytes (   self,
  start,
  l = 1 
)
inherited

Definition at line 147 of file bin_stream.py.

148  def getbytes(self, start, l=1):
149  return self.bin(start, start + l)
def miasm2.core.bin_stream.bin_stream_container.getlen (   self)
inherited

Definition at line 138 of file bin_stream.py.

139  def getlen(self):
140  return self.l

+ Here is the caller graph for this function:

def miasm2.core.bin_stream.bin_stream.hexdump (   self,
  offset,
  l 
)
inherited

Definition at line 28 of file bin_stream.py.

28 
29  def hexdump(self, offset, l):
30  return
def miasm2.core.bin_stream.bin_stream_container.is_addr_in (   self,
  ad 
)
inherited

Definition at line 135 of file bin_stream.py.

136  def is_addr_in(self, ad):
137  return self.bin.is_addr_in(ad)
def miasm2.core.bin_stream.bin_stream_container.readbs (   self,
  l = 1 
)
inherited

Definition at line 141 of file bin_stream.py.

142  def readbs(self, l=1):
143  if self.offset + l > self.l:
144  raise IOError("not enough bytes")
145  self.offset += l
146  return self.bin(self.offset - l, self.offset)
def miasm2.core.bin_stream.bin_stream_container.setoffset (   self,
  val 
)
inherited

Definition at line 154 of file bin_stream.py.

155  def setoffset(self, val):
156  self.offset = val
157 

Member Data Documentation

miasm2.core.bin_stream.bin_stream_container.bin
inherited

Definition at line 131 of file bin_stream.py.

miasm2.core.bin_stream.bin_stream_container.l
inherited

Definition at line 132 of file bin_stream.py.

miasm2.core.bin_stream.bin_stream_container.offset
inherited

Definition at line 133 of file bin_stream.py.


The documentation for this class was generated from the following file: