Skip to content

Instantly share code, notes, and snippets.

@kjk
Created November 6, 2014 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kjk/72ec35fb150c1f42ecbb to your computer and use it in GitHub Desktop.
Save kjk/72ec35fb150c1f42ecbb to your computer and use it in GitHub Desktop.
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