PERE is a lightweight Windows-focused static analysis engine for Portable Executable (PE) files. It inspects imported APIs, examines digital signature metadata, analyzes section structure, and computes a heuristic risk score to help triage suspicious binaries.
- Static PE analysis for
.exeand.dllfiles - Import-based behavioral scoring
- Behavioral scoring for correlated API patterns (persistence + injection, process hollowing, dropper behavior)
- Section structure analysis and overlay detection
- Packer/obfuscation heuristics using entropy and known markers
- Entropy analysis for packed or obfuscated binaries
- Detailed signature verification and signer metadata output
- Signature trust evaluation (
unsigned,selfsigned,valid) - Detection of injection chains and stealth process injection patterns
- Timestamp collection and anomaly scoring (
--timestamps) - JSON report export
- Colorized terminal output via
colorama
This tool is not a replacement for endpoint detection and response (EDR) systems. It is a lightweight, rapid triage utility for inspecting PE files (for example binaries that may have been dropped, modified, or used in an attack). Use it as a first-pass aid during investigations — follow up with full EDR, dynamic analysis, and forensic procedures for definitive conclusions.
- Python 3.11+ recommended
- Windows environment for meaningful PE analysis
- Clone or download the repository.
- Create a virtual environment (recommended):
python -m venv .venv
.\.venv\Scripts\Activate.ps1- Install dependencies:
pip install -r requirements.txtRun the main analyzer with the target directory path:
python main.py --path C:\path\to\binariesOptional arguments:
--extensions: comma-separated extensions to scan (default:exe,dll)--timestamps: include file and PE timestamp details, and score anomalous dates--json: save results to a JSON report--output: JSON output filename (default:report.json)
Example:
python main.py --path C:\samples --extensions exe,dll --json --output findings.jsondemo.webm
main.pyscans the provided directory and invokesanalyzer.analyze_file()for each matching file.analyzer.pyloads the PE file usingpefile, extracts imported functions, inspects Authenticode signature metadata, analyzes section structure, and optionally gathers timestamp metadata.rules.pyscores detected APIs, signature data, section anomalies, and timestamp anomalies when--timestampsis enabled, generating findings and a combined risk score.engine.pycurrently forwards the evaluation result fromrules.pyand can be extended for future scoring enhancements.
PERE uses grouped API scoring and heuristic detections such as:
- Memory APIs (e.g.
VirtualAlloc,WriteProcessMemory) - Injection APIs (e.g.
CreateRemoteThread,OpenProcess) - Execution APIs (e.g.
CreateProcessA,ShellExecuteW) - Dynamic loading APIs (
LoadLibrary,GetProcAddress) - Persistence APIs (
RegSetValueEx,RegCreateKeyEx)
Special pattern detections include:
Injection ChainStealth InjectionDynamic API ResolutionOverlay DetectedPacker / Obfuscator Signature
Trusted signed binaries from selected publishers can bypass scoring.
main.py— CLI entrypoint and output formattingscanner.py— directory traversal and extension filteringanalyzer.py— PE parsing, import extraction, signature detection, and section analysisrules.py— scoring rules and risk evaluationengine.py— evaluation orchestrationrequirements.txt— package dependencies
See LICENSE for license details.