kjk
11/6/2014 - 3:43 AM

dump_pe.py

import os
import pefile

# needs https://code.google.com/p/pefile/ to be installed
# i.e. download it, extract and python setup.py install
d = os.path.join("win", "Debug")
files = os.listdir(d)

def is_pe(s):
	if s.endswith(".dll"):
		return True
	if s.endswith(".exe"):
		return True
	return False

for f in files:
	if not is_pe(f):
		continue
	print(f)
	path = os.path.join(d, f)
	pe =  pefile.PE(path)
	fh = pe.FILE_HEADER
	m = fh.Machine
	print("  machine: %s" % m)