当前位置: 首页>>代码示例>>Python>>正文


Python Machine.continue_run方法代码示例

本文整理汇总了Python中miasm2.analysis.machine.Machine.continue_run方法的典型用法代码示例。如果您正苦于以下问题:Python Machine.continue_run方法的具体用法?Python Machine.continue_run怎么用?Python Machine.continue_run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在miasm2.analysis.machine.Machine的用法示例。


在下文中一共展示了Machine.continue_run方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: scode

# 需要导入模块: from miasm2.analysis.machine import Machine [as 别名]
# 或者: from miasm2.analysis.machine.Machine import continue_run [as 别名]
def scode(data, length, key, shellcode):
	def code_sentinelle(jitter):
		jitter.run = False
		jitter.pc = 0
		return True


	myjit = Machine("x86_32").jitter("tcc")
	myjit.init_stack()

	run_addr = 0x40000000
	myjit.vm.add_memory_page(run_addr, PAGE_READ | PAGE_WRITE, shellcode)

	#myjit.jit.log_regs = True
	#myjit.jit.log_mn = True
	#myjit.jit.log_newbloc = True

	myjit.add_breakpoint(0x1337beef, code_sentinelle)
	myjit.vm.add_memory_page(0x10000000, PAGE_READ | PAGE_WRITE, data)
	#myjit.add_breakpoint(0x40000000, code_sentinelle)
	myjit.push_uint32_t(key)
	myjit.push_uint32_t(len(data))
	myjit.push_uint32_t(0x10000000)
	myjit.push_uint32_t(0x1337beef)
	myjit.init_run(run_addr)
	myjit.continue_run()
	return myjit.cpu.get_mem(0x10000000,len(data))
开发者ID:sysopfb,项目名称:Unpackers,代码行数:29,代码来源:man1unpack.py

示例2: Asm_Test

# 需要导入模块: from miasm2.analysis.machine import Machine [as 别名]
# 或者: from miasm2.analysis.machine.Machine import continue_run [as 别名]
class Asm_Test(object):
    run_addr = 0x0

    def __init__(self, jitter_engine):
        self.myjit = Machine(self.arch_name).jitter(jitter_engine)
        self.myjit.init_stack()

        self.myjit.jit.log_regs = False
        self.myjit.jit.log_mn = False

    def test_init(self):
        pass

    def prepare(self):
        pass

    def __call__(self):
        self.prepare()
        self.asm()
        self.init_machine()
        self.test_init()
        self.run()
        self.check()

    def run(self):

        self.myjit.init_run(self.run_addr)
        self.myjit.continue_run()

        assert(self.myjit.pc == self.ret_addr)

    def asm(self):
        blocks, symbol_pool = parse_asm.parse_txt(mn_x86, self.arch_attrib, self.TXT,
                                                  symbol_pool = self.myjit.ir_arch.symbol_pool)
        # fix shellcode addr
        symbol_pool.set_offset(symbol_pool.getby_name("main"), 0x0)
        s = StrPatchwork()
        patches = asmblock.asm_resolve_final(mn_x86, blocks, symbol_pool)
        for offset, raw in patches.items():
            s[offset] = raw

        s = str(s)
        self.assembly = s

    def check(self):
        raise NotImplementedError('abstract method')
开发者ID:carolineLe,项目名称:miasm,代码行数:48,代码来源:asm_test.py

示例3: Asm_Test

# 需要导入模块: from miasm2.analysis.machine import Machine [as 别名]
# 或者: from miasm2.analysis.machine.Machine import continue_run [as 别名]
class Asm_Test(object):
    def __init__(self):
        self.myjit = Machine("x86_32").jitter()
        self.myjit.init_stack()

        self.myjit.jit.log_regs = False
        self.myjit.jit.log_mn = False


    def __call__(self):
        self.asm()
        self.run()
        self.check()


    def asm(self):
        blocs, symbol_pool = parse_asm.parse_txt(mn_x86, 32, self.TXT,
                                                 symbol_pool = self.myjit.ir_arch.symbol_pool)
        # fix shellcode addr
        symbol_pool.set_offset(symbol_pool.getby_name("main"), 0x0)
        s = StrPatchwork()
        patches = asmbloc.asm_resolve_final(mn_x86, blocs[0], symbol_pool)
        for offset, raw in patches.items():
            s[offset] = raw

        s = str(s)
        self.assembly = s

    def run(self):
        run_addr = 0
        self.myjit.vm.add_memory_page(run_addr, PAGE_READ | PAGE_WRITE, self.assembly)

        self.myjit.push_uint32_t(0x1337beef)

        self.myjit.add_breakpoint(0x1337beef, lambda x:False)

        self.myjit.init_run(run_addr)
        self.myjit.continue_run()

        assert(self.myjit.pc == 0x1337beef)

    def check(self):
        raise NotImplementedError('abstract method')
开发者ID:CaineQT,项目名称:miasm,代码行数:45,代码来源:asm_test.py

示例4: Asm_Test

# 需要导入模块: from miasm2.analysis.machine import Machine [as 别名]
# 或者: from miasm2.analysis.machine.Machine import continue_run [as 别名]
class Asm_Test(object):

    def __init__(self, jitter):
        self.myjit = Machine("mips32l").jitter(jitter)
        self.myjit.init_stack()

    def __call__(self):
        self.asm()
        self.run()
        self.check()

    def asm(self):
        blocks, loc_db = parse_asm.parse_txt(mn_mips32, 'l', self.TXT,
                                                  loc_db=self.myjit.ir_arch.loc_db)
        # fix shellcode addr
        loc_db.set_location_offset(loc_db.get_name_location("main"), 0x0)
        s = StrPatchwork()
        patches = asmblock.asm_resolve_final(mn_mips32, blocks, loc_db)
        for offset, raw in patches.items():
            s[offset] = raw

        s = str(s)
        self.assembly = s

    def run(self):
        run_addr = 0
        self.myjit.vm.add_memory_page(
            run_addr, PAGE_READ | PAGE_WRITE, self.assembly)

        self.myjit.cpu.RA = 0x1337beef

        self.myjit.add_breakpoint(0x1337beef, lambda x: False)

        self.myjit.init_run(run_addr)
        self.myjit.continue_run()

        assert(self.myjit.pc == 0x1337beef)

    def check(self):
        raise NotImplementedError('abstract method')
开发者ID:commial,项目名称:miasm,代码行数:42,代码来源:asm_test.py

示例5: execfile

# 需要导入模块: from miasm2.analysis.machine import Machine [as 别名]
# 或者: from miasm2.analysis.machine.Machine import continue_run [as 别名]
    execfile(filename)

parser = ArgumentParser(description="x86 32 basic Jitter")
parser.add_argument("filename", help="x86 32 shellcode filename")
parser.add_argument("-j", "--jitter",
                    help="Jitter engine. Possible values are : tcc (default), llvm",
                    default="tcc")
args = parser.parse_args()

def code_sentinelle(jitter):
    jitter.run = False
    jitter.pc = 0
    return True


myjit = Machine("x86_32").jitter(args.jitter)
myjit.init_stack()

data = open(args.filename).read()
run_addr = 0x40000000
myjit.vm.add_memory_page(run_addr, PAGE_READ | PAGE_WRITE, data)

myjit.jit.log_regs = True
myjit.jit.log_mn = True
myjit.push_uint32_t(0x1337beef)

myjit.add_breakpoint(0x1337beef, code_sentinelle)

myjit.init_run(run_addr)
myjit.continue_run()
开发者ID:Junraa,项目名称:miasm,代码行数:32,代码来源:x86_32.py


注:本文中的miasm2.analysis.machine.Machine.continue_run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。