# mkst/zte-config-utility architecture

> Architecture diagram of the GitHub repository mkst/zte-config-utility, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mkst/zte-config-utility
- Repository: https://github.com/mkst/zte-config-utility

## Overview

ZCU is a Python utility for decoding and re-encoding ZTE router configuration binaries. The principal workflow takes a config.bin and produces XML; users can then encode XML back into a binary, optionally preserving headers and signatures. The README also describes automatic and known-key decoding, signature extraction, and several encryption/keying variants. The source excerpts show the format, compression, encryption, and key helpers, but not the example scripts that orchestrate them, so those internal call relationships are left unasserted.

Main entry points: [`examples/decode.py`](https://github.com/mkst/zte-config-utility/blob/master/examples/decode.py) (Decode config), [`examples/encode.py`](https://github.com/mkst/zte-config-utility/blob/master/examples/encode.py) (Encode config), [`examples/auto.py`](https://github.com/mkst/zte-config-utility/blob/master/examples/auto.py) (Auto decode), [`zcu/zte.py`](https://github.com/mkst/zte-config-utility/blob/master/zcu/zte.py) (ZTE framing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["User workflows"]
  node_decode["Decode config<br/>[decode.py]"]
  node_auto["Auto decode<br/>[auto.py]"]
  node_encode["Encode config<br/>[encode.py]"]
  node_signature["Inspect signature<br/>[signature.py]"]
end

subgraph group_format["Format processing"]
  node_zte["ZTE framing<br/>[zte.py]"]
  node_compression["Compression<br/>[compression.py]"]
  node_constants["Format constants<br/>[constants.py]"]
end

subgraph group_crypto["Keys and encryption"]
  node_keys["Known keys<br/>[known_keys.py]"]
  node_xcryptors["AES encryption<br/>[xcryptors.py]"]
end

node_user(("User"))
node_xml["XML config"]
node_binary["Config binary"]

node_user -->|"runs"| node_decode
node_decode -->|"reads"| node_binary
node_decode -->|"writes"| node_xml
node_user -->|"runs"| node_auto
node_auto -->|"reads"| node_binary
node_auto -->|"writes"| node_xml
node_user -->|"runs"| node_encode
node_encode -->|"reads"| node_xml
node_encode -->|"writes"| node_binary
node_user -->|"runs"| node_signature
node_signature -->|"reads"| node_binary
node_decode -.->|"resolves keys"| node_keys
node_decode -.->|"parses framing"| node_zte
node_decode -.->|"decompresses"| node_compression
node_decode -.->|"decrypts"| node_xcryptors
node_encode -.->|"adds framing"| node_zte
node_encode -.->|"compresses"| node_compression
node_encode -.->|"encrypts"| node_xcryptors
node_auto -.->|"tries known keys"| node_keys
node_zte -->|"uses markers"| node_constants
node_compression -->|"uses markers"| node_constants
node_xcryptors -->|"uses markers"| node_constants

click node_decode "https://github.com/mkst/zte-config-utility/blob/master/examples/decode.py"
click node_auto "https://github.com/mkst/zte-config-utility/blob/master/examples/auto.py"
click node_encode "https://github.com/mkst/zte-config-utility/blob/master/examples/encode.py"
click node_signature "https://github.com/mkst/zte-config-utility/blob/master/examples/signature.py"
click node_zte "https://github.com/mkst/zte-config-utility/blob/master/zcu/zte.py"
click node_compression "https://github.com/mkst/zte-config-utility/blob/master/zcu/compression.py"
click node_constants "https://github.com/mkst/zte-config-utility/blob/master/zcu/constants.py"
click node_keys "https://github.com/mkst/zte-config-utility/blob/master/zcu/known_keys.py"
click node_xcryptors "https://github.com/mkst/zte-config-utility/blob/master/zcu/xcryptors.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_decode,node_auto,node_encode,node_signature,node_user toneBlue
class node_zte,node_compression,node_constants toneAmber
class node_keys,node_xcryptors toneMint
class node_xml,node_binary toneIndigo
```

## Components

### User workflows

- [Decode config](https://github.com/mkst/zte-config-utility/blob/master/examples/decode.py): `examples/decode.py`
- [Auto decode](https://github.com/mkst/zte-config-utility/blob/master/examples/auto.py): `examples/auto.py`
- [Encode config](https://github.com/mkst/zte-config-utility/blob/master/examples/encode.py): `examples/encode.py`
- [Inspect signature](https://github.com/mkst/zte-config-utility/blob/master/examples/signature.py): `examples/signature.py`

### Format processing

- [ZTE framing](https://github.com/mkst/zte-config-utility/blob/master/zcu/zte.py): `zcu/zte.py`
- [Compression](https://github.com/mkst/zte-config-utility/blob/master/zcu/compression.py): `zcu/compression.py`
- [Format constants](https://github.com/mkst/zte-config-utility/blob/master/zcu/constants.py): `zcu/constants.py`

### Keys and encryption

- [Known keys](https://github.com/mkst/zte-config-utility/blob/master/zcu/known_keys.py): `zcu/known_keys.py`
- [AES encryption](https://github.com/mkst/zte-config-utility/blob/master/zcu/xcryptors.py): `zcu/xcryptors.py`

### Other components

- **User**
- **XML config**
- **Config binary**

## Connections

- User → Decode config: runs (evidence: `README.md`)
- Decode config → Config binary: reads (evidence: `README.md`)
- Decode config → XML config: writes (evidence: `README.md`)
- User → Auto decode: runs (evidence: `README.md`)
- Auto decode → Config binary: reads (evidence: `README.md`)
- Auto decode → XML config: writes (evidence: `README.md`)
- User → Encode config: runs (evidence: `README.md`)
- Encode config → XML config: reads (evidence: `README.md`)
- Encode config → Config binary: writes (evidence: `README.md`)
- User → Inspect signature: runs (evidence: `README.md`)
- Inspect signature → Config binary: reads (evidence: `README.md`)
- Decode config → Known keys: resolves keys
- Decode config → ZTE framing: parses framing
- Decode config → Compression: decompresses
- Decode config → AES encryption: decrypts
- Encode config → ZTE framing: adds framing
- Encode config → Compression: compresses
- Encode config → AES encryption: encrypts
- Auto decode → Known keys: tries known keys
- ZTE framing → Format constants: uses markers (evidence: `zcu/zte.py`)
- Compression → Format constants: uses markers (evidence: `zcu/compression.py`)
- AES encryption → Format constants: uses markers (evidence: `zcu/xcryptors.py`)
