miasm
Reverse engineering framework
miasm.core.objc Namespace Reference

Classes

class  CGen
 
class  CGenArray
 
class  CGenDeref
 
class  CGenField
 
class  CGenId
 
class  CGenInt
 
class  CHandler
 
class  CLeafTypes
 
class  CTypesManager
 
class  CTypesManagerNotPacked
 
class  CTypesManagerPacked
 
class  ExprCToExpr
 
class  ExprToAccessC
 
class  ObjC
 
class  ObjCArray
 
class  ObjCDecl
 
class  ObjCEllipsis
 
class  ObjCFunc
 
class  ObjCInt
 
class  ObjCPtr
 
class  ObjCStruct
 
class  ObjCUnion
 

Functions

def missing_definition (objtype)
 
def objc_to_str (objc, result=None)
 
def access_simplifier (expr)
 
def access_str (expr)
 
def ast_get_c_access_expr (ast, expr_types, lvl=0)
 
def parse_access (c_access)
 

Variables

string PADDING_TYPE_NAME = "___padding___"
 
dictionary OBJC_PRIO
 

Detailed Description

C helper for Miasm:
* raw C to Miasm expression
* Miasm expression to raw C
* Miasm expression to C type

Function Documentation

◆ access_simplifier()

def miasm.core.objc.access_simplifier (   expr)
Expression visitor to simplify a C access represented in Miasm

@expr: Miasm expression representing the C access

Example:

IN: (In c: ['*(&((&((*(ptr_Test)).a))[0]))'])
[ExprOp('deref', ExprOp('addr', ExprOp('[]', ExprOp('addr',
ExprOp('field', ExprOp('deref', ExprId('ptr_Test', 64)),
ExprId('a', 64))), ExprInt(0x0, 64))))]

OUT: (In c: ['(ptr_Test)->a'])
[ExprOp('->', ExprId('ptr_Test', 64), ExprId('a', 64))]

◆ access_str()

def miasm.core.objc.access_str (   expr)
Return the C string of a C access represented in Miasm

@expr: Miasm expression representing the C access

In:
ExprOp('->', ExprId('ptr_Test', 64), ExprId('a', 64))
OUT:
'(ptr_Test)->a'
Here is the caller graph for this function:

◆ ast_get_c_access_expr()

def miasm.core.objc.ast_get_c_access_expr (   ast,
  expr_types,
  lvl = 0 
)
Transform C ast object into a C Miasm expression

@ast: parsed pycparser.c_ast object
@expr_types: a dictionary linking ID names to their types
@lvl: actual recursion level

Example:

IN:
StructRef: ->
  ID: ptr_Test
  ID: a

OUT:
ExprOp('->', ExprId('ptr_Test', 64), ExprId('a', 64))
Here is the caller graph for this function:

◆ missing_definition()

def miasm.core.objc.missing_definition (   objtype)
Here is the caller graph for this function:

◆ objc_to_str()

def miasm.core.objc.objc_to_str (   objc,
  result = None 
)
Here is the caller graph for this function:

◆ parse_access()

def miasm.core.objc.parse_access (   c_access)
Parse C access

@c_access: C access string
Here is the caller graph for this function:

Variable Documentation

◆ OBJC_PRIO

dictionary miasm.core.objc.OBJC_PRIO
Initial value:
1 = {
2  ObjC: 0,
3  ObjCDecl:1,
4  ObjCInt:2,
5  ObjCPtr:3,
6  ObjCArray:4,
7  ObjCStruct:5,
8  ObjCUnion:6,
9  ObjCEllipsis:7,
10  ObjCFunc:8,
11 }

◆ PADDING_TYPE_NAME

string miasm.core.objc.PADDING_TYPE_NAME = "___padding___"