rex工具报错:AttributeError: ‘str‘ object has no attribute ‘inject_path‘

问题

在用docker安装rex工具的时候,按照rex文档给的样例输入:

crash = rex.Crash("./legit_00003", b"\x00\x0b1\xc1\x00\x0c\xeb\xe4\xf1\xf1\x14\r\rM\r\xf3\x1b\r\r\r~\x7f\x1b\xe3\x0c`_222\r\rM\r\xf3\x1b\r\x7f\x002\x7f~\x7f\xe2\xff\x7f\xff\xff\x8b\xc7\xc9\x83\x8b\x0c\xeb\x80\x002\xac\xe2\xff\xff\x00t\x8bt\x8bt_o_\x00t\x8b\xc7\xdd\x83\xc2t~n~~\xac\xe2\xff\xff_k_\x00t\x8b\xc7\xdd\x83\xc2t~n~~\xac\xe2\xff\xff\x00t\x8bt\x8b\xac\xf1\x83\xc2t~c\x00\x00\x00~~\x7f\xe2\xff\xff\x00t\x9e\xac\xe2\xf1\xf2@\x83\xc3t")

然后报错字符串对象没有"inject_path"的属性。

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/angr/.virtualenvs/angr/lib/python3.6/site-packages/rex-0.2-py3.6.egg/rex/crash.py", line 78, in __init__
  File "/home/angr/angr-dev/archr/archr/arsenal/qemu_tracer.py", line 43, in __init__
    super().__init__(target, **kwargs)
  File "/home/angr/angr-dev/archr/archr/arsenal/__init__.py", line 20, in __init__
    self.nock()
  File "/home/angr/angr-dev/archr/archr/arsenal/__init__.py", line 28, in nock
    self.target.inject_path(b, os.path.join(self.target.tmpwd, self.REQUIRED_ARROW))
AttributeError: 'str' object has no attribute 'inject_path'

解决方案

在rex的仓库里找到了test_rex.py的脚本,里头有各种测试脚本。然后知道crash的第一个参数要是target对象,而不是一个字符串。
改成以下就可以了。

>>> t = archr.targets.LocalTarget(["./legit_00003"], target_os='cgc')
>>> crash = rex.Crash(t, b"\x00\x0b1\xc1\x00\x0c\xeb\xe4\xf1\xf1\x14\r\rM\r\xf3\x1b\r\r\r~\x7f\x1b\xe3\x0c`_222\r\rM\r\xf3\x1b\r\x7f\x002\x7f~\x7f\xe2\xff\x7f\xff\xff\x8b\xc7\xc9\x83\x8b\x0c\xeb\x80\x002\xac\xe2\xff\xff\x00t\x8bt\x8bt_o_\x00t\x8b\xc7\xdd\x83\xc2t~n~~\xac\xe2\xff\xff_k_\x00t\x8b\xc7\xdd\x83\xc2t~n~~\xac\xe2\xff\xff\x00t\x8bt\x8b\xac\xf1\x83\xc2t~c\x00\x00\x00~~\x7f\xe2\xff\xff\x00t\x9e\xac\xe2\xf1\xf2@\x83\xc3t")
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

破落之实

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值