MCPcopy Create free account
hub / github.com/ELMERIKH/PyinMemoryPE / PE

Class PE

pythonmemorymodule/pefile.py:2295–7412  ·  view source on GitHub ↗

A Portable Executable representation. This class provides access to most of the information in a PE file. It expects to be supplied the name of the file to load or PE data to process and an optional argument 'fast_load' (False by default) which controls whether to load all the dire

Source from the content-addressed store, hash-verified

2293
2294
2295class PE:
2296 """A Portable Executable representation.
2297
2298 This class provides access to most of the information in a PE file.
2299
2300 It expects to be supplied the name of the file to load or PE data
2301 to process and an optional argument 'fast_load' (False by default)
2302 which controls whether to load all the directories information,
2303 which can be quite time consuming.
2304
2305 pe = pefile.PE('module.dll')
2306 pe = pefile.PE(name='module.dll')
2307
2308 would load 'module.dll' and process it. If the data is already
2309 available in a buffer the same can be achieved with:
2310
2311 pe = pefile.PE(data=module_dll_data)
2312
2313 The "fast_load" can be set to a default by setting its value in the
2314 module itself by means, for instance, of a "pefile.fast_load = True".
2315 That will make all the subsequent instances not to load the
2316 whole PE structure. The "full_load" method can be used to parse
2317 the missing data at a later stage.
2318
2319 Basic headers information will be available in the attributes:
2320
2321 DOS_HEADER
2322 NT_HEADERS
2323 FILE_HEADER
2324 OPTIONAL_HEADER
2325
2326 All of them will contain among their attributes the members of the
2327 corresponding structures as defined in WINNT.H
2328
2329 The raw data corresponding to the header (from the beginning of the
2330 file up to the start of the first section) will be available in the
2331 instance's attribute 'header' as a string.
2332
2333 The sections will be available as a list in the 'sections' attribute.
2334 Each entry will contain as attributes all the structure's members.
2335
2336 Directory entries will be available as attributes (if they exist):
2337 (no other entries are processed at this point)
2338
2339 DIRECTORY_ENTRY_IMPORT (list of ImportDescData instances)
2340 DIRECTORY_ENTRY_EXPORT (ExportDirData instance)
2341 DIRECTORY_ENTRY_RESOURCE (ResourceDirData instance)
2342 DIRECTORY_ENTRY_DEBUG (list of DebugData instances)
2343 DIRECTORY_ENTRY_BASERELOC (list of BaseRelocationData instances)
2344 DIRECTORY_ENTRY_TLS
2345 DIRECTORY_ENTRY_BOUND_IMPORT (list of BoundImportData instances)
2346
2347 The following dictionary attributes provide ways of mapping different
2348 constants. They will accept the numeric value and return the string
2349 representation and the opposite, feed in the string and get the
2350 numeric constant:
2351
2352 DIRECTORY_ENTRY

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected