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
packerscopewith no arguments to enter a rich, menu-driven interactive shell with guided wizards, live scan results, settings tweaks, and session history tracking.
- Launch
-
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
- Interactive Shell: Rich-based terminal UI providing menu navigation, wizards, live status, and settings.
- Orchestrator: Coordinates pipeline lifecycle: Initialization -> Detection -> Verdict -> Unpack -> Verify -> Report.
- PEContext: Central blackboard state object. Parsed PE artifacts and detector results are shared here.
- Plugin Manager: Dynamically discovers and loads detectors, unpackers, reporters, and verifiers.
- Detectors: Independent modules implementing
BaseDetector, executed in priority order. - 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
- Salman Mallah
- GitHub: @salmanmallah
- Email: mallahsalman06@gmail.com
- Repository: https://github.com/salmanmallah/packerscope
- PyPI: https://pypi.org/project/packerscope/
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2eb27f6b0b1d7f8da0682c29ac7447232fda9323b15767075cb959eff8c3a7e1
|
|
| MD5 |
6ac700c1762ceb93d4a9468e966092e5
|
|
| BLAKE2b-256 |
29ed860c1a0467e1ddc3bebd27bbc1ec9ece7bbb74fe3d52586cb36a7c1dd58d
|
Provenance
The following attestation bundles were made for packerscope-0.3.0.tar.gz:
Publisher:
publish.yml on salmanmallah/packerscope
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
packerscope-0.3.0.tar.gz -
Subject digest:
2eb27f6b0b1d7f8da0682c29ac7447232fda9323b15767075cb959eff8c3a7e1 - Sigstore transparency entry: 2762243158
- Sigstore integration time:
-
Permalink:
salmanmallah/packerscope@3aa00c815796402422d9989922ffa12b79a562e6 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/salmanmallah
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3aa00c815796402422d9989922ffa12b79a562e6 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c73d6fcc6f4d3e93400e99777f99a1b0876019436e64ea9b7e6ac1aad18c206
|
|
| MD5 |
522b68233ab12c87febc34dc35371c4e
|
|
| BLAKE2b-256 |
7f68f86c586ed6fe01813b4d99ee5a7035f1f1bc959bd98fcc35886fe347401c
|
Provenance
The following attestation bundles were made for packerscope-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on salmanmallah/packerscope
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
packerscope-0.3.0-py3-none-any.whl -
Subject digest:
5c73d6fcc6f4d3e93400e99777f99a1b0876019436e64ea9b7e6ac1aad18c206 - Sigstore transparency entry: 2762243321
- Sigstore integration time:
-
Permalink:
salmanmallah/packerscope@3aa00c815796402422d9989922ffa12b79a562e6 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/salmanmallah
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3aa00c815796402422d9989922ffa12b79a562e6 -
Trigger Event:
release
-
Statement type: