miasm
Reverse engineering framework
|
Classes | |
class | DiGraphExpr |
class | Expr |
class | ExprAff |
class | ExprAssign |
class | ExprCompose |
class | ExprCond |
class | ExprGetR |
class | ExprId |
class | ExprInt |
class | ExprLoc |
class | ExprMem |
class | ExprOp |
class | ExprSlice |
class | ExprVisitorBase |
class | ExprVisitorCallbackBottomToTop |
class | ExprVisitorCallbackTopToBottom |
class | ExprVisitorCanonize |
class | ExprVisitorContains |
class | ExprWalk |
class | ExprWalkBase |
class | LocKey |
Functions | |
def | should_parenthesize_child (child, parent) |
def | str_protected_child (child, parent) |
def | is_expr (expr) |
def | is_associative (expr) |
def | is_commutative (expr) |
def | canonize_to_exprloc (locdb, expr) |
def | is_function_call (expr) |
def | compare_exprs_compose (expr1, expr2) |
def | compare_expr_list_compose (l1_e, l2_e) |
def | compare_expr_list (l1_e, l2_e) |
def | compare_exprs (expr1, expr2) |
def | canonize_expr_list (expr_list) |
def | canonize_expr_list_compose (expr_list) |
def | ExprInt1 (i) |
def | ExprInt8 (i) |
def | ExprInt16 (i) |
def | ExprInt32 (i) |
def | ExprInt64 (i) |
def | ExprInt_from (expr, i) |
def | get_expr_ids_visit (expr, ids) |
def | get_expr_locs_visit (expr, locs) |
def | get_expr_ids (expr) |
def | get_expr_locs (expr) |
def | test_set (expr, pattern, tks, result) |
def | match_expr (expr, pattern, tks, result=None) |
def | MatchExpr (expr, pattern, tks, result=None) |
def | get_rw (exprs) |
def | get_list_rw (exprs, mem_read=False, cst_read=True) |
def | get_expr_ops (expr) |
def | get_expr_mem (expr) |
def | expr_is_equal (op1, op2) |
def | expr_is_not_equal (op1, op2) |
def | expr_is_unsigned_greater (op1, op2) |
def | expr_is_unsigned_greater_or_equal (op1, op2) |
def | expr_is_unsigned_lower (op1, op2) |
def | expr_is_unsigned_lower_or_equal (op1, op2) |
def | expr_is_signed_greater (op1, op2) |
def | expr_is_signed_greater_or_equal (op1, op2) |
def | expr_is_signed_lower (op1, op2) |
def | expr_is_signed_lower_or_equal (op1, op2) |
def | expr_is_NaN (expr) |
def | expr_is_infinite (expr) |
def | expr_is_IEEE754_zero (expr) |
def | expr_is_IEEE754_denormal (expr) |
def | expr_is_qNaN (expr) |
def | expr_is_sNaN (expr) |
def | expr_is_float_lower (op1, op2) |
def | expr_is_float_equal (op1, op2) |
Variables | |
string | TOK_INF = "<" |
string | TOK_INF_SIGNED = TOK_INF + "s" |
string | TOK_INF_UNSIGNED = TOK_INF + "u" |
string | TOK_INF_EQUAL = "<=" |
string | TOK_INF_EQUAL_SIGNED = TOK_INF_EQUAL + "s" |
string | TOK_INF_EQUAL_UNSIGNED = TOK_INF_EQUAL + "u" |
string | TOK_EQUAL = "==" |
string | TOK_POS = "pos" |
string | TOK_POS_STRICT = "Spos" |
int | EXPRINT = 1 |
int | EXPRID = 2 |
int | EXPRLOC = 3 |
int | EXPRASSIGN = 4 |
int | EXPRCOND = 5 |
int | EXPRMEM = 6 |
int | EXPROP = 7 |
int | EXPRSLICE = 8 |
int | EXPRCOMPOSE = 9 |
list | priorities_list |
priorities | |
int | PRIORITY_MAX = len(priorities_list) - 1 |
contains_visitor = ExprVisitorContains() | |
canonize_visitor = ExprVisitorCanonize() | |
dictionary | EXPR_ORDER_DICT |
dictionary | size_to_IEEE754_info |
def miasm.expression.expression.canonize_expr_list | ( | expr_list | ) |
def miasm.expression.expression.canonize_expr_list_compose | ( | expr_list | ) |
def miasm.expression.expression.canonize_to_exprloc | ( | locdb, | |
expr | |||
) |
If expr is ExprInt, return ExprLoc with corresponding loc_key Else, return expr @expr: Expr instance
def miasm.expression.expression.compare_expr_list | ( | l1_e, | |
l2_e | |||
) |
def miasm.expression.expression.compare_expr_list_compose | ( | l1_e, | |
l2_e | |||
) |
def miasm.expression.expression.compare_exprs | ( | expr1, | |
expr2 | |||
) |
Compare 2 expressions for canonization @expr1: Expr @expr2: Expr 0 => == 1 => expr1 > expr2 -1 => expr1 < expr2
def miasm.expression.expression.compare_exprs_compose | ( | expr1, | |
expr2 | |||
) |
def miasm.expression.expression.expr_is_equal | ( | op1, | |
op2 | |||
) |
if op1 == op2: Return ExprInt(1, 1) else: Return ExprInt(0, 1)
def miasm.expression.expression.expr_is_float_equal | ( | op1, | |
op2 | |||
) |
Return 1 on 1 bit if @op1 == @op2, 0 otherwise. /!\ Assume @op1 and @op2 are not NaN Comparison is the floating point one, defined in IEEE754
def miasm.expression.expression.expr_is_float_lower | ( | op1, | |
op2 | |||
) |
Return 1 on 1 bit if @op1 < @op2, 0 otherwise. /!\ Assume @op1 and @op2 are not NaN Comparison is the floating point one, defined in IEEE754
def miasm.expression.expression.expr_is_IEEE754_denormal | ( | expr | ) |
Return 1 or 0 on 1 bit if expr represent a denormalized value according to IEEE754
def miasm.expression.expression.expr_is_IEEE754_zero | ( | expr | ) |
Return 1 or 0 on 1 bit if expr represent a zero value according to IEEE754
def miasm.expression.expression.expr_is_infinite | ( | expr | ) |
Return 1 or 0 on 1 bit if expr represent an infinite value according to IEEE754
def miasm.expression.expression.expr_is_NaN | ( | expr | ) |
Return 1 or 0 on 1 bit if expr represent a NaN value according to IEEE754
def miasm.expression.expression.expr_is_not_equal | ( | op1, | |
op2 | |||
) |
if op1 != op2: Return ExprInt(1, 1) else: Return ExprInt(0, 1)
def miasm.expression.expression.expr_is_qNaN | ( | expr | ) |
Return 1 or 0 on 1 bit if expr represent a qNaN (quiet) value according to IEEE754
def miasm.expression.expression.expr_is_signed_greater | ( | op1, | |
op2 | |||
) |
Signed cmp if op1 > op2: Return ExprInt(1, 1) else: Return ExprInt(0, 1)
def miasm.expression.expression.expr_is_signed_greater_or_equal | ( | op1, | |
op2 | |||
) |
Signed cmp if op1 > op2: Return ExprInt(1, 1) else: Return ExprInt(0, 1)
def miasm.expression.expression.expr_is_signed_lower | ( | op1, | |
op2 | |||
) |
Signed cmp if op1 < op2: Return ExprInt(1, 1) else: Return ExprInt(0, 1)
def miasm.expression.expression.expr_is_signed_lower_or_equal | ( | op1, | |
op2 | |||
) |
Signed cmp if op1 <= op2: Return ExprInt(1, 1) else: Return ExprInt(0, 1)
def miasm.expression.expression.expr_is_sNaN | ( | expr | ) |
Return 1 or 0 on 1 bit if expr represent a sNaN (signalling) value according to IEEE754
def miasm.expression.expression.expr_is_unsigned_greater | ( | op1, | |
op2 | |||
) |
UNSIGNED cmp if op1 > op2: Return ExprInt(1, 1) else: Return ExprInt(0, 1)
def miasm.expression.expression.expr_is_unsigned_greater_or_equal | ( | op1, | |
op2 | |||
) |
Unsigned cmp if op1 >= op2: Return ExprInt(1, 1) else: Return ExprInt(0, 1)
def miasm.expression.expression.expr_is_unsigned_lower | ( | op1, | |
op2 | |||
) |
Unsigned cmp if op1 < op2: Return ExprInt(1, 1) else: Return ExprInt(0, 1)
def miasm.expression.expression.expr_is_unsigned_lower_or_equal | ( | op1, | |
op2 | |||
) |
Unsigned cmp if op1 <= op2: Return ExprInt(1, 1) else: Return ExprInt(0, 1)
def miasm.expression.expression.ExprInt1 | ( | i | ) |
def miasm.expression.expression.ExprInt16 | ( | i | ) |
def miasm.expression.expression.ExprInt32 | ( | i | ) |
def miasm.expression.expression.ExprInt64 | ( | i | ) |
def miasm.expression.expression.ExprInt8 | ( | i | ) |
def miasm.expression.expression.ExprInt_from | ( | expr, | |
i | |||
) |
def miasm.expression.expression.get_expr_ids | ( | expr | ) |
Retrieve ExprId in @expr @expr: Expr
def miasm.expression.expression.get_expr_ids_visit | ( | expr, | |
ids | |||
) |
Visitor to retrieve ExprId in @expr @expr: Expr
def miasm.expression.expression.get_expr_locs | ( | expr | ) |
Retrieve ExprLoc in @expr @expr: Expr
def miasm.expression.expression.get_expr_locs_visit | ( | expr, | |
locs | |||
) |
Visitor to retrieve ExprLoc in @expr @expr: Expr
def miasm.expression.expression.get_expr_mem | ( | expr | ) |
Retrieve memory accesses of an @expr @expr: Expr
def miasm.expression.expression.get_expr_ops | ( | expr | ) |
Retrieve operators of an @expr @expr: Expr
def miasm.expression.expression.get_list_rw | ( | exprs, | |
mem_read = False , |
|||
cst_read = True |
|||
) |
Return list of read/write reg/cst/mem for each @exprs @exprs: list of expressions @mem_read: walk though memory accesses @cst_read: retrieve constants
def miasm.expression.expression.get_rw | ( | exprs | ) |
def miasm.expression.expression.is_associative | ( | expr | ) |
def miasm.expression.expression.is_commutative | ( | expr | ) |
def miasm.expression.expression.is_expr | ( | expr | ) |
def miasm.expression.expression.is_function_call | ( | expr | ) |
Returns true if the considered Expr is a function call
def miasm.expression.expression.match_expr | ( | expr, | |
pattern, | |||
tks, | |||
result = None |
|||
) |
Try to match the @pattern expression with the pattern @expr with @tks jokers. Result is output dictionary with matching joker values. @expr : Expr pattern @pattern : Targeted Expr to match @tks : list of ExprId, available jokers @result : dictionary of ExprId -> Expr, output matching context
def miasm.expression.expression.MatchExpr | ( | expr, | |
pattern, | |||
tks, | |||
result = None |
|||
) |
def miasm.expression.expression.should_parenthesize_child | ( | child, | |
parent | |||
) |
def miasm.expression.expression.str_protected_child | ( | child, | |
parent | |||
) |
def miasm.expression.expression.test_set | ( | expr, | |
pattern, | |||
tks, | |||
result | |||
) |
Test if v can correspond to e. If so, update the context in result. Otherwise, return False @expr : Expr to match @pattern : pattern Expr @tks : list of ExprId, available jokers @result : dictionary of ExprId -> Expr, current context
miasm.expression.expression.canonize_visitor = ExprVisitorCanonize() |
miasm.expression.expression.contains_visitor = ExprVisitorContains() |
dictionary miasm.expression.expression.EXPR_ORDER_DICT |
int miasm.expression.expression.EXPRASSIGN = 4 |
int miasm.expression.expression.EXPRCOMPOSE = 9 |
int miasm.expression.expression.EXPRCOND = 5 |
int miasm.expression.expression.EXPRID = 2 |
int miasm.expression.expression.EXPRINT = 1 |
int miasm.expression.expression.EXPRLOC = 3 |
int miasm.expression.expression.EXPRMEM = 6 |
int miasm.expression.expression.EXPROP = 7 |
int miasm.expression.expression.EXPRSLICE = 8 |
miasm.expression.expression.priorities |
list miasm.expression.expression.priorities_list |
int miasm.expression.expression.PRIORITY_MAX = len(priorities_list) - 1 |
dictionary miasm.expression.expression.size_to_IEEE754_info |
string miasm.expression.expression.TOK_EQUAL = "==" |
string miasm.expression.expression.TOK_INF = "<" |
string miasm.expression.expression.TOK_INF_EQUAL = "<=" |
string miasm.expression.expression.TOK_INF_EQUAL_SIGNED = TOK_INF_EQUAL + "s" |
string miasm.expression.expression.TOK_INF_EQUAL_UNSIGNED = TOK_INF_EQUAL + "u" |
string miasm.expression.expression.TOK_INF_SIGNED = TOK_INF + "s" |
string miasm.expression.expression.TOK_INF_UNSIGNED = TOK_INF + "u" |
string miasm.expression.expression.TOK_POS = "pos" |
string miasm.expression.expression.TOK_POS_STRICT = "Spos" |