r2morph


Namer2morph JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA metamorphic binary transformation engine based on r2pipe and radare2
upload_time2025-10-08 10:52:10
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT
keywords binary-analysis metamorphic code-transformation radare2 r2pipe reverse-engineering binary-mutation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # r2morph

A metamorphic binary transformation engine based on r2pipe and radare2.

[![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![codecov](https://codecov.io/gh/seifreed/r2morph/branch/main/graph/badge.svg)](https://codecov.io/gh/seifreed/r2morph)
[![CI](https://github.com/seifreed/r2morph/workflows/Python%20Package/badge.svg)](https://github.com/seifreed/r2morph/actions)
[![GitHub issues](https://img.shields.io/github/issues/seifreed/r2morph)](https://github.com/seifreed/r2morph/issues)
[![GitHub stars](https://img.shields.io/github/stars/seifreed/r2morph)](https://github.com/seifreed/r2morph/stargazers)

**Author**: Marc Rivero | [@seifreed](https://github.com/seifreed)
**Contact**: mriverolopez@gmail.com

---

## Overview

**r2morph** is a powerful framework for analyzing and transforming binary executables through semantic-preserving mutations. It leverages radare2 and r2pipe to perform deep binary analysis and apply metamorphic transformations that change the binary signature while maintaining program semantics.

**Perfect for**:
- Security research and malware analysis
- Evasion technique testing
- Binary obfuscation research
- Defensive security tool development

---

## Key Features

- **Deep Binary Analysis**: Leverage radare2's powerful analysis engine
- **Metamorphic Transformations**: Apply semantic-preserving code mutations
- **Modular Architecture**: Extensible pipeline-based design
- **Multi-Architecture**: Support for PE/ELF/Mach-O on x86/x64/ARM
- **Plugin System**: Easy-to-create custom mutation passes
- **Rich Analytics**: Detailed statistics and reporting
- **CLI + Python API**: Powerful command-line and programmatic interfaces
- **Validation & Testing**: Automated validation, fuzzing, regression tests
- **Relocation Management**: Code cave finding, reference updates
- **Anti-Detection Analysis**: Evasion scoring, entropy analysis, similarity hashing
- **ARM64/ARM32 Support**: 180+ patterns for ARM architectures
- **Advanced Mutations**: Opaque predicates, dead code, control flow flattening
- **Platform Support**: Code signing for macOS/Windows, format-specific handlers
- **Profile-Guided**: Hot path detection, execution profiling
- **Session Management**: Checkpoints, rollback, versioning
- **Memory-Efficient Mode**: Automatic OOM prevention for large binaries (>50MB)

---

## Quick Start

### Installation

#### Prerequisites

- Python 3.10 or higher
- radare2 installed on your system

#### Install radare2

```bash
git clone https://github.com/radareorg/radare2
cd radare2
sys/install.sh
```

#### Install r2morph

```bash
pip install r2morph

git clone https://github.com/seifreed/r2morph.git
cd r2morph
pip install -e .

pip install -e ".[dev]"
```

### Basic Usage

```bash
r2morph input_binary output_binary

r2morph input.exe output.exe -m nop -m substitute -v

r2morph -i input.exe -o output.exe --aggressive
```

### Python API

```python
from r2morph import MorphEngine
from r2morph.mutations import NopInsertionPass, InstructionSubstitutionPass

with MorphEngine() as engine:
    engine.load_binary("input.exe").analyze()

    engine.add_mutation(NopInsertionPass())
    engine.add_mutation(InstructionSubstitutionPass())

    result = engine.run()
    engine.save("output.exe")

print(f"Applied {result['total_mutations']} mutations")
```

---

## Supported Transformations

### Basic Mutations
- **Instruction Substitution**: Replace instructions with semantic equivalents (90+ patterns)
- **NOP Insertion**: Insert dead code at safe locations
- **Register Reassignment**: Swap equivalent registers
- **Block Reordering**: Rearrange code blocks (preserving control flow)
- **Instruction Expansion**: Expand simple instructions into complex equivalents

### Advanced Mutations ⚡
- **Opaque Predicates**: Inject always-true/false conditionals
- **Dead Code Injection**: Insert code that never executes (3 complexity levels)
- **Control Flow Flattening**: Transform CFG into dispatcher pattern

---

## Examples

### Basic Binary Analysis

```python
from r2morph import Binary

with Binary("/path/to/binary") as binary:
    binary.analyze()

    functions = binary.get_functions()
    print(f"Found {len(functions)} functions")

    arch = binary.get_arch_info()
    print(f"Architecture: {arch['arch']} ({arch['bits']}-bit)")
```

### Validation & Testing

```python
from r2morph.validation import BinaryValidator, MutationFuzzer

validator = BinaryValidator()
result = validator.validate(original, mutated)

fuzzer = MutationFuzzer(num_tests=100)
fuzz_result = fuzzer.fuzz(original, mutated)
```

### Evasion Analysis

```python
from r2morph.detection import EvasionScorer

scorer = EvasionScorer()
score = scorer.score(original, mutated)
print(score)
```

### Session Management

```python
from r2morph import MorphSession

session = MorphSession()
session.start(original)

session.checkpoint("stage1")
session.apply_mutation(NopPass())

session.rollback_to("stage1")

session.finalize(output)
```

### Custom Mutation Pass

```python
from r2morph.mutations.base import MutationPass
from r2morph.core.binary import Binary

class MyCustomMutation(MutationPass):
    def __init__(self):
        super().__init__(name="MyCustomMutation")

    def apply(self, binary: Binary):
        mutations_applied = 0

        functions = binary.get_functions()
        for func in functions:
            pass

        return {
            "mutations_applied": mutations_applied,
            "custom_metric": 42,
        }

engine.add_mutation(MyCustomMutation())
```

See the `examples/` directory for complete examples:
- `basic_analysis.py`: Simple binary analysis
- `morph_binary.py`: Apply transformations to a binary
- `advanced_analysis.py`: Advanced analysis features
- `advanced_mutations.py`: Using advanced mutations

---

## Memory-Efficient Mode

r2morph automatically detects large binaries and enables memory-efficient mode to prevent OOM crashes:

### Automatic Detection
- **Triggers**: Binaries >50MB or >3000 functions
- **Batch Processing**: r2 restarts every 1000 mutations to free memory
- **Conservative Limits**: Reduced mutations per function (2 instead of 5)
- **Low-Memory r2 Config**: Disables caching (`bin.cache=false`, `io.cache=false`)

### Example
```bash
# Automatically handles large binaries (e.g., Qt6WebEngineCore.dll - 148MB)
r2morph large_binary.dll morphed.dll

# Output:
# Large binary detected (147.3 MB, 4261 functions)
# Enabling memory-efficient mode to prevent OOM crashes
# Batch checkpoint: 1000 mutations applied. Reloading r2 to free memory...
```

### Pipeline Integration
Memory-efficient mode is **100% transparent** - no code changes needed. Just run r2morph normally and it will auto-detect and protect against OOM.

---

## Architecture

```
┌─────────────┐
│   Binary    │  ← Load binary with r2pipe
└──────┬──────┘
       │
       ▼
┌─────────────┐
│  Analysis   │  ← Analyze with radare2
└──────┬──────┘
       │
       ▼
┌─────────────┐
│  Pipeline   │  ← Execute mutation passes
│             │
│  ┌────────┐ │
│  │ Pass 1 │ │
│  └────────┘ │
│  ┌────────┐ │
│  │ Pass 2 │ │
│  └────────┘ │
│  ┌────────┐ │
│  │ Pass N │ │
│  └────────┘ │
└──────┬──────┘
       │
       ▼
┌─────────────┐
│   Output    │  ← Save morphed binary
└─────────────┘
```

### Module Structure

```
r2morph/
├── core/           # Binary abstraction, engine
│   ├── binary.py       # Binary abstraction
│   ├── engine.py       # Morphing engine
│   ├── function.py     # Function representation
│   └── instruction.py  # Instruction representation
├── mutations/      # 8 mutation passes + ARM rules
│   ├── base.py                     # Base mutation class
│   ├── nop_insertion.py            # NOP insertion
│   ├── instruction_substitution.py # Instruction substitution
│   ├── register_substitution.py    # Register reassignment
│   ├── block_reordering.py         # Block reordering
│   ├── instruction_expansion.py    # Instruction expansion
│   ├── opaque_predicates.py        # Opaque predicates
│   ├── dead_code_injection.py      # Dead code injection
│   ├── control_flow_flattening.py  # CFG flattening
│   ├── arm_rules.py                # ARM equivalence patterns
│   └── arm_expansion_rules.py      # ARM expansion patterns
├── analysis/       # CFG, dependencies, diff analysis
│   ├── analyzer.py      # Binary analyzer
│   ├── cfg.py           # Control flow graph
│   ├── dependencies.py  # Data dependencies
│   ├── invariants.py    # Code invariants
│   └── diff_analyzer.py # Binary diff analysis
├── validation/     # Testing, fuzzing, regression
│   ├── validator.py     # Binary validator
│   ├── fuzzer.py        # Mutation fuzzer
│   └── regression.py    # Regression tester
├── relocations/    # Code caves, reference updates
│   ├── manager.py           # Relocation manager
│   ├── cave_finder.py       # Code cave finder
│   └── reference_updater.py # Reference updater
├── detection/      # Evasion scoring, entropy
│   ├── evasion_scorer.py    # Evasion scorer
│   ├── similarity_hasher.py # Fuzzy hashing
│   └── entropy_analyzer.py  # Entropy analysis
├── platform/       # PE/ELF/Mach-O handlers, code signing
│   ├── codesign.py      # Code signing
│   ├── pe_handler.py    # PE format handler
│   ├── elf_handler.py   # ELF format handler
│   └── macho_handler.py # Mach-O format handler
├── profiling/      # Hot path detection, profiling
│   ├── profiler.py          # Execution profiler
│   └── hotpath_detector.py  # Hot path detector
├── pipeline/       # Pipeline orchestration
│   └── pipeline.py      # Pipeline management
├── utils/          # Utilities
│   ├── logging.py       # Logging configuration
│   └── assembler.py     # Assembly helpers
├── session.py      # Checkpoint & rollback
└── cli.py          # Command-line interface
```

---

## Contributing

### Creating a New Mutation Pass

1. Create a new file in `r2morph/mutations/`
2. Subclass `MutationPass`
3. Implement the `apply()` method
4. Add to `r2morph/mutations/__init__.py`

Example:

```python
from r2morph.mutations.base import MutationPass

class MyMutation(MutationPass):
    def __init__(self, config=None):
        super().__init__(name="MyMutation", config=config)

    def apply(self, binary):
        return {"mutations_applied": 0}
```

---

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

## Disclaimer

**This tool is for research and educational purposes only.** Users are responsible for ensuring they have proper authorization before analyzing or modifying any binary. The authors are not responsible for any misuse of this tool.

---

## Acknowledgments

- Built on top of [radare2](https://github.com/radareorg/radare2)
- Uses [r2pipe](https://github.com/radareorg/radare2-r2pipe) for radare2 integration
- Inspired by metamorphic engine research

---

## Contact & Support

- **Author**: Marc Rivero | [@seifreed](https://github.com/seifreed)
- **Email**: mriverolopez@gmail.com
- **Issues**: [GitHub Issues](https://github.com/seifreed/r2morph/issues)
- **Repository**: https://github.com/seifreed/r2morph

---

## 📖 Citation

If you use r2morph in your research, please cite:

```bibtex
@software{r2morph,
  title = {r2morph: A Metamorphic Binary Transformation Engine},
  author = {Marc Rivero},
  year = {2025},
  url = {https://github.com/seifreed/r2morph}
}
```

---

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "r2morph",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Marc Rivero <mriverolopez@gmail.com>",
    "keywords": "binary-analysis, metamorphic, code-transformation, radare2, r2pipe, reverse-engineering, binary-mutation",
    "author": null,
    "author_email": "Marc Rivero <mriverolopez@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/dd/83/2ceed714d8decc60639a37bcf35e300eb18f9194006bb88e3502429c89be/r2morph-0.1.0.tar.gz",
    "platform": null,
    "description": "# r2morph\n\nA metamorphic binary transformation engine based on r2pipe and radare2.\n\n[![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![codecov](https://codecov.io/gh/seifreed/r2morph/branch/main/graph/badge.svg)](https://codecov.io/gh/seifreed/r2morph)\n[![CI](https://github.com/seifreed/r2morph/workflows/Python%20Package/badge.svg)](https://github.com/seifreed/r2morph/actions)\n[![GitHub issues](https://img.shields.io/github/issues/seifreed/r2morph)](https://github.com/seifreed/r2morph/issues)\n[![GitHub stars](https://img.shields.io/github/stars/seifreed/r2morph)](https://github.com/seifreed/r2morph/stargazers)\n\n**Author**: Marc Rivero | [@seifreed](https://github.com/seifreed)\n**Contact**: mriverolopez@gmail.com\n\n---\n\n## Overview\n\n**r2morph** is a powerful framework for analyzing and transforming binary executables through semantic-preserving mutations. It leverages radare2 and r2pipe to perform deep binary analysis and apply metamorphic transformations that change the binary signature while maintaining program semantics.\n\n**Perfect for**:\n- Security research and malware analysis\n- Evasion technique testing\n- Binary obfuscation research\n- Defensive security tool development\n\n---\n\n## Key Features\n\n- **Deep Binary Analysis**: Leverage radare2's powerful analysis engine\n- **Metamorphic Transformations**: Apply semantic-preserving code mutations\n- **Modular Architecture**: Extensible pipeline-based design\n- **Multi-Architecture**: Support for PE/ELF/Mach-O on x86/x64/ARM\n- **Plugin System**: Easy-to-create custom mutation passes\n- **Rich Analytics**: Detailed statistics and reporting\n- **CLI + Python API**: Powerful command-line and programmatic interfaces\n- **Validation & Testing**: Automated validation, fuzzing, regression tests\n- **Relocation Management**: Code cave finding, reference updates\n- **Anti-Detection Analysis**: Evasion scoring, entropy analysis, similarity hashing\n- **ARM64/ARM32 Support**: 180+ patterns for ARM architectures\n- **Advanced Mutations**: Opaque predicates, dead code, control flow flattening\n- **Platform Support**: Code signing for macOS/Windows, format-specific handlers\n- **Profile-Guided**: Hot path detection, execution profiling\n- **Session Management**: Checkpoints, rollback, versioning\n- **Memory-Efficient Mode**: Automatic OOM prevention for large binaries (>50MB)\n\n---\n\n## Quick Start\n\n### Installation\n\n#### Prerequisites\n\n- Python 3.10 or higher\n- radare2 installed on your system\n\n#### Install radare2\n\n```bash\ngit clone https://github.com/radareorg/radare2\ncd radare2\nsys/install.sh\n```\n\n#### Install r2morph\n\n```bash\npip install r2morph\n\ngit clone https://github.com/seifreed/r2morph.git\ncd r2morph\npip install -e .\n\npip install -e \".[dev]\"\n```\n\n### Basic Usage\n\n```bash\nr2morph input_binary output_binary\n\nr2morph input.exe output.exe -m nop -m substitute -v\n\nr2morph -i input.exe -o output.exe --aggressive\n```\n\n### Python API\n\n```python\nfrom r2morph import MorphEngine\nfrom r2morph.mutations import NopInsertionPass, InstructionSubstitutionPass\n\nwith MorphEngine() as engine:\n    engine.load_binary(\"input.exe\").analyze()\n\n    engine.add_mutation(NopInsertionPass())\n    engine.add_mutation(InstructionSubstitutionPass())\n\n    result = engine.run()\n    engine.save(\"output.exe\")\n\nprint(f\"Applied {result['total_mutations']} mutations\")\n```\n\n---\n\n## Supported Transformations\n\n### Basic Mutations\n- **Instruction Substitution**: Replace instructions with semantic equivalents (90+ patterns)\n- **NOP Insertion**: Insert dead code at safe locations\n- **Register Reassignment**: Swap equivalent registers\n- **Block Reordering**: Rearrange code blocks (preserving control flow)\n- **Instruction Expansion**: Expand simple instructions into complex equivalents\n\n### Advanced Mutations \u26a1\n- **Opaque Predicates**: Inject always-true/false conditionals\n- **Dead Code Injection**: Insert code that never executes (3 complexity levels)\n- **Control Flow Flattening**: Transform CFG into dispatcher pattern\n\n---\n\n## Examples\n\n### Basic Binary Analysis\n\n```python\nfrom r2morph import Binary\n\nwith Binary(\"/path/to/binary\") as binary:\n    binary.analyze()\n\n    functions = binary.get_functions()\n    print(f\"Found {len(functions)} functions\")\n\n    arch = binary.get_arch_info()\n    print(f\"Architecture: {arch['arch']} ({arch['bits']}-bit)\")\n```\n\n### Validation & Testing\n\n```python\nfrom r2morph.validation import BinaryValidator, MutationFuzzer\n\nvalidator = BinaryValidator()\nresult = validator.validate(original, mutated)\n\nfuzzer = MutationFuzzer(num_tests=100)\nfuzz_result = fuzzer.fuzz(original, mutated)\n```\n\n### Evasion Analysis\n\n```python\nfrom r2morph.detection import EvasionScorer\n\nscorer = EvasionScorer()\nscore = scorer.score(original, mutated)\nprint(score)\n```\n\n### Session Management\n\n```python\nfrom r2morph import MorphSession\n\nsession = MorphSession()\nsession.start(original)\n\nsession.checkpoint(\"stage1\")\nsession.apply_mutation(NopPass())\n\nsession.rollback_to(\"stage1\")\n\nsession.finalize(output)\n```\n\n### Custom Mutation Pass\n\n```python\nfrom r2morph.mutations.base import MutationPass\nfrom r2morph.core.binary import Binary\n\nclass MyCustomMutation(MutationPass):\n    def __init__(self):\n        super().__init__(name=\"MyCustomMutation\")\n\n    def apply(self, binary: Binary):\n        mutations_applied = 0\n\n        functions = binary.get_functions()\n        for func in functions:\n            pass\n\n        return {\n            \"mutations_applied\": mutations_applied,\n            \"custom_metric\": 42,\n        }\n\nengine.add_mutation(MyCustomMutation())\n```\n\nSee the `examples/` directory for complete examples:\n- `basic_analysis.py`: Simple binary analysis\n- `morph_binary.py`: Apply transformations to a binary\n- `advanced_analysis.py`: Advanced analysis features\n- `advanced_mutations.py`: Using advanced mutations\n\n---\n\n## Memory-Efficient Mode\n\nr2morph automatically detects large binaries and enables memory-efficient mode to prevent OOM crashes:\n\n### Automatic Detection\n- **Triggers**: Binaries >50MB or >3000 functions\n- **Batch Processing**: r2 restarts every 1000 mutations to free memory\n- **Conservative Limits**: Reduced mutations per function (2 instead of 5)\n- **Low-Memory r2 Config**: Disables caching (`bin.cache=false`, `io.cache=false`)\n\n### Example\n```bash\n# Automatically handles large binaries (e.g., Qt6WebEngineCore.dll - 148MB)\nr2morph large_binary.dll morphed.dll\n\n# Output:\n# Large binary detected (147.3 MB, 4261 functions)\n# Enabling memory-efficient mode to prevent OOM crashes\n# Batch checkpoint: 1000 mutations applied. Reloading r2 to free memory...\n```\n\n### Pipeline Integration\nMemory-efficient mode is **100% transparent** - no code changes needed. Just run r2morph normally and it will auto-detect and protect against OOM.\n\n---\n\n## Architecture\n\n```\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502   Binary    \u2502  \u2190 Load binary with r2pipe\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n       \u2502\n       \u25bc\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502  Analysis   \u2502  \u2190 Analyze with radare2\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n       \u2502\n       \u25bc\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502  Pipeline   \u2502  \u2190 Execute mutation passes\n\u2502             \u2502\n\u2502  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502\n\u2502  \u2502 Pass 1 \u2502 \u2502\n\u2502  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n\u2502  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502\n\u2502  \u2502 Pass 2 \u2502 \u2502\n\u2502  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n\u2502  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502\n\u2502  \u2502 Pass N \u2502 \u2502\n\u2502  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n       \u2502\n       \u25bc\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502   Output    \u2502  \u2190 Save morphed binary\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n### Module Structure\n\n```\nr2morph/\n\u251c\u2500\u2500 core/           # Binary abstraction, engine\n\u2502   \u251c\u2500\u2500 binary.py       # Binary abstraction\n\u2502   \u251c\u2500\u2500 engine.py       # Morphing engine\n\u2502   \u251c\u2500\u2500 function.py     # Function representation\n\u2502   \u2514\u2500\u2500 instruction.py  # Instruction representation\n\u251c\u2500\u2500 mutations/      # 8 mutation passes + ARM rules\n\u2502   \u251c\u2500\u2500 base.py                     # Base mutation class\n\u2502   \u251c\u2500\u2500 nop_insertion.py            # NOP insertion\n\u2502   \u251c\u2500\u2500 instruction_substitution.py # Instruction substitution\n\u2502   \u251c\u2500\u2500 register_substitution.py    # Register reassignment\n\u2502   \u251c\u2500\u2500 block_reordering.py         # Block reordering\n\u2502   \u251c\u2500\u2500 instruction_expansion.py    # Instruction expansion\n\u2502   \u251c\u2500\u2500 opaque_predicates.py        # Opaque predicates\n\u2502   \u251c\u2500\u2500 dead_code_injection.py      # Dead code injection\n\u2502   \u251c\u2500\u2500 control_flow_flattening.py  # CFG flattening\n\u2502   \u251c\u2500\u2500 arm_rules.py                # ARM equivalence patterns\n\u2502   \u2514\u2500\u2500 arm_expansion_rules.py      # ARM expansion patterns\n\u251c\u2500\u2500 analysis/       # CFG, dependencies, diff analysis\n\u2502   \u251c\u2500\u2500 analyzer.py      # Binary analyzer\n\u2502   \u251c\u2500\u2500 cfg.py           # Control flow graph\n\u2502   \u251c\u2500\u2500 dependencies.py  # Data dependencies\n\u2502   \u251c\u2500\u2500 invariants.py    # Code invariants\n\u2502   \u2514\u2500\u2500 diff_analyzer.py # Binary diff analysis\n\u251c\u2500\u2500 validation/     # Testing, fuzzing, regression\n\u2502   \u251c\u2500\u2500 validator.py     # Binary validator\n\u2502   \u251c\u2500\u2500 fuzzer.py        # Mutation fuzzer\n\u2502   \u2514\u2500\u2500 regression.py    # Regression tester\n\u251c\u2500\u2500 relocations/    # Code caves, reference updates\n\u2502   \u251c\u2500\u2500 manager.py           # Relocation manager\n\u2502   \u251c\u2500\u2500 cave_finder.py       # Code cave finder\n\u2502   \u2514\u2500\u2500 reference_updater.py # Reference updater\n\u251c\u2500\u2500 detection/      # Evasion scoring, entropy\n\u2502   \u251c\u2500\u2500 evasion_scorer.py    # Evasion scorer\n\u2502   \u251c\u2500\u2500 similarity_hasher.py # Fuzzy hashing\n\u2502   \u2514\u2500\u2500 entropy_analyzer.py  # Entropy analysis\n\u251c\u2500\u2500 platform/       # PE/ELF/Mach-O handlers, code signing\n\u2502   \u251c\u2500\u2500 codesign.py      # Code signing\n\u2502   \u251c\u2500\u2500 pe_handler.py    # PE format handler\n\u2502   \u251c\u2500\u2500 elf_handler.py   # ELF format handler\n\u2502   \u2514\u2500\u2500 macho_handler.py # Mach-O format handler\n\u251c\u2500\u2500 profiling/      # Hot path detection, profiling\n\u2502   \u251c\u2500\u2500 profiler.py          # Execution profiler\n\u2502   \u2514\u2500\u2500 hotpath_detector.py  # Hot path detector\n\u251c\u2500\u2500 pipeline/       # Pipeline orchestration\n\u2502   \u2514\u2500\u2500 pipeline.py      # Pipeline management\n\u251c\u2500\u2500 utils/          # Utilities\n\u2502   \u251c\u2500\u2500 logging.py       # Logging configuration\n\u2502   \u2514\u2500\u2500 assembler.py     # Assembly helpers\n\u251c\u2500\u2500 session.py      # Checkpoint & rollback\n\u2514\u2500\u2500 cli.py          # Command-line interface\n```\n\n---\n\n## Contributing\n\n### Creating a New Mutation Pass\n\n1. Create a new file in `r2morph/mutations/`\n2. Subclass `MutationPass`\n3. Implement the `apply()` method\n4. Add to `r2morph/mutations/__init__.py`\n\nExample:\n\n```python\nfrom r2morph.mutations.base import MutationPass\n\nclass MyMutation(MutationPass):\n    def __init__(self, config=None):\n        super().__init__(name=\"MyMutation\", config=config)\n\n    def apply(self, binary):\n        return {\"mutations_applied\": 0}\n```\n\n---\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## Disclaimer\n\n**This tool is for research and educational purposes only.** Users are responsible for ensuring they have proper authorization before analyzing or modifying any binary. The authors are not responsible for any misuse of this tool.\n\n---\n\n## Acknowledgments\n\n- Built on top of [radare2](https://github.com/radareorg/radare2)\n- Uses [r2pipe](https://github.com/radareorg/radare2-r2pipe) for radare2 integration\n- Inspired by metamorphic engine research\n\n---\n\n## Contact & Support\n\n- **Author**: Marc Rivero | [@seifreed](https://github.com/seifreed)\n- **Email**: mriverolopez@gmail.com\n- **Issues**: [GitHub Issues](https://github.com/seifreed/r2morph/issues)\n- **Repository**: https://github.com/seifreed/r2morph\n\n---\n\n## \ud83d\udcd6 Citation\n\nIf you use r2morph in your research, please cite:\n\n```bibtex\n@software{r2morph,\n  title = {r2morph: A Metamorphic Binary Transformation Engine},\n  author = {Marc Rivero},\n  year = {2025},\n  url = {https://github.com/seifreed/r2morph}\n}\n```\n\n---\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A metamorphic binary transformation engine based on r2pipe and radare2",
    "version": "0.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/seifreed/r2morph/issues",
        "Documentation": "https://github.com/seifreed/r2morph/blob/main/README.md",
        "Homepage": "https://github.com/seifreed/r2morph",
        "Issues": "https://github.com/seifreed/r2morph/issues",
        "Repository": "https://github.com/seifreed/r2morph",
        "Source Code": "https://github.com/seifreed/r2morph"
    },
    "split_keywords": [
        "binary-analysis",
        " metamorphic",
        " code-transformation",
        " radare2",
        " r2pipe",
        " reverse-engineering",
        " binary-mutation"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f48d96cb6182e0561f73a995c4fe83ae3fcda1a6a1a753c316b4ffd25b5bef2d",
                "md5": "f1656b8f8457d96cca42f1fb6cf7b106",
                "sha256": "5f781af156b81b702b1dd228e6e82badb94c92080edfa272fb7de8cf3e5ea326"
            },
            "downloads": -1,
            "filename": "r2morph-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f1656b8f8457d96cca42f1fb6cf7b106",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 94059,
            "upload_time": "2025-10-08T10:52:09",
            "upload_time_iso_8601": "2025-10-08T10:52:09.195452Z",
            "url": "https://files.pythonhosted.org/packages/f4/8d/96cb6182e0561f73a995c4fe83ae3fcda1a6a1a753c316b4ffd25b5bef2d/r2morph-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "dd832ceed714d8decc60639a37bcf35e300eb18f9194006bb88e3502429c89be",
                "md5": "4939f2639e5f8143331f7ff4f265c64d",
                "sha256": "4af27e9b1d52245d644db1ccdc5a09b9489962e57ed69b54dbe26ca55bc262bc"
            },
            "downloads": -1,
            "filename": "r2morph-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4939f2639e5f8143331f7ff4f265c64d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 75441,
            "upload_time": "2025-10-08T10:52:10",
            "upload_time_iso_8601": "2025-10-08T10:52:10.850248Z",
            "url": "https://files.pythonhosted.org/packages/dd/83/2ceed714d8decc60639a37bcf35e300eb18f9194006bb88e3502429c89be/r2morph-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-08 10:52:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "seifreed",
    "github_project": "r2morph",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "r2morph"
}
        
Elapsed time: 2.04418s