3
我正試圖從PE文件(dll)中提取.text部分,即代碼。在Linux中是否有簡單的工具或者一些python或者ruby庫讓我可以輕鬆地做到這一點?僅從PE文件中提取.text部分
我正試圖從PE文件(dll)中提取.text部分,即代碼。在Linux中是否有簡單的工具或者一些python或者ruby庫讓我可以輕鬆地做到這一點?僅從PE文件中提取.text部分
自己解決了。我使用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