Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.