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

  • Interactive Terminal UI (TUI):

    • Launch packerscope with no arguments to enter a rich, menu-driven interactive shell with guided wizards, live scan results, settings tweaks, and session history tracking.
  • 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 with clean-binary whitelist protections.
    • Entry Point Analysis: Disassembles entry point instructions using Capstone to detect stubs, jump chains, NOP sleds, and trampolines.
    • Structure Analysis: Identifies structural PE header anomalies, misaligned headers, and invalid metadata with fast-path checksum bypass for large binaries.
    • 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 with contextual correlation into an ensemble packing verdict (low false-positive rate on clean binaries).
  • Automated Unpacking & Memory Safety:

    • UPXUnpacker: Native decompression using the UPX binary.
    • GenericStaticUnpacker: Safe streaming static decompression (bounded to 32 MB) to prevent memory exhaustion on large installers.
    • 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.

  • High Performance & Concurrency: Multi-threaded batch processing with worker thread safety clamping and in-memory buffer deduplication.


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 be executed in interactive mode or directly via subcommands:

Interactive Shell Mode (TUI)

Simply run packerscope without arguments to launch the interactive terminal wizard:

packerscope

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. Interactive Shell: Rich-based terminal UI providing menu navigation, wizards, live status, and settings.
  2. Orchestrator: Coordinates pipeline lifecycle: Initialization -> Detection -> Verdict -> Unpack -> Verify -> Report.
  3. PEContext: Central blackboard state object. Parsed PE artifacts and detector results are shared here.
  4. Plugin Manager: Dynamically discovers and loads detectors, unpackers, reporters, and verifiers.
  5. Detectors: Independent modules implementing BaseDetector, executed in priority order.
  6. 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 & subcommand dispatcher
│   ├── shell.py               # Interactive Shell & TUI wizard
│   ├── 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, concurrency & structured logging
│   └── verification/          # Post-unpack verification logic
├── tests/                     # Unit and Integration tests (116 passing 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.3.0.tar.gz (87.8 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.3.0-py3-none-any.whl (107.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for packerscope-0.3.0.tar.gz
Algorithm Hash digest
SHA256 2eb27f6b0b1d7f8da0682c29ac7447232fda9323b15767075cb959eff8c3a7e1
MD5 6ac700c1762ceb93d4a9468e966092e5
BLAKE2b-256 29ed860c1a0467e1ddc3bebd27bbc1ec9ece7bbb74fe3d52586cb36a7c1dd58d

See more details on using hashes here.

Provenance

The following attestation bundles were made for packerscope-0.3.0.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: packerscope-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 107.6 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c73d6fcc6f4d3e93400e99777f99a1b0876019436e64ea9b7e6ac1aad18c206
MD5 522b68233ab12c87febc34dc35371c4e
BLAKE2b-256 7f68f86c586ed6fe01813b4d99ee5a7035f1f1bc959bd98fcc35886fe347401c

See more details on using hashes here.

Provenance

The following attestation bundles were made for packerscope-0.3.0-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

This release

0.3.0 This release

2 files

0.2.2

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