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

Public Member Functions

def __init__
 
def __repr__
 
def hexdump
 
def getbytes
 
def getbits
 

Detailed Description

Definition at line 20 of file bin_stream.py.

Constructor & Destructor Documentation

def miasm2.core.bin_stream.bin_stream.__init__ (   self,
  args,
  kargs 
)

Definition at line 22 of file bin_stream.py.

22 
23  def __init__(self, *args, **kargs):
24  pass

Member Function Documentation

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

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.getbits (   self,
  start,
  n 
)
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.getbytes (   self,
  start,
  l = 1 
)

Definition at line 31 of file bin_stream.py.

31 
32  def getbytes(self, start, l=1):
33  return self.bin[start:start + l]

+ Here is the caller graph for this function:

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

Definition at line 28 of file bin_stream.py.

28 
29  def hexdump(self, offset, l):
30  return

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