Skip to main content

Quick PE file format dissection utility

Project description

Percer

GitHub License Python Version GitHub Last Commit GitHub Issues GitHub Stars

Percer is a Portable Executable (PE) file format dissection utility and library which I use to quickly get information about Windows executables. Percer functions as both a command-line interface (CLI) utility and a library, allowing researchers to extract key information from PE files (metadata, sections, imports/exports, certificates). It comes with a VirusTotal search functionality which enables the user to run custom queries and download files.

🌟 Features

  • Dual Mode: Operate as a standalone tool or integrate as a library.

  • PE Analysis: Parse Imports, Exports, Sections, and Certificate information (wraps around Python pefile).

  • VirusTotal Integration: Query file hashes and download samples to files / byte streams.

  • Flexible Inputs: Analyze local files by path or remote samples by hash.

🛠 Installation

Install Percer with pip.

py -m pip install percer

📖 Configuration

Percer VirusTotal searching functionality requires a valid API key which has to be set as environment variable.

  • Windows (cmd)
set VT_API_KEY=API_key_goes_here
  • Linux
export VT_API_KEY='API key goes here'

🚀 CLI Usage

Percer provides a simple command-line interface.

Help Menu

C:\>percer --help
usage: percer <PE file> [-h] (-F FILE | -H HASH) [-a] [-e] [-i] [-s] [-c] [-q]

options:
  -h, --help            show this help message and exit
  -F FILE, --file FILE  Target file
  -H HASH, --hash HASH  Target hash (VirusTotal Search requires VT_API_KEY)
  -a, --all             Show all info
  -e, --exports         List exports
  -i, --imports         List imports
  -s, --sections        List sections
  -c, --certificates    Get certificates information
  -q, --quiet           Do not print the banner

Examples

Analyze a local file

percer -F samples.exe

Query hash on VirusTotal

percer -H <sha256/sha1/md5/Authentihash>

CLI output preview

📦 Library Usage

Percer can be imported into Python projects.

from percer.analyzer import PEAnalyzer
from percer.virustotal import VirusTotal

with open('hashes.txt', 'r') as f:
  hashes = [line.strip() for line in f]

with VirusTotal() as scanner:
  for input_hash in hashes:
    try:
      content = scanner.get_content(scanner.resolve_hash(input_hash))
      pex_object = PEAnalyzer.from_bytes(content)
      print(f"Product Name of {input_hash} is {pex_object.product_name}")
    except Exception as E:
      print(E)
      pass

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

percer-0.2.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

percer-0.2.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file percer-0.2.0.tar.gz.

File metadata

  • Download URL: percer-0.2.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for percer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bc5b07e2d011903663057fae22af8ddcb4d471be3fbde3c322c4f7441ff06da9
MD5 b4e811e231351b4072b9d9c3999dc016
BLAKE2b-256 a4aeda118cf13eec601a13367e99dbc03db0250449f17bc1a20b715c800ba9cb

See more details on using hashes here.

File details

Details for the file percer-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: percer-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for percer-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7351d7e27b2e88d1f58f9dad250aa6be78f8ae3a3ff7a71e88e3762103b5c42a
MD5 a945df101b826b887d9dc3752cd6e2d3
BLAKE2b-256 95089b3c61692e4e33595198905a0ea274528f3f24f641595402d9849dfd41ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page