python文件读写_Python读写PE文件模块pefile

代码:

print hex(pe.OPTIONAL_HEADER.AddressOfEntryPoint)

实验二

代码:

import os, string, shutil,re

import pefile ##记得import pefile

PEfile_Path = r"C:\temp\test.exe"

pe = pefile.PE(PEfile_Path)

print PEfile_Path

for section in pe.sections:

print section

代码:

实验二结果

C:\temp\test.exe

[IMAGE_SECTION_HEADER]

Name: .text

Misc: 0x418

Misc_PhysicalAddress: 0x418

Misc_VirtualSize: 0x418

VirtualAddress: 0x220

SizeOfRawData: 0x420

PointerToRawData: 0x420

PointerToRelocations: 0x0

PointerToLinenumbers: 0x0

NumberOfRelocations: 0x0

NumberOfLinenumbers: 0x0

Characteristics: 0x60000020

[IMAGE_SECTION_HEADER]

Name: .rsrc

Misc: 0x128

Misc_PhysicalAddress: 0x128

Misc_VirtualSize: 0x128

VirtualAddress: 0x640

SizeOfRawData: 0x130

PointerToRawData: 0x840

PointerToRelocations: 0x0

PointerToLinenumbers: 0x0

NumberOfRelocations: 0x0

NumberOfLinenumbers: 0x0

Characteristics: 0x40000040

可以看出此文件有2个节.text 和 .rsrc,并且给出了节的相关信息。当然如果你需要获得某一节的具体的某个信息如Characteristics,可以采用

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值