Advanced Universal Static Malware Analysis & Forensics Tool (v2.0)
This project provides a professional, Python-based static file forensics and malware triage tool designed to analyze any file format for potential malicious content safely and efficiently. The tool performs universal static analysis techniques including format-agnostic classification, archive/container inspection, sliding-window chunk entropy analysis, PE structure inspection, multi-provider threat intelligence API querying, MITRE ATT&CK technique mapping, YARA rule matching, Mandiant FLOSS string decoding, and IOC regex parsing to help security analysts quickly triage threats.
(venv) static-analyzer.exe .\samples\6cbc38b79a107e48cc0c657726b04be203f2b5ddd32c2a3e083c3acb8cdd9365.exe
--yara-rules .\rules\industry_grade_rules.yar --threat-intel --api-key YOUR_API_b28106ceac844738efbd1_KEY
╭────────────────────────────────────────────────────────────────────────────────────────────────╮
│ _ _ _ _ _ │
│ ___| |_ __ _| |_(_) ___ / \ _ __ __ _| |_ _ _______ _ __ │
│ / __| __/ _` | __| |/ __| / _ \ | '_ \ / _` | | | | |_ / _ \ '__| │
│ \__ \ || (_| | |_| | (__ / ___ \| | | | (_| | | |_| |/ / __/ | │
│ |___/\__\__,_|\__|_|\___/_/ \_\_| |_|\__,_|_|\__, /___\___|_| │
│ |___/ │
│ │
│ ────────────────────────────────────────────────────────────────────── │
│ Version : v2.0 │
│ Author : Rashid Dewewe │
│ Repository : https://github.com/unixdewewe/advanced-static-analyzer │
│ Target File : .\samples\6cbc38b79a107e48cc0c657726b04be203f2b5ddd32c2a3e083c3acb8cdd9365.exe │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────╯
[*] Cryptographic Fingerprints
MD5 : 5849a31cee6d06c9250755fba7aa04ec
SHA1 : c7594752950151b344dd59b1c0cff53a9c9ed3fe
SHA256 : 6cbc38b79a107e48cc0c657726b04be203f2b5ddd32c2a3e083c3acb8cdd9365
[*] File Identification & Header Analysis
Size: 174182 bytes
File Classification: Windows PE Executable (.exe, .dll, .sys)
Magic Details: PE32+ executable (console) x86-64, for MS Windows
Header Hex (16 bytes): 4D 5A 90 00 03 00 00 00 04 00 00 00 FF FF 00 00
Header ASCII: MZ..............
[*] Querying Threat Intelligence (Virustotal)...
Provider: VirusTotal
Status: Found in Database
Detections: 51 / 76 engines flagged as malicious
Key Features
- 🧩 Modular OOP Architecture: Built with a clean package structure under
src/static_analyzer/separating metadata extraction, PE analysis, non-PE heuristics, archives, threat intelligence, and reporting. - 🔍 Universal File Classification & Signature Analysis: Detects headers and classifies Windows PE Executables, Linux ELF binaries, macOS Mach-O files, ZIP/JAR/APK archives, PDF documents, and OLE Office files alongside a 16-byte hex and ASCII dump.
- ☁️ Multi-Provider Threat Intelligence Lookup: Queries online hash reputation databases with support for VirusTotal (default v3 API), MalwareBazaar, and Hybrid Analysis.
- 🛡️ Correlated MITRE ATT&CK Mapping: Automatically maps suspicious API imports and YARA rule hits to standard MITRE ATT&CK Technique IDs (e.g.,
T1055: Process Injection,T1497: System Checks). - 🗂️ Archive & Container Inspection: Opens ZIP, JAR, and APK files recursively to list inner code artifacts (
.class,.dex,.exe,.sh,.bat) and inspect uncompressed payload sizes. - ⚠️ Archive Vulnerability Safeguards: Automatically flags path-traversal indicators (Zip Slip vulnerabilities) within archive headers.
- 🔑 Cryptographic Fingerprinting: Calculates MD5, SHA1, SHA256 hashes, and PE Import Hashes (
imphash) when analyzing Portable Executables. - 📈 Universal Chunk Entropy Analysis: Performs sliding-window entropy scanning across any file type (archives, blobs, scripts) to detect encrypted, packed, or hidden payloads.
- 🏗️ PE Header & Section Security Scanning: Inspects section permissions for dangerous flags (e.g., RWX) and calculates per-section Shannon entropy.
- ⚡ Suspicious API Import Analysis: Flags Win32 APIs associated with process injection/hollowing, anti-debugging evasion, keylogging, and C2 networking.
- 🎯 YARA Rule Integration: Scans files against custom rules or directories (e.g.,
./rules/malware_rules.yar) usingyara-python. - 🧬 Mandiant FLOSS Integration: Automatically invokes local
flossbinaries to uncover stack strings, decoded strings, and obfuscated artifacts, equipped with automated file size safeguards (> 16MB) to prevent timeouts. - 📌 IOC Parsing & String Extraction: Extracts printable text strings and automatically parses IP addresses, URLs, email addresses, and Windows Registry keys using regular expressions.
- 📊 Flexible Output & Reporting: Generates rich terminal dashboards using
rich, standalone HTML reports (--export-html), session logs (analysis.log), or standard JSON exports for SOAR pipelines.
Project Structure
advanced-static-analyzer/
├── README.md # Documentation
├── requirements.txt # Python dependencies
├── pyproject.toml # Package configuration & CLI entry points
├── rules/
│ └── malware_rules.yar # Custom YARA threat detection rules
├── samples/ # Test binaries and archives
├── tests/ # Unit & integration tests for classes
│ ├── __init__.py
│ ├── test_pe_analyzer.py
│ └── test_threat_intel.py
└── src/
└── static_analyzer/ # Main package namespace
├── __init__.py
├── cli.py # CLI argument parser & entrypoint
├── orchestrator.py # TriageOrchestrator (workflow controller)
└── modules/ # Specialized domain analyzers
├── __init__.py
├── banner.py # ToolBanner & Reporting (HTML/JSON)
├── metadata.py # FileHeaderIdentification & StringIOCExtractor
├── pe_analyzer.py # PEAnalyzer (Sections, Imports, MITRE API mapping)
├── non_pe.py # NonPEAnalyzer (Chunk entropy, heuristics, base64 decoder)
├── archives.py # ZipJarInspector (ZIP/JAR/APK recursive traversal)
├── floss_wrap.py # FlareFloss wrapper & size safeguards
├── yara_engine.py # YaraMitreAttack (Yara rule compiling & mapping)
└── threat_intel.py # ThreatIntel (VirusTotal, MalwareBazaar, Hybrid Analysis)
Prerequisites
-
Python 3.8 or later
-
Mandatory dependencies (specified in
requirements.txt/pyproject.toml): -
pefile -
python-magic -
rich -
yara-python -
flare-floss -
Optional Tools:
-
Mandiant FLOSS (
flossavailable in systemPATH).
Sample Results
see ANALYSIS RESULTS.md
Installation & Setup
- Clone the repository:
git clone [https://github.com/unixdewewe/advanced-static-analyzer.git](https://github.com/unixdewewe/advanced-static-analyzer.git)
cd "advanced-static-analyzer"
- Create and Activate Virtual Environment:
- Windows:
python -m venv venv
.\venv\Scripts\activate
- Linux/macOS:
python3 -m venv venv
source venv/bin/activate
- Install Package in Editable Mode:
pip install -e .
Usage
Once installed, you can invoke the package globally using the CLI entry point static-analyzer:
static-analyzer <file_path> [options]
Options & Flags
--yara-rules <path>: Path to a.yarfile or directory containing YARA rules (e.g.,.\rules\malware_rules.yar).--enable-floss: Run Mandiant FLOSS to extract obfuscated and stack strings.--threat-intel: Query online hash reputation services for threat data.--ti-provider <provider>: Choose Threat Intelligence provider:virustotal(default),malwarebazaar, orhybridanalysis.--api-key <key>: Supply API key directly (or set via environment variable:VT_API_KEY/HA_API_KEY).--export-html <path>: Output formatted standalone HTML report (e.g.,report.html).--json: Output raw analysis results in JSON format.
Command Examples
1. Basic Analysis with Default VirusTotal Threat Intelligence Lookup:
# API key required
$env:VT_API_KEY="your_virustotal_api_key"
static-analyzer .\samples\malware.exe --threat-intel
2. Query Threat Intel via MalwareBazaar or Hybrid Analysis:
# Query MalwareBazaar (API key required)
$env:MALWAREBAZAAR_API_KEY="your_actual_malwarebazaar_auth_key"
static-analyzer .\samples\sample_file.jar --threat-intel --ti-provider malwarebazaar --api-key "your_MalwareBazaar_API_key"
# Query Hybrid Analysis with inline API key
$env:HA_API_KEY="your_actual_malwarebazaar_auth_key"
static-analyzer .\samples\malware.exe --threat-intel --ti-provider hybridanalysis --api-key "your_ha_API_key"
3. Comprehensive Forensic Triage (YARA + FLOSS + Threat Intel + HTML Report Export):
static-analyzer .\samples\malware.exe `
--yara-rules .\rules\malware_rules.yar `
--enable-floss `
--threat-intel `
--export-html report.html
4. Export Analysis Report as JSON:
static-analyzer .\samples\malware.exe --yara-rules .\rules\ --json > report.json
Precautions
- Safety Warning: Always execute malware analysis within an isolated, air-gapped Virtual Machine (VM) or sandbox.
- Legal Notice: Ensure proper authorization and legal compliance before performing forensic analysis on target files.
Acknowledgments
This tool builds upon and integrates several exceptional open-source libraries, threat intelligence platforms, and security standards widely adopted by the DFIR community:
- Mandiant FLOSS (FLARE Obfuscated String Solver): For uncovering obfuscated, encoded, and stack strings from binaries.
- YARA by VirusTotal: For powering pattern-matching rulesets and multi-platform binary signature detection.
- pefile: For parser handling and inspection of Portable Executable (PE) headers and structures.
- Threat Intelligence Providers: VirusTotal API v3, MalwareBazaar (abuse.ch), and Hybrid Analysis for cloud hash reputation lookups.
- MITRE ATT&CK®: For providing the standardized framework used to map behavioral indicators and suspicious imports to attack techniques.
Author
Rashid Dewewe
BSc in Cyber Security and Digital Forensics Engineering
License
Distributed under the Apache 2 License. See LICENSE for details.
Metadata
Release files for static-analyzer 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| static_analyzer-2.0.0.tar.gz | 32.1 kB | Without provenance | Details for static_analyzer-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| static_analyzer-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for static_analyzer-2.0.0-py3-none-any.whl |
Total release size: 63.2 kB
Release files / static_analyzer-2.0.0.tar.gz
| Download URL | static_analyzer-2.0.0.tar.gz |
|---|---|
| Size | 32.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eafc10b7b4d1bc05b247a68cd96dfbf11d58ac6fc08a35661ef338456dd92174
|
|
BLAKE2b-256 checksum How to use checksums |
a5979fbb5f9b3cba19b83bf3b04f051a99c109ce5e26d69dcce5d7e99fc1eb03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / static_analyzer-2.0.0-py3-none-any.whl
| Download URL | static_analyzer-2.0.0-py3-none-any.whl |
|---|---|
| Size | 31.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c045a46769c89473ff8e5c8589800b805c6dfe8110fe2935028e5095a4b99023
|
|
BLAKE2b-256 checksum How to use checksums |
e6c23b95f08522f2a490f094832c4d88ee460b1ce45061e4b7ee90c7aa051df5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for static-analyzer 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.