Created
November 6, 2014 03:43
-
-
Save kjk/72ec35fb150c1f42ecbb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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