Miasm2
 All Classes Namespaces Files Functions Variables Typedefs Properties Macros
Classes | Functions | Variables
miasm2.core.utils Namespace Reference

Classes

class  BoundedDict
 
class  Disasm_Exception
 
class  keydefaultdict
 

Functions

def hexdump
 
def whoami
 

Variables

tuple upck8 = lambdax:struct.unpack('B', x)
 
tuple upck16 = lambdax:struct.unpack('H', x)
 
tuple upck32 = lambdax:struct.unpack('I', x)
 
tuple upck64 = lambdax:struct.unpack('Q', x)
 
tuple pck8 = lambdax:struct.pack('B', x)
 
tuple pck16 = lambdax:struct.pack('H', x)
 
tuple pck32 = lambdax:struct.pack('I', x)
 
tuple pck64 = lambdax:struct.pack('Q', x)
 
dictionary pck
 

Function Documentation

def miasm2.core.utils.hexdump (   src,
  length = 16 
)

Definition at line 26 of file utils.py.

26 
27 def hexdump(src, length=16):
28  FILTER = ''.join(
29  [(len(repr(chr(x))) == 3) and chr(x) or '.' for x in range(256)])
30  lines = []
31  for c in xrange(0, len(src), length):
32  chars = src[c:c + length]
33  hexa = ' '.join(["%02x" % ord(x) for x in chars])
34  printable = ''.join(
35  ["%s" % ((ord(x) <= 127 and FILTER[ord(x)]) or '.') for x in chars])
36  lines.append("%04x %-*s %s\n" % (c, length * 3, hexa, printable))
37  print ''.join(lines)
38 
39 # stackoverflow.com/questions/2912231

+ Here is the caller graph for this function:

def miasm2.core.utils.whoami ( )

Definition at line 51 of file utils.py.

51 
52 def whoami():
53  return inspect.stack()[2][3]
54 

+ Here is the caller graph for this function:

Variable Documentation

dictionary miasm2.core.utils.pck
Initial value:
1 = {8:pck8,
2  16:pck16,
3  32:pck32,
4  64:pck64}

Definition at line 16 of file utils.py.

tuple miasm2.core.utils.pck16 = lambdax:struct.pack('H', x)

Definition at line 11 of file utils.py.

tuple miasm2.core.utils.pck32 = lambdax:struct.pack('I', x)

Definition at line 12 of file utils.py.

tuple miasm2.core.utils.pck64 = lambdax:struct.pack('Q', x)

Definition at line 13 of file utils.py.

tuple miasm2.core.utils.pck8 = lambdax:struct.pack('B', x)

Definition at line 10 of file utils.py.

tuple miasm2.core.utils.upck16 = lambdax:struct.unpack('H', x)

Definition at line 7 of file utils.py.

tuple miasm2.core.utils.upck32 = lambdax:struct.unpack('I', x)

Definition at line 8 of file utils.py.

tuple miasm2.core.utils.upck64 = lambdax:struct.unpack('Q', x)

Definition at line 9 of file utils.py.

tuple miasm2.core.utils.upck8 = lambdax:struct.unpack('B', x)

Definition at line 6 of file utils.py.