很抱歉我问了这个可能不太靠谱的问题。我是Angr的新手,遇到了一个小问题。假设我有一个二进制程序,"mybinary",在其中我输入了一些东西,它做了一些操作,并对其进行了检查,以找到一个标志。(正常的crackme样式。)
但是,当程序第一次运行时,程序需要一个字符串tid输入。我有tid,它只是一个由字母和数字组成的32位字符串。
因此,要运行它,我必须执行"./mybinary 'the tid string'“,而不是"./mybinary”。
如何在将文件加载到Angr项目的上下文中做到这一点?
比如,如果我的angr代码是这样的:
import angr
import claripy
#Whatever variables.
base_addr = #Whatever the base address is.
proj = angr.Project("./mybinary", main_opts={'base_addr': base_addr})
#Some code for defining flag characters.
state = proj.factory.full_init_state(
args=['./mybinary'],
add_options=angr.options.unicorn,
stdin=flag,
)
#Some code to create and run simulation with success and failure.我如何编辑它,让它运行"./mybinary 'the tid string'“而不只是"./mybinary"?
请并感谢您的帮助!
发布于 2020-10-21 06:30:44
下面是您应该如何实例化状态以满足您的需求:
state = proj.factory.entry_state(
args=['./mybinary', 'the tid string'],
add_options=angr.options.unicorn,
stdin=flag,
)如果在可以接受命令行参数的环境中执行,或者在环境中执行,那么可以通过args将参数列表和环境变量字典通过env传递到
entry_state和full_init_state中。
此外,在您的案例中似乎不需要full_init_state;entry_state应该足够(same documentation):
.entry_state()构造一个可以在主二进制文件的入口点执行的状态。
https://stackoverflow.com/questions/64405293
复制相似问题