gpt4 book ai didi

text - 仅从 PE 文件中提取 .text 部分

转载 作者:行者123 更新时间:2023-12-05 01:02:31 25 4
gpt4 key购买 nike

我正在尝试从 PE 文件(dll)中提取 .text 部分,即代码。 Linux 中是否有任何简单的工具或一些 python 或 ruby​​ 库可以让我轻松地做到这一点?

最佳答案

自己解决了。我使用 pefile python 模块提取文本部分,并使用 PointerToRawData 和 VirtualSize 推断文本部分的位置。然后我使用 dd 将 .text 部分提取到单独的文件中。

import pefile
pe = pefile.PE('filepath')
for section in pe.sections:
if section.Name == '.text'
print "%s %s" % (section.PointerToRawData),hex(section.Misc_VirtualSize))

然后dd:
dd if=<lib> of=<lib.text> bs=1 skip=$PointerToRawData count=$VirtualSize

关于text - 仅从 PE 文件中提取 .text 部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26139889/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com