# srlabs/blue-merle architecture

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

- Interactive diagram: https://gitdiagram.com/srlabs/blue-merle
- Repository: https://github.com/srlabs/blue-merle

## Overview

blue-merle is an OpenWrt package for reducing traceability on the GL-E750 Mudi router. Its main workflow changes the modem IMEI through CLI, hardware-switch, or LuCI entry points; the switch flow has two stages, while the web flow initiates a randomized update. Separate capabilities randomize Wi-Fi identifiers and remove MAC logs. The README and excerpts establish these feature branches, but most shell implementations were not sampled, so uncertain links are omitted or marked unverified.

Main entry points: [`files/lib/blue-merle/imei_generate.py`](https://github.com/srlabs/blue-merle/blob/main/files/lib/blue-merle/imei_generate.py) (IMEI generator), [`files/usr/bin/blue-merle`](https://github.com/srlabs/blue-merle/blob/main/files/usr/bin/blue-merle) (CLI command), [`files/usr/bin/blue-merle-switch-stage1`](https://github.com/srlabs/blue-merle/blob/main/files/usr/bin/blue-merle-switch-stage1) (Switch stage one), [`files/usr/bin/blue-merle-switch-stage2`](https://github.com/srlabs/blue-merle/blob/main/files/usr/bin/blue-merle-switch-stage2) (Switch stage two)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_cli["CLI command"]
  node_switch1["Switch stage one"]
  node_switch2["Switch stage two"]
  node_luci["LuCI interface<br/>[blue-merle.js]"]
end

subgraph group_imei["IMEI update"]
  node_imeigen["IMEI generator<br/>[imei_generate.py]"]
  node_modem{{"LTE modem"}}
  node_exec["Web command helper"]
end

subgraph group_privacy["Network privacy"]
  node_bssid["BSSID randomizer<br/>[functions.sh]"]
  node_macrandom["MAC randomizer<br/>[functions.sh]"]
  node_logwipe["MAC log wiper<br/>[functions.sh]"]
end

subgraph group_platform["Router integration"]
  node_boot["Boot integration<br/>[blue-merle]"]
  node_switchconfig["Switch integration<br/>[sim.sh]"]
  node_simcommand["SIM switch command"]
end

node_user(("Router user"))

node_user -->|"runs"| node_cli
node_user -->|"flips switch"| node_switch1
node_user -->|"opens"| node_luci
node_cli -->|"updates IMEI"| node_imeigen
node_switch1 -->|"continues stage"| node_switch2
node_switch2 -->|"sets randomized IMEI"| node_imeigen
node_luci -->|"executes command"| node_exec
node_exec -.->|"dispatches update"| node_imeigen
node_imeigen -->|"sends AT commands"| node_modem
node_boot -->|"randomizes on boot"| node_bssid
node_switchconfig -.->|"invokes"| node_simcommand

click node_cli "https://github.com/srlabs/blue-merle/blob/main/files/usr/bin/blue-merle"
click node_switch1 "https://github.com/srlabs/blue-merle/blob/main/files/usr/bin/blue-merle-switch-stage1"
click node_switch2 "https://github.com/srlabs/blue-merle/blob/main/files/usr/bin/blue-merle-switch-stage2"
click node_luci "https://github.com/srlabs/blue-merle/blob/main/files/www/luci-static/resources/view/blue-merle.js"
click node_imeigen "https://github.com/srlabs/blue-merle/blob/main/files/lib/blue-merle/imei_generate.py"
click node_exec "https://github.com/srlabs/blue-merle/blob/main/files/usr/libexec/blue-merle"
click node_bssid "https://github.com/srlabs/blue-merle/blob/main/files/lib/blue-merle/functions.sh"
click node_macrandom "https://github.com/srlabs/blue-merle/blob/main/files/lib/blue-merle/functions.sh"
click node_logwipe "https://github.com/srlabs/blue-merle/blob/main/files/lib/blue-merle/functions.sh"
click node_boot "https://github.com/srlabs/blue-merle/blob/main/files/etc/init.d/blue-merle"
click node_switchconfig "https://github.com/srlabs/blue-merle/blob/main/files/etc/gl-switch.d/sim.sh"
click node_simcommand "https://github.com/srlabs/blue-merle/blob/main/files/usr/bin/sim_switch"

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_cli,node_switch1,node_switch2,node_luci,node_user toneBlue
class node_imeigen,node_modem,node_exec toneAmber
class node_bssid,node_macrandom,node_logwipe toneMint
class node_boot,node_switchconfig,node_simcommand toneRose
```

## Components

### User entry points

- [CLI command](https://github.com/srlabs/blue-merle/blob/main/files/usr/bin/blue-merle): `files/usr/bin/blue-merle`
- [Switch stage one](https://github.com/srlabs/blue-merle/blob/main/files/usr/bin/blue-merle-switch-stage1): `files/usr/bin/blue-merle-switch-stage1`
- [Switch stage two](https://github.com/srlabs/blue-merle/blob/main/files/usr/bin/blue-merle-switch-stage2): `files/usr/bin/blue-merle-switch-stage2`
- [LuCI interface](https://github.com/srlabs/blue-merle/blob/main/files/www/luci-static/resources/view/blue-merle.js): `files/www/luci-static/resources/view/blue-merle.js`

### IMEI update

- [IMEI generator](https://github.com/srlabs/blue-merle/blob/main/files/lib/blue-merle/imei_generate.py): `files/lib/blue-merle/imei_generate.py`
- **LTE modem**
- [Web command helper](https://github.com/srlabs/blue-merle/blob/main/files/usr/libexec/blue-merle): `files/usr/libexec/blue-merle`

### Network privacy

- [BSSID randomizer](https://github.com/srlabs/blue-merle/blob/main/files/lib/blue-merle/functions.sh): `files/lib/blue-merle/functions.sh`
- [MAC randomizer](https://github.com/srlabs/blue-merle/blob/main/files/lib/blue-merle/functions.sh): `files/lib/blue-merle/functions.sh`
- [MAC log wiper](https://github.com/srlabs/blue-merle/blob/main/files/lib/blue-merle/functions.sh): `files/lib/blue-merle/functions.sh`

### Router integration

- [Boot integration](https://github.com/srlabs/blue-merle/blob/main/files/etc/init.d/blue-merle): `files/etc/init.d/blue-merle`
- [Switch integration](https://github.com/srlabs/blue-merle/blob/main/files/etc/gl-switch.d/sim.sh): `files/etc/gl-switch.d/sim.sh`
- [SIM switch command](https://github.com/srlabs/blue-merle/blob/main/files/usr/bin/sim_switch): `files/usr/bin/sim_switch`

### Other components

- **Router user**

## Connections

- Router user → CLI command: runs (evidence: `README.md`)
- Router user → Switch stage one: flips switch (evidence: `README.md`)
- Router user → LuCI interface: opens (evidence: `README.md`)
- CLI command → IMEI generator: updates IMEI (evidence: `README.md`)
- Switch stage one → Switch stage two: continues stage (evidence: `README.md`)
- Switch stage two → IMEI generator: sets randomized IMEI (evidence: `README.md`)
- LuCI interface → Web command helper: executes command (evidence: `files/www/luci-static/resources/view/blue-merle.js`)
- Web command helper → IMEI generator: dispatches update
- IMEI generator → LTE modem: sends AT commands (evidence: `files/lib/blue-merle/imei_generate.py`)
- Boot integration → BSSID randomizer: randomizes on boot (evidence: `README.md`)
- Switch integration → SIM switch command: invokes
