0

假设我有一个尝试破解标志的程序,例如 python 中使用 angr 的程序:

#!/usr/bin/env python

import angr
import claripy

FLAG_LEN = 15
STDIN_FD = 0
find_addr = 0x001016af
avoid_addr = 0x00100fab
base_addr = 0x00100000

proj = angr.Project("./runnable", main_opts={'base_addr': base_addr}) 
flag_chars = [claripy.BVS('flag_%d' % i, 8) for i in range(FLAG_LEN)]
flag = claripy.Concat( *flag_chars + [claripy.BVV(b'\n')]) 

state = proj.factory.full_init_state(
       args=['./runnable'],
       add_options=angr.options.unicorn,
       stdin=flag,
)


simgr = proj.factory.simulation_manager(state)
simgr.explore(find=find_addr, avoid=avoid_addr)


if (len(simgr.found) > 0):
   for found in simgr.found:
       print(found.posix.dumps(STDIN_FD))

我的代码目前没有返回任何内容,但我知道该字符串的长度为 16,并且我知道秘密字符串的前 6 个字符是什么。我怎样才能将这个秘密字符串的搜索限制为以我知道的 6 个字符开头的内容?

4

0 回答 0