Skip to content

Next-Generation Firmware Analysis Toolkit. A hybrid Rust/Python toolkit for deep firmware analysis, extraction, and vulnerability discovery.

License

Notifications You must be signed in to change notification settings

ismailtsdln/firmalyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

26 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฌ Firmalyzer

Firmalyzer Logo

Next-generation firmware analysis toolkit

Python 3.8+ Rust License: MIT Version

Firmalyzer combines the performance of Rust with the flexibility of Python to deliver deep binary analysis, vulnerability detection, and comprehensive reporting.


โœจ Features

Feature Description
๐Ÿ” 45+ Signature Detection Identify filesystems, bootloaders, compression, crypto, and more
๐Ÿ“Š Entropy Analysis Shannon entropy with colorized sparkline visualization
๐Ÿ“ฆ Recursive Extraction Automatic decompression of gzip, LZMA, and nested archives
๐Ÿ”‘ Credential Detection Find hardcoded passwords, API keys, and secrets
๐Ÿ” Crypto Key Detection Locate RSA/AES keys, certificates, and crypto patterns
๐Ÿ›ก๏ธ CVE Matching Real-time NVD API integration with local caching
๐Ÿ“ˆ Risk Scoring Weighted 0-100 score with severity classification
๐Ÿ“„ Multi-format Reports JSON, XML, and interactive HTML dashboards
๐ŸŒ Web GUI Browser-based interface for visual analysis
๐Ÿ”Œ Plugin System Extend functionality with custom Python plugins

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.8+
  • Rust 1.70+ (for building from source)
  • pip or pipx

Installation

It is highly recommended to use a virtual environment.

# Clone the repository
git clone https://github.com/ismailtsdln/firmalyzer.git
cd firmalyzer

# Create and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install build dependencies
pip install maturin

# Build and install (Use ABI3 flag for Python 3.12+)
export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 
cd python && maturin develop --release

# Verify installation
firmalyzer --version

Basic Usage

# Analyze a firmware file
firmalyzer analyze firmware.bin

# With entropy visualization
firmalyzer analyze firmware.bin --ec

# Generate HTML report
firmalyzer analyze firmware.bin --html report.html

# JSON output for automation
firmalyzer analyze firmware.bin --json > results.json

# Launch web GUI
firmalyzer gui

๐Ÿ“– CLI Reference

Usage: firmalyzer [OPTIONS] COMMAND [ARGS]...

Options:
  -V, --version  Show version and exit
  -v, --verbose  Enable verbose/debug output
  -q, --quiet    Suppress all output except errors
  --help         Show this message and exit

Commands:
  analyze  Analyze a firmware file
  gui      Launch the web-based GUI dashboard

Analyze Command

Usage: firmalyzer analyze [OPTIONS] PATH

Options:
  -e, --extract          Perform recursive extraction
  --entropy-chunks, --ec Show chunked entropy visualization
  --chunk-size INTEGER   Chunk size for entropy (default: 1024)
  --json                 Output in JSON format
  --xml                  Output in XML format
  --html PATH            Generate HTML report to specified path

๐Ÿ“Š Sample Output

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ ๐Ÿ”ฌ FIRMALYZER Analysis Report                                 โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
โ•ญโ”€โ”€โ”€โ”€ ๐Ÿ“ฆ Size โ”€โ”€โ”€โ”€โ•ฎ  โ•ญโ”€โ”€ ๐Ÿ“Š Entropy โ”€โ”€โ”€โ•ฎ  โ•ญโ”€ ๐Ÿ” Signatures โ”€โ•ฎ
โ”‚ 4,521,984       โ”‚  โ”‚ 6.8724          โ”‚  โ”‚ 12              โ”‚
โ”‚ bytes           โ”‚  โ”‚ bits/byte       โ”‚  โ”‚ found           โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ  โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ  โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿ“ˆ Entropy Distribution
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ โ–โ–‚โ–‚โ–ƒโ–„โ–…โ–†โ–‡โ–‡โ–‡โ–‡โ–†โ–†โ–…โ–„โ–ƒโ–‚โ–โ–โ–‚โ–ƒโ–„โ–…โ–†โ–‡โ–‡โ–‡โ–†โ–…โ–„โ–ƒโ–‚โ–                             โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿ” Identified Signatures (Root)
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Offset       โ”‚ Name       โ”‚ Type        โ”‚ Description          โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 0x00000000   โ”‚ uImage     โ”‚ BOOTLOADER  โ”‚ U-Boot boot image    โ”‚
โ”‚ 0x00010000   โ”‚ SquashFS   โ”‚ FILESYSTEM  โ”‚ SquashFS filesystem  โ”‚
โ”‚ 0x003F0000   โ”‚ gzip       โ”‚ COMPRESSION โ”‚ gzip compressed data โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿ”Œ Plugin Insights
  โ€ข Crypto Detector: total_keys: 2 | total_certs: 1
  โ€ข String Analyzer: total_ascii: 1,247 | passwords: 3

Risk Assessment:
  Score: ๐ŸŸ  65/100 (HIGH)
  โ€ข Private key found at 0x1A2B3C
  โ€ข Potential passwords: 3

๐Ÿ—๏ธ Architecture

firmalyzer/
โ”œโ”€โ”€ core/                    # ๐Ÿฆ€ Rust performance engine
โ”‚   โ”œโ”€โ”€ src/lib.rs          # Entropy, signatures, extraction
โ”‚   โ””โ”€โ”€ Cargo.toml          # Rust dependencies
โ”‚
โ”œโ”€โ”€ python/                  # ๐Ÿ Python CLI & plugins
โ”‚   โ””โ”€โ”€ firmalyzer/
โ”‚       โ”œโ”€โ”€ main.py         # CLI entrypoint
โ”‚       โ”œโ”€โ”€ config.py       # Configuration system
โ”‚       โ”œโ”€โ”€ logger.py       # Logging system
โ”‚       โ”œโ”€โ”€ security.py     # Input validation
โ”‚       โ”œโ”€โ”€ scoring.py      # Risk scoring
โ”‚       โ”œโ”€โ”€ plugins/        # Plugin modules
โ”‚       โ”‚   โ”œโ”€โ”€ manager.py
โ”‚       โ”‚   โ”œโ”€โ”€ string_analyzer.py
โ”‚       โ”‚   โ”œโ”€โ”€ crypto_detector.py
โ”‚       โ”‚   โ””โ”€โ”€ nvd_cve.py
โ”‚       โ”œโ”€โ”€ reporters/      # Report generators
โ”‚       โ””โ”€โ”€ gui/            # Web dashboard
โ”‚
โ”œโ”€โ”€ ext/
โ”‚   โ””โ”€โ”€ signatures.json     # 45+ signature patterns
โ”‚
โ”œโ”€โ”€ tests/                   # ๐Ÿงช Test suite
โ”œโ”€โ”€ Makefile                # Development commands
โ”œโ”€โ”€ Dockerfile              # Container deployment
โ””โ”€โ”€ README.md

๐Ÿ”Œ Plugin Development

Create custom analysis plugins in python/firmalyzer/plugins/:

from . import BasePlugin

class MyPlugin(BasePlugin):
    @property
    def name(self) -> str:
        return "my_plugin"

    @property
    def description(self) -> str:
        return "Custom analysis plugin"

    def analyze(self, data: bytes, results: dict) -> dict:
        # Your analysis logic here
        findings = {"custom_field": "value"}
        return findings

Plugins are automatically loaded and executed during analysis.


โš™๏ธ Configuration

Create ~/.firmalyzer/config.yaml:

general:
  max_file_size_mb: 500
  max_extraction_depth: 5
  chunk_size: 1024

plugins:
  enabled: true
  auto_load: true

nvd_api:
  enabled: true
  cache_days: 7
  api_key: YOUR_NVD_API_KEY  # Optional

logging:
  level: INFO
  file_logging: false

Environment variable overrides:

export FIRMALYZER_MAX_FILE_SIZE=1000
export FIRMALYZER_LOG_LEVEL=DEBUG
export FIRMALYZER_NVD_API_KEY=your-key

๐Ÿณ Docker

# Build image
docker build -t firmalyzer:latest .

# Run analysis
docker run -v $(pwd):/data firmalyzer:latest analyze /data/firmware.bin

# Generate report
docker run -v $(pwd):/data firmalyzer:latest analyze /data/firmware.bin --html /data/report.html

๐Ÿงช Development

# Install development dependencies
cd python && pip install -e ".[dev]"

# Build with modern Python support (3.12+)
export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
make dev

# Run tests
make test

# Format and Lint
make format
make lint

# Build production wheel
make build

๐Ÿค Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and lints
  5. Submit a pull request

๐Ÿ“œ License

This project is licensed under the MIT License - see LICENSE for details.


๐Ÿ™ Acknowledgments

  • PyO3 - Rust/Python bindings
  • Rich - Beautiful terminal output
  • Click - CLI framework
  • NVD - Vulnerability database

Built with โค๏ธ by Ismail Tasdelen

About

Next-Generation Firmware Analysis Toolkit. A hybrid Rust/Python toolkit for deep firmware analysis, extraction, and vulnerability discovery.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published