Python解析PE文件

一. 下载安装pefile


https://code.google.com/p/pefile/downloads/list

解压后, pefile.pypeutils.py拷贝到你的工程中即可.(你也可以安装到Python就是双击Setup.py后把pefile.pyc拷贝到X:\PythonXX\Lib\site-packages)

https://code.google.com/p/pefile/



二. 简单解析PE文件


#!/usr/bin/env python
# Python 2.7.3
# 打印PE文件信息
import os, string, shutil, re
import pefile ##记得import pefile
PEfile_Path = r"C:\Python27\pythonw.exe"
pe = pefile.PE(PEfile_Path)
# 写入文件
f = open('PEInfo.txt', 'w')# 写入文件
print >> f, pe
f.close()

这里也有

http://www.pythonclub.org/modules/pefile

你可能感兴趣的:(python,解析,PE文件)