# nerdtiv/widig architecture

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

- Interactive diagram: https://gitdiagram.com/nerdtiv/widig
- Repository: https://github.com/nerdtiv/widig

## Overview

WiDig is a Ghidra-focused tool for loading TI WiLink Wi-Fi firmware and Bluetooth initialization scripts, then recovering useful code and symbols. The main workflow is to open a firmware blob in Ghidra, map its chunks and metadata, and optionally run a naming pass; BTS files instead yield Bluetooth patch code and write labels. Python scripts provide parallel parsing and loading workflows, while a symbol-transfer module supports replaying exported Ghidra symbols in IDA. Relationships below are limited to the README and shown source references/calls; unsampled implementation details are not inferred.

Main entry points: [`Ghidra/loader/src/main/java/wltools/wl/WL18xxLoader.java`](https://github.com/nerdtiv/widig/blob/main/Ghidra/loader/src/main/java/wltools/wl/WL18xxLoader.java) (Wi-Fi firmware loader), [`Ghidra/loader/src/main/java/wltools/wl/WlBtsLoader.java`](https://github.com/nerdtiv/widig/blob/main/Ghidra/loader/src/main/java/wltools/wl/WlBtsLoader.java) (Bluetooth BTS loader), [`Ghidra/scripts/ghidra_wl.py`](https://github.com/nerdtiv/widig/blob/main/Ghidra/scripts/ghidra_wl.py) (Wi-Fi load and naming), [`Ghidra/scripts/ghidra_bts.py`](https://github.com/nerdtiv/widig/blob/main/Ghidra/scripts/ghidra_bts.py) (Bluetooth patch loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_formats["Format parsing"]
  node_wl_java_parse["WiLink and BTS parser<br/>[WlFirmware.java]"]
  node_wl_python_parse["Python format parser<br/>[wl_fw.py]"]
end

subgraph group_loaders["Ghidra loaders"]
  node_loader_util["Loader utilities<br/>[LoaderUtil.java]"]
  node_wifi_loader["Wi-Fi firmware loader<br/>[WL18xxLoader.java]"]
  node_bt_loader["Bluetooth BTS loader<br/>[WlBtsLoader.java]"]
end

subgraph group_scripts["Analysis scripts"]
  node_wifi_script["Wi-Fi load and naming<br/>[ghidra_wl.py]"]
  node_bt_script["Bluetooth patch loader<br/>[ghidra_bts.py]"]
end

subgraph group_symbols["Symbol transfer"]
  node_symbol_io["Symbol export and apply<br/>[symbols_io.py]"]
  node_ghidra_symbols["Ghidra symbols"]
  node_symbol_json["Symbol JSON"]
end

node_user(("Firmware analyst"))
node_ghidra["Ghidra"]
node_ida["IDA"]

node_user -->|"opens blob"| node_ghidra
node_ghidra -->|"selects format"| node_wifi_loader
node_ghidra -->|"selects format"| node_bt_loader
node_wifi_loader -->|"parses chunks"| node_wl_java_parse
node_wifi_loader -->|"reads and maps"| node_loader_util
node_bt_loader -->|"extracts patches"| node_wl_java_parse
node_bt_loader -->|"reads and maps"| node_loader_util
node_user -->|"runs naming pass"| node_wifi_script
node_wifi_script -->|"parses firmware"| node_wl_python_parse
node_wifi_script -->|"loads and names"| node_ghidra
node_user -->|"runs patch workflow"| node_bt_script
node_bt_script -->|"extracts blobs"| node_wl_python_parse
node_bt_script -->|"loads patch code"| node_ghidra
node_ghidra_symbols -->|"exports symbols"| node_symbol_io
node_symbol_io -->|"writes or reads"| node_symbol_json
node_symbol_io -->|"applies symbols"| node_ida

click node_wl_java_parse "https://github.com/nerdtiv/widig/blob/main/Ghidra/loader/src/main/java/wltools/wl/WlFirmware.java"
click node_wl_python_parse "https://github.com/nerdtiv/widig/blob/main/Ghidra/scripts/wl_fw.py"
click node_loader_util "https://github.com/nerdtiv/widig/blob/main/Ghidra/loader/src/main/java/wltools/wl/LoaderUtil.java"
click node_wifi_loader "https://github.com/nerdtiv/widig/blob/main/Ghidra/loader/src/main/java/wltools/wl/WL18xxLoader.java"
click node_bt_loader "https://github.com/nerdtiv/widig/blob/main/Ghidra/loader/src/main/java/wltools/wl/WlBtsLoader.java"
click node_wifi_script "https://github.com/nerdtiv/widig/blob/main/Ghidra/scripts/ghidra_wl.py"
click node_bt_script "https://github.com/nerdtiv/widig/blob/main/Ghidra/scripts/ghidra_bts.py"
click node_symbol_io "https://github.com/nerdtiv/widig/blob/main/Ghidra/scripts/symbols_io.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_wl_java_parse,node_wl_python_parse toneBlue
class node_loader_util,node_wifi_loader,node_bt_loader toneAmber
class node_wifi_script,node_bt_script toneMint
class node_symbol_io,node_ghidra_symbols,node_symbol_json toneRose
class node_user,node_ghidra,node_ida toneIndigo
```

## Components

### Format parsing

- [WiLink and BTS parser](https://github.com/nerdtiv/widig/blob/main/Ghidra/loader/src/main/java/wltools/wl/WlFirmware.java): `Ghidra/loader/src/main/java/wltools/wl/WlFirmware.java`
- [Python format parser](https://github.com/nerdtiv/widig/blob/main/Ghidra/scripts/wl_fw.py): `Ghidra/scripts/wl_fw.py`

### Ghidra loaders

- [Loader utilities](https://github.com/nerdtiv/widig/blob/main/Ghidra/loader/src/main/java/wltools/wl/LoaderUtil.java): `Ghidra/loader/src/main/java/wltools/wl/LoaderUtil.java`
- [Wi-Fi firmware loader](https://github.com/nerdtiv/widig/blob/main/Ghidra/loader/src/main/java/wltools/wl/WL18xxLoader.java): `Ghidra/loader/src/main/java/wltools/wl/WL18xxLoader.java`
- [Bluetooth BTS loader](https://github.com/nerdtiv/widig/blob/main/Ghidra/loader/src/main/java/wltools/wl/WlBtsLoader.java): `Ghidra/loader/src/main/java/wltools/wl/WlBtsLoader.java`

### Analysis scripts

- [Wi-Fi load and naming](https://github.com/nerdtiv/widig/blob/main/Ghidra/scripts/ghidra_wl.py): `Ghidra/scripts/ghidra_wl.py`
- [Bluetooth patch loader](https://github.com/nerdtiv/widig/blob/main/Ghidra/scripts/ghidra_bts.py): `Ghidra/scripts/ghidra_bts.py`

### Symbol transfer

- [Symbol export and apply](https://github.com/nerdtiv/widig/blob/main/Ghidra/scripts/symbols_io.py): `Ghidra/scripts/symbols_io.py`
- **Ghidra symbols**
- **Symbol JSON**

### Other components

- **Firmware analyst**
- **Ghidra**
- **IDA**

## Connections

- Firmware analyst → Ghidra: opens blob (evidence: `README.md`)
- Ghidra → Wi-Fi firmware loader: selects format (evidence: `README.md`)
- Ghidra → Bluetooth BTS loader: selects format (evidence: `README.md`)
- Wi-Fi firmware loader → WiLink and BTS parser: parses chunks (evidence: `Ghidra/loader/src/main/java/wltools/wl/WL18xxLoader.java`)
- Wi-Fi firmware loader → Loader utilities: reads and maps (evidence: `Ghidra/loader/src/main/java/wltools/wl/WL18xxLoader.java`)
- Bluetooth BTS loader → WiLink and BTS parser: extracts patches (evidence: `Ghidra/loader/src/main/java/wltools/wl/WlBtsLoader.java`)
- Bluetooth BTS loader → Loader utilities: reads and maps (evidence: `Ghidra/loader/src/main/java/wltools/wl/WlBtsLoader.java`)
- Firmware analyst → Wi-Fi load and naming: runs naming pass (evidence: `README.md`)
- Wi-Fi load and naming → Python format parser: parses firmware (evidence: `Ghidra/scripts/ghidra_wl.py`)
- Wi-Fi load and naming → Ghidra: loads and names (evidence: `Ghidra/scripts/ghidra_wl.py`)
- Firmware analyst → Bluetooth patch loader: runs patch workflow
- Bluetooth patch loader → Python format parser: extracts blobs (evidence: `Ghidra/scripts/ghidra_bts.py`)
- Bluetooth patch loader → Ghidra: loads patch code (evidence: `Ghidra/scripts/ghidra_bts.py`)
- Ghidra symbols → Symbol export and apply: exports symbols (evidence: `Ghidra/scripts/symbols_io.py`)
- Symbol export and apply → Symbol JSON: writes or reads (evidence: `Ghidra/scripts/symbols_io.py`)
- Symbol export and apply → IDA: applies symbols (evidence: `Ghidra/scripts/symbols_io.py`)
