Skip to content
프로젝트

소개

pefile은 PE(Portable Executable) 파일을 읽고 다루는 Python 모듈입니다.

개발 도구

이 수치를 측정하는 방법

What you can do

  • Inspecting headers
  • Analyzing of sections' data
  • Retrieving embedded data
  • Reading strings from the resources

측정된 스타 증가

in 24h
+1
in 7 days
+2
in 15 days
+5
in 1 month
+11

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

pefile

PyPI version pefile test Coverage OpenSSF Scorecard Contributors Code style: black Downloads Downloads

pefile is a multi-platform Python module to parse and work with Portable Executable (PE) files. Most of the information contained in the PE file headers is accessible, as well as all the sections' details and data.

The structures defined in the Windows header files will be accessible as attributes in the PE instance. The naming of fields/attributes will try to adhere to the naming scheme in those headers. Only shortcuts added for convenience will depart from that convention.

pefile requires some basic understanding of the layout of a PE file — with it, it is possible to explore nearly every single feature of the PE file format.

Installation

To install pefile through pip:

pip3 install pefile

source checkout

this repository contains a large compressed test corpus, and its git history retains older versions of that corpus. a full clone can therefore be much larger than the library itself. use the pip installation above if you only need the library.

to work on the source without downloading the test corpus or its history:

git clone --depth 1 --filter=blob:none --sparse https://github.com/erocarrera/pefile.git
cd pefile
git sparse-checkout set ordlookup

this checks out the library and its ordinal lookup tables. to include the tests, run git sparse-checkout set ordlookup tests; this also downloads the large test corpus. --depth 1 omits older history, and filtered clones fetch additional file contents when needed.

Features

Some of the tasks that pefile makes possible are:

Please, refer to Usage Examples for some code snippets that demonstrate how to use pefile.

Here are a few examples of what a dump produced with pefile looks like for different types of files:

To work with authenticated binaries, including Authenticode signatures, please check the project verify-sigs.

pefile runs in several pipelines scanning hundreds of thousands of new PE files every day, and, while not perfect, it has grown to be pretty robust over time. That being said, small glitches are found now and then. If you bump into a PE that does not appear to be processed correctly, do report it, please! It will help make pefile a tiny bit more powerful.

Dependencies

pefile is self-contained. The module has no dependencies; it is endianness independent; and it works on Windows, macOS, and Linux.

Running tests

The test runner lives in tests/pefile_test.py. Its PE samples and expected dumps come from the separate pefile-tests repository. Clone that repository into pefile-tests/ at the root of this checkout, then run:

python -m pip install -e ".[dev]"
python -m pytest tests

CI checks out the corpus in the same location and runs this test module through tox. The corpus remains in its own repository so binary samples and expected dumps can be updated independently.

Projects and products using pefile

Additional resources

PDFs of posters depicting the PE file format:

The following links provide detailed information about the PE format and its structures.

관련 프로젝트 살펴보기

불러오는 중…