![]() |
miasm
Reverse engineering framework
|
Classes | |
| class | bitobj |
| class | bs |
| class | bs8 |
| class | bs_cond |
| class | bs_divert |
| class | bs_mod_name |
| class | bs_name |
| class | bs_swapargs |
| class | bsi |
| class | bsopt |
| class | cls_mn |
| class | dum_arg |
| class | imm08_noarg |
| class | imm16_noarg |
| class | imm32_noarg |
| class | imm64_noarg |
| class | imm_noarg |
| class | instruction |
| class | int32_noarg |
| class | m_arg |
| class | m_reg |
| class | metamn |
| class | mn_prefix |
| class | reg_info |
| class | reg_info_dct |
| class | reg_noarg |
Functions | |
| def | literal_list (l) |
| def | gen_reg (reg_name, sz=32) |
| def | gen_reg_bs (reg_name, reg_info, base_cls) |
| def | gen_regs (rnames, env, sz=32) |
| def | int2expr (tokens) |
| def | parse_op (tokens) |
| def | parse_id (tokens) |
| def | ast_parse_op (tokens) |
| def | ast_id2expr (a) |
| def | ast_int2expr (a) |
| def | neg_int (tokens) |
| def | cb_int (tokens) |
| def | cb_parse_id (tokens) |
| def | cb_op_not (tokens) |
| def | merge_ops (tokens, op) |
| def | cb_op_and (tokens) |
| def | cb_op_xor (tokens) |
| def | cb_op_sign (tokens) |
| def | cb_op_div (tokens) |
| def | cb_op_plusminus (tokens) |
| def | cb_op_mul (tokens) |
| def | isbin (s) |
| def | int2bin (i, l) |
| def | myror32 (v, r) |
| def | myrol32 (v, r) |
| def | swap16 (v) |
| def | swap32 (v) |
| def | perm_inv (p) |
| def | gen_bsint (value, l, args) |
| def | branch2nodes (branch, nodes=None) |
| def | factor_one_bit (tree) |
| def | factor_fields (tree) |
| def | factor_fields_all (tree) |
| def | graph_tree (tree) |
| def | add_candidate_to_tree (tree, c) |
| def | add_candidate (bases, c) |
| def | getfieldby_name (fields, fname) |
| def | getfieldindexby_name (fields, fname) |
| def | swap_uint (size, i) |
| def | swap_sint (size, i) |
| def | sign_ext (v, s_in, s_out) |
Variables | |
| log = logging.getLogger("cpuhelper") | |
| console_handler = logging.StreamHandler() | |
| LPARENTHESIS = pyparsing.Literal("(") | |
| RPARENTHESIS = pyparsing.Literal(")") | |
| integer = pyparsing.Word(pyparsing.nums).setParseAction(lambda tokens: int(tokens[0])) | |
| hex_word = pyparsing.Literal('0x') + pyparsing.Word(pyparsing.hexnums) | |
| hex_int = pyparsing.Combine(hex_word).setParseAction(lambda tokens: int(tokens[0], 16)) | |
| tuple | str_int_pos = (hex_int | integer) |
| tuple | str_int_neg |
| tuple | str_int = str_int_pos | str_int_neg |
| logicop = pyparsing.oneOf('& | ^ >> << <<< >>>') | |
| signop = pyparsing.oneOf('+ -') | |
| multop = pyparsing.oneOf('* / %') | |
| plusop = pyparsing.oneOf('+ -') | |
| notop = pyparsing.oneOf('!') | |
| andop = pyparsing.oneOf('&') | |
| orop = pyparsing.oneOf('|') | |
| xorop = pyparsing.oneOf('^') | |
| shiftop = pyparsing.oneOf('>> <<') | |
| rotop = pyparsing.oneOf('<<< >>>') | |
| mulop = pyparsing.oneOf('*') | |
| divop = pyparsing.oneOf('/') | |
| variable = pyparsing.Word(pyparsing.alphas + "_$.", pyparsing.alphanums + "_") | |
| tuple | operand = str_int | variable |
| base_expr | |
| int | default_prio = 0x1337 |
| int | total_scans = 0 |
| def miasm.core.cpu.add_candidate | ( | bases, | |
| c | |||
| ) |


| def miasm.core.cpu.add_candidate_to_tree | ( | tree, | |
| c | |||
| ) |


| def miasm.core.cpu.ast_id2expr | ( | a | ) |
| def miasm.core.cpu.ast_int2expr | ( | a | ) |
| def miasm.core.cpu.ast_parse_op | ( | tokens | ) |
| def miasm.core.cpu.branch2nodes | ( | branch, | |
nodes = None |
|||
| ) |

| def miasm.core.cpu.cb_int | ( | tokens | ) |
| def miasm.core.cpu.cb_op_and | ( | tokens | ) |

| def miasm.core.cpu.cb_op_div | ( | tokens | ) |
| def miasm.core.cpu.cb_op_mul | ( | tokens | ) |
| def miasm.core.cpu.cb_op_not | ( | tokens | ) |
| def miasm.core.cpu.cb_op_plusminus | ( | tokens | ) |
| def miasm.core.cpu.cb_op_sign | ( | tokens | ) |
| def miasm.core.cpu.cb_op_xor | ( | tokens | ) |

| def miasm.core.cpu.cb_parse_id | ( | tokens | ) |
| def miasm.core.cpu.factor_fields | ( | tree | ) |

| def miasm.core.cpu.factor_fields_all | ( | tree | ) |

| def miasm.core.cpu.factor_one_bit | ( | tree | ) |
| def miasm.core.cpu.gen_bsint | ( | value, | |
| l, | |||
| args | |||
| ) |


| def miasm.core.cpu.gen_reg | ( | reg_name, | |
sz = 32 |
|||
| ) |
Gen reg expr and parser
| def miasm.core.cpu.gen_reg_bs | ( | reg_name, | |
| reg_info, | |||
| base_cls | |||
| ) |
Generate:
class bs_reg_name(base_cls):
reg = reg_info
bs_reg_name = bs(l=0, cls=(bs_reg_name,))

| def miasm.core.cpu.gen_regs | ( | rnames, | |
| env, | |||
sz = 32 |
|||
| ) |
| def miasm.core.cpu.getfieldby_name | ( | fields, | |
| fname | |||
| ) |
| def miasm.core.cpu.getfieldindexby_name | ( | fields, | |
| fname | |||
| ) |

| def miasm.core.cpu.graph_tree | ( | tree | ) |

| def miasm.core.cpu.int2bin | ( | i, | |
| l | |||
| ) |

| def miasm.core.cpu.int2expr | ( | tokens | ) |
| def miasm.core.cpu.isbin | ( | s | ) |

| def miasm.core.cpu.literal_list | ( | l | ) |
| def miasm.core.cpu.merge_ops | ( | tokens, | |
| op | |||
| ) |

| def miasm.core.cpu.myrol32 | ( | v, | |
| r | |||
| ) |

| def miasm.core.cpu.myror32 | ( | v, | |
| r | |||
| ) |

| def miasm.core.cpu.neg_int | ( | tokens | ) |
| def miasm.core.cpu.parse_id | ( | tokens | ) |
| def miasm.core.cpu.parse_op | ( | tokens | ) |
| def miasm.core.cpu.perm_inv | ( | p | ) |

| def miasm.core.cpu.sign_ext | ( | v, | |
| s_in, | |||
| s_out | |||
| ) |

| def miasm.core.cpu.swap16 | ( | v | ) |
| def miasm.core.cpu.swap32 | ( | v | ) |
| def miasm.core.cpu.swap_sint | ( | size, | |
| i | |||
| ) |

| def miasm.core.cpu.swap_uint | ( | size, | |
| i | |||
| ) |

| miasm.core.cpu.andop = pyparsing.oneOf('&') |
| miasm.core.cpu.base_expr |
| miasm.core.cpu.console_handler = logging.StreamHandler() |
| int miasm.core.cpu.default_prio = 0x1337 |
| miasm.core.cpu.divop = pyparsing.oneOf('/') |
| miasm.core.cpu.hex_int = pyparsing.Combine(hex_word).setParseAction(lambda tokens: int(tokens[0], 16)) |
| miasm.core.cpu.hex_word = pyparsing.Literal('0x') + pyparsing.Word(pyparsing.hexnums) |
| miasm.core.cpu.integer = pyparsing.Word(pyparsing.nums).setParseAction(lambda tokens: int(tokens[0])) |
| miasm.core.cpu.log = logging.getLogger("cpuhelper") |
| miasm.core.cpu.logicop = pyparsing.oneOf('& | ^ >> << <<< >>>') |
| miasm.core.cpu.LPARENTHESIS = pyparsing.Literal("(") |
| miasm.core.cpu.mulop = pyparsing.oneOf('*') |
| miasm.core.cpu.multop = pyparsing.oneOf('* / %') |
| miasm.core.cpu.notop = pyparsing.oneOf('!') |
| miasm.core.cpu.orop = pyparsing.oneOf('|') |
| miasm.core.cpu.plusop = pyparsing.oneOf('+ -') |
| miasm.core.cpu.rotop = pyparsing.oneOf('<<< >>>') |
| miasm.core.cpu.RPARENTHESIS = pyparsing.Literal(")") |
| miasm.core.cpu.shiftop = pyparsing.oneOf('>> <<') |
| miasm.core.cpu.signop = pyparsing.oneOf('+ -') |
| tuple miasm.core.cpu.str_int = str_int_pos | str_int_neg |
| tuple miasm.core.cpu.str_int_neg |
| int miasm.core.cpu.total_scans = 0 |
| miasm.core.cpu.variable = pyparsing.Word(pyparsing.alphas + "_$.", pyparsing.alphanums + "_") |
| miasm.core.cpu.xorop = pyparsing.oneOf('^') |