# nullvaluez/pxtcher architecture

> Architecture diagram of the GitHub repository nullvaluez/pxtcher, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nullvaluez/pxtcher
- Repository: https://github.com/nullvaluez/pxtcher

## Overview

##### Project Type and Purpose
- pxtcher is a command-line tool designed to obfuscate and encrypt .NET assemblies. It protects against reverse engineering, including features like control flow obfuscation, encrypted strings, anti-tamper and anti-debugging measures. In addition, it provides a launcher script (written in Python) that uses PyArmor to wrap the executable, adding a further layer of security.

##### File Structure
- Key files include:
- DotNetObfuscator.csproj & DotNetObfuscator.sln: These indicate a standard .NET project.
- Program.cs: Contains the main application logic where most obfuscation and assembly processing is likely implemented.
- generateKey.ps1: A PowerShell script presumably dedicated to generating random encryption keys.
- launcher.py: A Python script that uses PyArmor and PyInstaller to wrap the main .NET executable.
- README.md & LICENSE: Provide project documentation and licensing.
- The simplicity of the file structure (single-project solution) suggests a consolidated design focused on a core obfuscation engine with some supportive scripts.

##### Key Components
a. Core Obfuscation and Encryption Engine (in .NET):
- .NET application (Program.cs) at the center.
- Sub-components or functions (as described in the README) such as:
- ProcessAssembly: Orchestrates the obfuscation.
- ObfuscateAndEncryptAssembly: Combine obfuscation and encryption.
- EncryptStrings & DecryptString: Handle string encryption.
- Methods for control flow obfuscation (e.g., InsertControlFlowObfuscation, InsertOpaquePredicates).
- Anti-tamper and anti-debugging features (e.g., AddAntiTamperCheck, AntiDebugging, EnvironmentChecks).

b. External Libraries & Dependencies:
- BouncyCastle: For encryption routines. Show its integration with the encryption functions.
- .NET SDK: Highlight that the project is built and run using the .NET framework.

c. Key Generation Component:
- generateKey.ps1: Display this as a utility that generates encryption keys, feeding into the encryption routines of the Core Engine.

d. Python Launcher & PyArmor Wrap:
- launcher.py: Represent the launcher as an intermediary that “wraps” the .NET executable.
- PyArmor (with PyInstaller): Illustrate the process where the launcher script generates a secure wrapper. Indicate the transition: launcher.py → PyArmor → Wrapped Executable.
- This component ties into the assembly’s output, ensuring additional protection when the executable is distributed.

e. User Interaction and CLI:
- The CLI commands (dotnet run …, etc.) should be explicitly noted.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction Layer
    subgraph "User Interaction"
        A["User Input (Assembly via CLI)"]:::cli
    end

    %% .NET Processing Layer
    subgraph ".NET Processing"
        B["Core Obfuscation Engine"]:::net
        B1["ProcessAssembly"]:::process
        B2["ObfuscateAndEncryptAssembly"]:::process
        B3["Encrypt/Decrypt Functions"]:::process
        B4["ControlFlow Obfuscation"]:::process
        B5["AntiTamper/AntiDebug"]:::process
    end

    %% External Dependencies
    subgraph "External Dependencies"
        C["Mono.Cecil"]:::external
        D["BouncyCastle"]:::external
        E[".NET SDK"]:::external
    end

    %% Utilities
    subgraph "Utilities"
        F["Key Generation Utility"]:::utility
        L["Project Config & Build Files"]:::config
        J["Documentation"]:::doc
        K["Licensing"]:::doc
    end

    %% Python Wrapping
    subgraph "Python Wrapping"
        G["Python Launcher"]:::python
        H["PyArmor Wrapper (via PyInstaller)"]:::python
    end

    %% Output
    I["Output (Obfuscated Assembly)"]:::output

    %% Connections for main data flow
    A -->|"provides assembly"| B
    F -->|"generates keys for"| B
    L -->|"configures build for"| B

    %% Internal .NET Engine breakdown
    B --> B1
    B --> B2
    B --> B3
    B --> B4
    B --> B5

    %% .NET Engine dependencies
    B -->|"manipulates assembly using"| C
    B -->|"encryption routines via"| D
    B -->|"built on"| E

    %% Output flow
    B -->|"produces executable"| I
    G -->|"wraps executable"| H
    H --> I

    %% User feedback to launcher (CLI trigger)
    A -.->|"CLI command triggers"| G

    %% Documentation context (informational)
    J ---|"refers to"| B
    K ---|"refers to"| B

    %% Styles
    classDef cli fill:#f9c74f,stroke:#000,stroke-width:1px;
    classDef net fill:#90be6d,stroke:#000,stroke-width:1px;
    classDef process fill:#f9844a,stroke:#000,stroke-width:1px;
    classDef external fill:#577590,stroke:#fff,stroke-width:1px;
    classDef utility fill:#f3722c,stroke:#000,stroke-width:1px;
    classDef config fill:#f9c74f,stroke:#000,stroke-width:1px;
    classDef python fill:#277da1,stroke:#fff,stroke-width:1px;
    classDef output fill:#43aa8b,stroke:#000,stroke-width:1px;
    classDef doc fill:#90be6d,stroke:#000,stroke-width:1px;

    %% Click Events
    click B "https://github.com/nullvaluez/pxtcher/blob/main/Program.cs"
    click L "https://github.com/nullvaluez/pxtcher/blob/main/DotNetObfuscator.csproj"
    click F "https://github.com/nullvaluez/pxtcher/blob/main/generateKey.ps1"
    click G "https://github.com/nullvaluez/pxtcher/blob/main/launcher.py"
    click J "https://github.com/nullvaluez/pxtcher/blob/main/README.md"
    click K "https://github.com/nullvaluez/pxtcher/tree/main/LICENSE"
```
