Skip to main content

A comprehensive environment for hardware and firmware reverse engineering, analysis and management

Project description


title: "Twinizer - Digital Twin Generation Toolkit" description: "Comprehensive toolkit for creating and manipulating digital twins of hardware and software systems" author: "Tom Sapletta" keywords: "digital twin, hardware analysis, software analysis, KiCad, code analysis, documentation generation" lang: "en" image: "https://raw.githubusercontent.com/twinizer/python/main/docs/assets/twinizer-logo.png"

Twinizer

Overview

Twinizer is a comprehensive toolkit for creating and manipulating digital twins of hardware and software systems. It provides a collection of converters, analyzers, and utilities to transform various input formats into useful representations for digital twin applications.

Features

Hardware Analysis

  • KiCad Integration: Parse and convert KiCad schematics and PCB layouts
  • KiCad Docker Integration: Convert KiCad files to various formats (SVG, PNG, PDF, DXF, HPGL, PS, EPS) and analyze projects using Docker
  • Altium Integration: Support for Altium Designer files
  • 3D Model Generation: Convert PCB designs to 3D models

Software Analysis

  • Dependency Analysis: Analyze project dependencies across various languages and build systems
  • Decompilation: Convert binary files to higher-level representations
  • Disassembly: Disassemble binary files into assembly code
  • Code Analysis: Perform static code analysis, linting, and documentation generation for multiple programming languages

Converters

  • PDF to Markdown: Convert PDF documents to Markdown format
  • Image Processing:
    • ASCII Art: Convert images to ASCII art
    • Mermaid Diagrams: Generate Mermaid diagrams from images
    • 3D Models: Convert images to height maps, normal maps, 3D meshes, and point clouds
  • Binary to Source: Convert binary files to source code representations

Installation

Using pip

pip install twinizer

From Source

git clone https://github.com/twinizer/python.git
cd twinizer
pip install -e .

Dependencies

Twinizer has several optional dependencies that enable specific features:

# For image processing features
pip install matplotlib

# For KiCad integration (required for hardware analysis)
# KiCad must be installed on your system for full functionality

# For KiCad Docker integration
# Docker must be installed and running on your system

# For PDF conversion
pip install pdfminer.six

# For all optional dependencies
pip install twinizer[all]

Usage

Command Line Interface

Twinizer provides a comprehensive command-line interface for all its functionality:

# Show help and available commands
twinizer --help

# Analyze project structure
twinizer analyze structure --source-dir /path/to/project

# Convert between file formats
twinizer convert pdf-to-markdown /path/to/document.pdf --output document.md

# Work with KiCad files
twinizer kicad sch-to-mermaid /path/to/schematic.sch --diagram-type flowchart --output schematic.mmd
twinizer kicad sch-to-bom /path/to/schematic.sch --format csv --output bom.csv
twinizer kicad pcb-to-mermaid /path/to/pcb.kicad_pcb --diagram-type flowchart --output pcb.mmd

# Work with KiCad files using Docker
twinizer kicad-docker convert /path/to/schematic.kicad_sch --format svg --output schematic.svg
twinizer kicad-docker convert /path/to/schematic.kicad_sch --format pdf --color-theme dark --paper-size A3 --orientation landscape
twinizer kicad-docker analyze /path/to/kicad_project --format html --output report.html
twinizer kicad-docker formats

# Analyze code and generate documentation
twinizer code-analyze /path/to/project --output-dir ./reports --output-format markdown --generate-docs
twinizer code-analyze /path/to/file.py --output-format json

# Generate comprehensive project report with multiple formats
twinizer generate-report /path/to/project \
  --output-dir ./reports \
  --include-formats svg,html,pdf,markdown \
  --analyze-code \
  --analyze-hardware \
  --extract-schematics \
  --build-website \
  --serve

Comprehensive Report Generation

Twinizer can generate complete project reports that combine code analysis, hardware schematics, and documentation in a single command:

twinizer generate-report /path/to/project \
  --output-dir ./reports \
  --include-formats svg,html,pdf,markdown \
  --analyze-code \
  --analyze-hardware \
  --extract-schematics \
  --build-website \
  --serve

This creates a navigable website with downloadable reports in multiple formats, providing a complete overview of your project's structure and components.

Project Structure

twinizer/
├── src/
│   ├── twinizer/
│   │   ├── cli/               # Command-line interface
│   │   │   └── commands/      # CLI command modules
│   │   ├── converters/        # File format converters
│   │   │   ├── pdf2md/        # PDF to Markdown conversion
│   │   │   ├── image/         # Image processing
│   │   │   └── bin2source/    # Binary to source code conversion
│   │   ├── code_analyzer/     # Code analysis and documentation
│   │   │   ├── documentation/ # Documentation generation
│   │   │   ├── linters/       # Code linting tools
│   │   │   ├── metrics/       # Code metrics analysis
│   │   │   └── security/      # Security analysis
│   │   ├── hardware/          # Hardware analysis
│   │   │   ├── kicad/         # KiCad file parsing
│   │   │   └── altium/        # Altium file parsing
│   │   ├── software/          # Software analysis
│   │   │   ├── analyze/       # Code analysis
│   │   │   ├── decompile/     # Decompilation
│   │   │   └── disassemble/   # Disassembly
│   │   └── utils/             # Utility functions
├── scripts/                   # Utility scripts
├── tests/                     # Test suite
├── docs/                      # Documentation
├── examples/                  # Example code
├── pyproject.toml             # Project configuration
└── README.md                  # This file

Examples

See the examples/ directory for example scripts demonstrating various features of Twinizer.

Contributing

Contributions are welcome! Please see our CONTRIBUTING.md file for detailed guidelines on how to contribute to this project.

Development Workflow

This project uses GitHub Actions for continuous integration. On each push to the main branch and pull requests, the pipeline will:

  • Run tests on multiple Python versions
  • Check code formatting with Black
  • Verify import ordering with isort
  • Run linting with flake8
  • Build the package

Documentation

The project documentation is available on GitHub Pages at https://twinizer.github.io/twinizer/.

Documentation is written in Markdown with Mermaid diagram support. To contribute to the documentation:

  1. Edit the files in the docs/ directory
  2. Submit a pull request
  3. Once merged, the documentation will be automatically updated on GitHub Pages

License

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

<script type="module"> import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs'; //import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10.8.0/dist/mermaid.min.js'; mermaid.initialize({ startOnReady:true, theme: 'forest', flowchart:{ useMaxWidth:false, htmlLabels:true } }); mermaid.init(undefined, '.language-mermaid'); </script>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twinizer-0.1.82.tar.gz (132.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twinizer-0.1.82-py3-none-any.whl (160.1 kB view details)

Uploaded Python 3

File details

Details for the file twinizer-0.1.82.tar.gz.

File metadata

  • Download URL: twinizer-0.1.82.tar.gz
  • Upload date:
  • Size: 132.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for twinizer-0.1.82.tar.gz
Algorithm Hash digest
SHA256 7a2477b6a55af6419ab212993934a1b1abbfce0d10a05c7c419f52e206c4f6ce
MD5 7bf873dbe8f3179f85bda05b474dc194
BLAKE2b-256 4bef8f8b6b6b361cad739b1a4d6117a524dcad0a8579d3cc22458c6d9b092175

See more details on using hashes here.

File details

Details for the file twinizer-0.1.82-py3-none-any.whl.

File metadata

  • Download URL: twinizer-0.1.82-py3-none-any.whl
  • Upload date:
  • Size: 160.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for twinizer-0.1.82-py3-none-any.whl
Algorithm Hash digest
SHA256 879396bd86786944fe2e6e9a7f458d93897dd4046d6b9c4dd603e63bc4cdb1f1
MD5 700ab78428b0990a5a16664fc5b4badb
BLAKE2b-256 4e0f780d035c57150a4ec2401674baafde738f739f397f312b2a0692f8446643

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page