Sept
Sept

Reputation: 21

Retrieve header information from exe

I was wondering whether it would be possible to write a python script that retrieves header information from an .exe file. I tried googling but didn't really find any results that were usable.

Thanks.

Sept

Upvotes: 2

Views: 4295

Answers (3)

marcosrodriguez
marcosrodriguez

Reputation: 35

Looks like I'm almost 2 years and a dollar short! If you still need to solve this, Michał Niklas was right on point above. pefile was written for this very purpose. Here is an example from my interactive session:

ipython
import pefile
pe = pefile.PE('file.exe')
pe.print_info()

The output is too verbose to put up here, but the above gives you all header information from a PE.

Download pefile here: pefile

Upvotes: 2

Michał Niklas
Michał Niklas

Reputation: 54302

There is pefile : multi-platform Python module to read and work with Portable Executable (aka PE) files. Most of the information in the PE Header is accessible, as well as all the sections, section's information and data.

Upvotes: 2

John Machin
John Machin

Reputation: 82934

Of course it is possible to write a Python script to retrieve header information from an XYZ file. Three simple steps:

(1) Find docs for the header part of an XYZ file; read them.

(2) Read the docs for the Python struct module or ctypes module or both.

(3) Write and test the script.

Which step are you having trouble with?

Upvotes: 0

Related Questions