miasm
Reverse engineering framework
constant_propagation Namespace Reference

Variables

 parser = ArgumentParser("Constant expression propagation")
 
 help
 
 action
 
 args = parser.parse_args()
 
 machine = Machine("x86_32")
 
 loc_db = LocationDB()
 
 cont = Container.from_stream(open(args.filename, 'rb'), loc_db)
 
 mdis = machine.dis_engine(cont.bin_stream, loc_db=loc_db)
 
 ir_arch = machine.ira(mdis.loc_db)
 
 addr = int(args.address, 0)
 
 deadrm = DeadRemoval(ir_arch)
 
 asmcfg = mdis.dis_multiblock(addr)
 
 ircfg = ir_arch.new_ircfg_from_asmcfg(asmcfg)
 
 entry_points = set([mdis.loc_db.get_offset_location(addr)])
 
 init_infos = ir_arch.arch.regs.regs_init
 
 cst_propag_link = propagate_cst_expr(ir_arch, ircfg, addr, init_infos)
 
bool modified = True
 

Detailed Description

Example of "constant expression" propagation.
A "constant expression" is an expression based on constants or init regs.

Variable Documentation

◆ action

constant_propagation.action

◆ addr

constant_propagation.addr = int(args.address, 0)

◆ args

constant_propagation.args = parser.parse_args()

◆ asmcfg

constant_propagation.asmcfg = mdis.dis_multiblock(addr)

◆ cont

constant_propagation.cont = Container.from_stream(open(args.filename, 'rb'), loc_db)

◆ cst_propag_link

constant_propagation.cst_propag_link = propagate_cst_expr(ir_arch, ircfg, addr, init_infos)

◆ deadrm

constant_propagation.deadrm = DeadRemoval(ir_arch)

◆ entry_points

constant_propagation.entry_points = set([mdis.loc_db.get_offset_location(addr)])

◆ help

constant_propagation.help

◆ init_infos

constant_propagation.init_infos = ir_arch.arch.regs.regs_init

◆ ir_arch

constant_propagation.ir_arch = machine.ira(mdis.loc_db)

◆ ircfg

constant_propagation.ircfg = ir_arch.new_ircfg_from_asmcfg(asmcfg)

◆ loc_db

constant_propagation.loc_db = LocationDB()

◆ machine

constant_propagation.machine = Machine("x86_32")

◆ mdis

constant_propagation.mdis = machine.dis_engine(cont.bin_stream, loc_db=loc_db)

◆ modified

bool constant_propagation.modified = True

◆ parser

constant_propagation.parser = ArgumentParser("Constant expression propagation")