Skip to main content

PackerScope

PackerScope is a production-grade Python framework for automated Windows PE packer detection, classification, and unpacking. Designed for defensive security analysts, reverse engineers, and malware analysis laboratories.


Features

  • Multi-layered Detection Pipeline:

    • Entropy Analysis: Measures Shannon entropy across whole files, sections, and via sliding-window heuristics.
    • Section Analysis: Detects anomalous section names (e.g., UPX0, .vmp0), extreme virtual-to-raw size ratios, and abnormal permissions (RWX).
    • IAT Analysis: Analyzes Import Address Table sparseness and suspicious loader API usage.
    • Entry Point Analysis: Disassembles entry point instructions using Capstone to detect stubs, jump chains, and trampolines.
    • Structure Analysis: Identifies structural PE header anomalies, misaligned headers, and invalid metadata.
    • Signature Matching: Built-in byte-pattern scanning using PEiD database signatures.
    • YARA Scanning: Deep static analysis utilizing community or custom YARA rules.
    • Heuristic Aggregator: Combines weighted multi-module signals into an ensemble packing verdict.
  • Automated Unpacking:

    • UPXUnpacker: Native decompression using the UPX binary.
    • GenericStaticUnpacker: Framework for static decompression routines.
    • DynamicUnpacker: Dynamic emulation and instrumentation unpacker integration.
  • Verification Subsystem: Automatically verifies unpacked binaries by validating PE integrity, entropy reduction, and IAT restoration.

  • Multi-Format Reporting: Generates structured reports in JSON, CSV, Markdown, and HTML formats.


Installation

From PyPI

pip install packerscope

From Source

git clone https://github.com/salmanmallah/packerscope.git
cd packerscope
pip install .

Optional Dependencies

For additional disassembly, YARA, or dynamic analysis capabilities:

pip install "packerscope[all]"

Quickstart (Python API)

PackerScope provides a simple, high-level Python API designed for rapid analysis and easy scripting.

Basic Analysis

import packerscope

# Analyze a single binary
result = packerscope.scan("path/to/sample.exe")

if result.is_packed:
    print(f"File is packed with {result.packer.upper()}")
    print(f"Confidence: {result.confidence:.2%}")
    print("Detection Reasons:")
    for reason in result.reasons:
        print(f"  - {reason}")
else:
    print("File is not packed.")

Dictionary Summary

import packerscope

result = packerscope.scan("path/to/sample.exe")
summary = result.summary()

print(summary)
# {
#     "file_name": "sample.exe",
#     "file_path": "C:\\samples\\sample.exe",
#     "is_packed": True,
#     "packer": "upx",
#     "confidence": 0.85,
#     "confidence_level": "high",
#     "reasons": [...],
#     "analysis_duration_seconds": 0.02
# }

Automatic Unpacking

import packerscope

# Analyze and unpack if a supported packer is found
result = packerscope.scan("path/to/sample.exe", unpack=True)

if result.unpack_result and result.unpack_result.success:
    print(f"Unpacked file saved to: {result.unpack_result.unpacked_path}")

Batch Scanning a Directory

import packerscope

# Scan all PE files in a directory concurrently
results = packerscope.batch_scan("samples_folder/", workers=8)

for res in results:
    status = "PACKED" if res.is_packed else "NOT PACKED"
    print(f"{res.file_name:<30} | {status:<10} | {res.packer:<10} | {res.confidence:.2%}")

Command Line Interface (CLI)

PackerScope can also be executed directly from your terminal:

Analyze a Single File

packerscope scan samples/sample.exe --format json,html --output results/

Batch Analyze a Directory

packerscope batch samples/ --workers 8 --format csv

Quick PE Information

packerscope info samples/sample.exe

Architecture

  1. Orchestrator: Coordinates pipeline lifecycle: Initialization -> Detection -> Verdict -> Unpack -> Verify -> Report.
  2. PEContext: Central blackboard state object. Parsed PE artifacts and detector results are shared here.
  3. Plugin Manager: Dynamically discovers and loads detectors, unpackers, reporters, and verifiers.
  4. Detectors: Independent modules implementing BaseDetector, executed in priority order.
  5. Unpackers: Modules implementing BaseUnpacker, invoked based on verdict classification.

Project Structure

packer_identifier_framework/
├── packerscope/
│   ├── __init__.py            # Top-level public API (scan, detect, batch_scan)
│   ├── cli.py                 # Command-line interface
│   ├── config.py              # Central configuration (Pydantic Settings)
│   ├── constants.py           # Thresholds and heuristics constants
│   ├── context.py             # PEContext (Blackboard state)
│   ├── exceptions.py          # Custom exceptions
│   ├── orchestrator.py        # Pipeline execution logic
│   ├── plugin_manager.py      # Dynamic plugin discovery
│   ├── core/                  # Interfaces, Enums, and Pydantic Models
│   ├── detectors/             # Detection modules (Entropy, IAT, YARA, etc.)
│   ├── reporters/             # Report generators (JSON, CSV, HTML, MD)
│   ├── signatures/            # PEiD signature database & parser
│   ├── unpackers/             # Unpacker implementations
│   ├── utils/                 # Binary analysis helpers & structured logging
│   └── verification/          # Post-unpack verification logic
├── tests/                     # Unit and Integration tests
├── pyproject.toml             # Packaging metadata and dependency definitions
└── requirements.txt           # Flat dependency list

Running Tests

Execute the automated test suite using pytest:

python -m pytest

Author & Maintainer


Citation

If you use PackerScope in academic research, security tooling, or malware analysis publications, please cite:

@software{packerscope2026,
  author = {Salman Mallah},
  title = {PackerScope: Automated Windows PE Packer Detection and Unpacking Framework},
  year = {2026},
  url = {https://github.com/salmanmallah/packerscope}
}

License

This project is licensed under the MIT License. See LICENSE for details.


Disclaimer

Educational and Defensive Research Purposes Only. This framework is intended strictly for defensive security research, malware analysis, and educational use within authorized environments.

Download files

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

Source Distribution

packerscope-0.2.2.tar.gz (81.0 kB view details)

Uploaded Source

Built Distribution

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

packerscope-0.2.2-py3-none-any.whl (100.4 kB view details)

Uploaded Python 3

File details

Details for the file packerscope-0.2.2.tar.gz.

File metadata

  • Download URL: packerscope-0.2.2.tar.gz
  • Upload date:
  • Size: 81.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for packerscope-0.2.2.tar.gz
Algorithm Hash digest
SHA256 84b0de79bafe4a82fc1b7341d4ae14018c711b77b154c523224b30608642c6da
MD5 54ce27eb245aadb0ede11ec799bd90aa
BLAKE2b-256 b82b42f2bc04cef1ccbd2b33396a59efa8adce0a07d8ea2029685afbbadfb336

See more details on using hashes here.

Provenance

The following attestation bundles were made for packerscope-0.2.2.tar.gz:

Publisher: publish.yml on salmanmallah/packerscope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file packerscope-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: packerscope-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 100.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for packerscope-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e05ec7b5dfc786b6cdf0429225caef04b8c85860d9e2a3d1a3d9b3d121793d20
MD5 ac1348792713c750edb54250dd9363ca
BLAKE2b-256 25acae665d9586fd40fa9e22a4b8e370ab6693116c1f6f28589e0f059a3b23a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for packerscope-0.2.2-py3-none-any.whl:

Publisher: publish.yml on salmanmallah/packerscope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.3.0

2 files

This release

0.2.2 This release

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page