PackerScope
PackerScope is a production-quality Python framework for automatic packer detection, classification, and unpacking of Windows PE files. It is designed for defensive security research, malware analysis labs, and educational purposes.
Features
-
Multi-layered Detection Pipeline:
- Entropy Analysis: Measures Shannon entropy across the whole file, sections, and via a sliding window.
- 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 API usage (e.g.,
LoadLibrary,VirtualAlloc). - Entry Point Analysis: Disassembles entry point instructions using Capstone to detect jump chains, NOP sleds, and push/ret trampolines.
- Structure Analysis: Identifies anomalies in PE optional and file headers, missing directories, or invalid timestamps.
- Signature Matching: Fast byte-pattern matching using PEiD-style
userdb.txtdatabases. - YARA Scanning: Deep static analysis utilizing community or custom YARA rules.
- Heuristics Engine: Aggregates weak signals across all modules to form a high-confidence final verdict.
-
Automated Unpacking (Pluggable):
- UPXUnpacker: Native fast decompression using the
upxsystem binary. - GenericStaticUnpacker: Template for static algorithmic decompression (aPLib, LZMA).
- DynamicUnpacker: Template for dynamic unpacking via emulation (Qiling/Unicorn) or instrumentation (Frida).
- UPXUnpacker: Native fast decompression using the
-
Verification Subsystem: Automatically verifies the success of an unpacking attempt by checking PE validity, entropy reduction, IAT restoration, and section normalization.
-
Reporting: Generates comprehensive analysis reports in JSON, CSV, Markdown, and HTML formats.
-
Developer-Friendly: Written in modern Python 3.13+, completely type-hinted, and modular using Pydantic v2 data models and the Blackboard design pattern (
PEContext).
Requirements
- Python 3.13+
- Windows (Primary target OS, though the framework runs on Linux/macOS)
- Recommended external tools:
upx, Capstone
Installation
- Clone the repository or navigate to the framework directory.
- Install the required dependencies:
pip install -r requirements.txt
(Optional) For advanced features like disassembly and dynamic analysis, you can install optional dependency groups defined in pyproject.toml.
Usage
PackerScope provides an easy-to-use Command Line Interface (CLI):
Analyze a Single File
python -m packerscope.cli scan samples/malware.exe --format json,html --output results/
Batch Analyze a Directory
python -m packerscope.cli batch samples/ --workers 8 --format csv
View Quick PE Information
python -m packerscope.cli info samples/malware.exe
Architecture
- Orchestrator: Manages the entire pipeline (Initialization → Detection → Verdict → Unpack → Verify → Report).
- PEContext: The central Blackboard state object. Parsed PE data and detector results are shared here.
- Plugin Manager: Dynamically discovers and loads detectors, unpackers, and reporters from the framework and external directories.
- Detectors: Implement
BaseDetector. Executed in priority order. - Unpackers: Implement
BaseUnpacker. Selected dynamically based on the final packer verdict.
Project Structure
packer_identifier_framework/
├── packerscope/
│ ├── 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 # Plugin discovery and registration
│ ├── core/ # Interfaces, Enums, and Pydantic Models
│ ├── detectors/ # Detection modules (Entropy, IAT, YARA, etc.)
│ ├── reporters/ # Output generators (JSON, CSV, HTML, MD)
│ ├── signatures/ # PEiD signature parsing
│ ├── unpackers/ # Unpacking strategies
│ ├── utils/ # Helpers (disasm, entropy, hasher, pe_parser)
│ └── verification/ # Unpack verification logic
├── plugins/ # Directory for custom third-party plugins
├── tests/ # Unit and Integration tests
├── pyproject.toml # Project metadata and dependencies
└── requirements.txt # Flat dependency list
Running Tests
PackerScope comes with a comprehensive test suite covering core models, utility functions, detectors, config, and orchestrator integration.
pytest tests/ -v
Disclaimer
Educational and Research Purposes Only. This framework is intended strictly for defensive security research, malware analysis, and educational use within isolated malware analysis lab environments. Do not use this tool on systems or files you do not have permission to analyze.
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.1.1.tar.gz.
File metadata
- Download URL: packerscope-0.1.1.tar.gz
- Upload date:
- Size: 76.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e70b6981ddab00787542c772d4fc04f65bd170724f9a4498bb962dbee489ffb
|
|
| MD5 |
280d52033f900b05d13275f8184e8656
|
|
| BLAKE2b-256 |
a0371f43ec206944378979e613130f4a372c5e32f6a041566a8a6f874fa0e867
|
File details
Details for the file packerscope-0.1.1-py3-none-any.whl.
File metadata
- Download URL: packerscope-0.1.1-py3-none-any.whl
- Upload date:
- Size: 94.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be919393f79c1a1a1407745ecc208320ceb917b76bb700690169545b78cce740
|
|
| MD5 |
9b8d26d1952b72d483a49959ec02d4ee
|
|
| BLAKE2b-256 |
a6ec2e931158d6112e588530c5ad6ca776649f2a61d62880ffdd63460894b712
|