# mufeedvh/basecrack architecture

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

- Interactive diagram: https://gitdiagram.com/mufeedvh/basecrack
- Repository: https://github.com/mufeedvh/basecrack

## Overview

#### Purpose and Entry Points
BaseCrack is a Python decoder for common alphanumeric base encodings, including recursively layered (“magic mode”) payloads and image-derived text/metadata. The primary executable and public library surface is `basecrack.py`; library consumers instantiate `BaseCrack` and call `decode()`. `api_example.py` demonstrates programmatic use. Packaging is defined by `setup.py`.

#### Command-Line Orchestration
`basecrack.py` is the control-plane entry point for interactive input and command-line modes: direct strings, files, magic decoding, image EXIF extraction, OCR, and optional output wordlists. It routes each selected mode into the decoding engine and owns user-facing argument handling and result presentation.
- `basecrack.py`
- `config.json`

#### Decode Engine and Scheme Identification
The core decoding logic is split between the main `BaseCrack` implementation and a chain-oriented module. The engine attempts supported schemes, identifies the successful encoding type, and returns decoded content plus its scheme label. This is the main boundary between CLI/API callers and individual codec implementations.
- `basecrack.py`
- `src/base_chain.py`
- `src/messages.py`

#### Recursive / Multi-Encoding Flow
Magic mode repeatedly applies decoding candidates to an input until it reaches a usable terminal value or no further valid transformation is found. The chain layer represents the architecture for sequencing candidate decoders and tracking multi-stage decoding rather than treating each input as a single isolated conversion.
- `src/base_chain.py`
- `basecrack.py`

#### Codec Layer
Standard Python-supported base formats are likely dispatched by the primary engine, while formats requiring custom algorithms are isolated under `src`. Base91 and Base92 therefore form a specialized codec boundary that can be invoked alongside standard Base16/32/36/58/62/64/85/100 variants.
- `src/base92.py`
- `src/base_chain.py`
- `src/__init__.py`

#### Batch and Image-Derived Inputs
The CLI accepts line-oriented files for batch decoding and can source candidate encoded strings from image EXIF metadata or OCR output. Image OCR depends on the external Tesseract runtime, accessed through Python dependencies; Windows-specific executable location is configured through `config.json`. Image processing is initiated from the central CLI/engine rather than a separate service.
- `basecrack.py`
- `config.json`
- `requirements.txt`

#### Runtime, Delivery, and Dependencies
This is a Python 3 application/library, distributable through `setup.py` and containerizable with `Dockerfile`. Its material external integration is Tesseract OCR (system executable and libraries) for image text detection; no server, database, or persistent infrastructure is represented in the repository tree.
- `requirements.txt`
- `setup.py`
- `Dockerfile`

Main entry points: [`basecrack.py`](https://github.com/mufeedvh/basecrack/blob/master/basecrack.py) (CLI orchestration), [`src/base_chain.py`](https://github.com/mufeedvh/basecrack/blob/master/src/base_chain.py) (Decode chain), [`Dockerfile`](https://github.com/mufeedvh/basecrack/tree/master/Dockerfile) (Container image), [`requirements.txt`](https://github.com/mufeedvh/basecrack/blob/master/requirements.txt) (Python dependencies)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry &amp; callers"]
  node_cli["CLI orchestration<br/>Python entry point<br/>[basecrack.py]"]
  node_library_api["BaseCrack API<br/>public library API<br/>[basecrack.py]"]
  node_api_example["Programmatic example<br/>API consumer<br/>[api_example.py]"]
  node_direct_batch_input["Strings and batch files<br/>input source<br/>[basecrack.py]"]
end

subgraph group_decode["Decode pipeline"]
  node_decode_engine["Decode engine<br/>scheme dispatcher<br/>[basecrack.py]"]
  node_magic_mode["Magic mode<br/>recursive decoder<br/>[basecrack.py]"]
  node_base_chain["Decode chain<br/>candidate sequencer<br/>[base_chain.py]"]
  node_standard_codecs["Standard base codecs<br/>codec implementations<br/>[basecrack.py]"]
  node_custom_codecs["Base91 / Base92 codecs<br/>custom codec<br/>[base92.py]"]
  node_messages["Result messages<br/>presentation support<br/>[messages.py]"]
end

subgraph group_image["Image input"]
  node_image_metadata["EXIF extraction<br/>image input<br/>[basecrack.py]"]
  node_ocr_input["OCR extraction<br/>image input<br/>[basecrack.py]"]
  node_tesseract{{"Tesseract OCR<br/>external runtime"}}
  node_ocr_config["OCR configuration<br/>runtime configuration<br/>[config.json]"]
end

subgraph group_delivery["Runtime &amp; delivery"]
  node_python_dependencies["Python dependencies<br/>dependency manifest<br/>[requirements.txt]"]
  node_package["Python package<br/>distribution definition<br/>[setup.py]"]
  node_container["Container image<br/>container build"]
end

node_api_example -->|"uses"| node_library_api
node_direct_batch_input -->|"selected input"| node_cli
node_cli -->|"dispatches"| node_decode_engine
node_library_api -->|"calls"| node_decode_engine
node_cli -->|"magic option"| node_magic_mode
node_magic_mode -->|"repeated candidates"| node_base_chain
node_decode_engine -->|"identifies scheme"| node_base_chain
node_base_chain -->|"tries"| node_standard_codecs
node_base_chain -->|"tries"| node_custom_codecs
node_decode_engine -->|"formats outcomes"| node_messages
node_image_metadata -->|"candidate text"| node_cli
node_ocr_input -->|"candidate text"| node_cli
node_cli -->|"EXIF mode"| node_image_metadata
node_cli -->|"OCR mode"| node_ocr_input
node_ocr_input -->|"invokes"| node_tesseract
node_ocr_config -.->|"configures location"| node_ocr_input
node_python_dependencies -.->|"provides libraries"| node_cli
node_package -->|"packages"| node_library_api
node_container -->|"installs"| node_python_dependencies
node_container -.->|"includes runtime"| node_tesseract

click node_cli "https://github.com/mufeedvh/basecrack/blob/master/basecrack.py"
click node_library_api "https://github.com/mufeedvh/basecrack/blob/master/basecrack.py"
click node_api_example "https://github.com/mufeedvh/basecrack/blob/master/api_example.py"
click node_direct_batch_input "https://github.com/mufeedvh/basecrack/blob/master/basecrack.py"
click node_decode_engine "https://github.com/mufeedvh/basecrack/blob/master/basecrack.py"
click node_magic_mode "https://github.com/mufeedvh/basecrack/blob/master/basecrack.py"
click node_base_chain "https://github.com/mufeedvh/basecrack/blob/master/src/base_chain.py"
click node_standard_codecs "https://github.com/mufeedvh/basecrack/blob/master/basecrack.py"
click node_custom_codecs "https://github.com/mufeedvh/basecrack/blob/master/src/base92.py"
click node_messages "https://github.com/mufeedvh/basecrack/blob/master/src/messages.py"
click node_image_metadata "https://github.com/mufeedvh/basecrack/blob/master/basecrack.py"
click node_ocr_input "https://github.com/mufeedvh/basecrack/blob/master/basecrack.py"
click node_ocr_config "https://github.com/mufeedvh/basecrack/blob/master/config.json"
click node_python_dependencies "https://github.com/mufeedvh/basecrack/blob/master/requirements.txt"
click node_package "https://github.com/mufeedvh/basecrack/blob/master/setup.py"
click node_container "https://github.com/mufeedvh/basecrack/tree/master/Dockerfile"

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_library_api,node_api_example,node_direct_batch_input toneBlue
class node_decode_engine,node_magic_mode,node_base_chain,node_standard_codecs,node_custom_codecs,node_messages toneAmber
class node_image_metadata,node_ocr_input,node_tesseract,node_ocr_config toneMint
class node_python_dependencies,node_package,node_container toneRose
```

## Components

### Entry & callers

- [CLI orchestration](https://github.com/mufeedvh/basecrack/blob/master/basecrack.py): Python entry point · Parses modes, presents results, and coordinates input sources. · `basecrack.py`
- [BaseCrack API](https://github.com/mufeedvh/basecrack/blob/master/basecrack.py): public library API · Consumers instantiate BaseCrack and call decode(). · `basecrack.py`
- [Programmatic example](https://github.com/mufeedvh/basecrack/blob/master/api_example.py): API consumer · `api_example.py`
- [Strings and batch files](https://github.com/mufeedvh/basecrack/blob/master/basecrack.py): input source · Direct values and line-oriented file inputs. · `basecrack.py`

### Decode pipeline

- [Decode engine](https://github.com/mufeedvh/basecrack/blob/master/basecrack.py): scheme dispatcher · Attempts supported encodings and returns content with its scheme label. · `basecrack.py`
- [Magic mode](https://github.com/mufeedvh/basecrack/blob/master/basecrack.py): recursive decoder · Continues transformations until a terminal value or no valid step remains. · `basecrack.py`
- [Decode chain](https://github.com/mufeedvh/basecrack/blob/master/src/base_chain.py): candidate sequencer · Sequences candidate decoders and tracks multi-stage transformations. · `src/base_chain.py`
- [Standard base codecs](https://github.com/mufeedvh/basecrack/blob/master/basecrack.py): codec implementations · Python-supported base format decoding dispatched by the engine. · `basecrack.py`
- [Base91 / Base92 codecs](https://github.com/mufeedvh/basecrack/blob/master/src/base92.py): custom codec · Specialized algorithms used alongside standard formats. · `src/base92.py`
- [Result messages](https://github.com/mufeedvh/basecrack/blob/master/src/messages.py): presentation support · `src/messages.py`

### Image input

- [EXIF extraction](https://github.com/mufeedvh/basecrack/blob/master/basecrack.py): image input · Extracts candidate encoded text from image metadata. · `basecrack.py`
- [OCR extraction](https://github.com/mufeedvh/basecrack/blob/master/basecrack.py): image input · Obtains candidate text from images through Tesseract. · `basecrack.py`
- **Tesseract OCR**: external runtime · System OCR executable and libraries.
- [OCR configuration](https://github.com/mufeedvh/basecrack/blob/master/config.json): runtime configuration · Contains Windows-specific Tesseract location settings. · `config.json`

### Runtime & delivery

- [Python dependencies](https://github.com/mufeedvh/basecrack/blob/master/requirements.txt): dependency manifest · `requirements.txt`
- [Python package](https://github.com/mufeedvh/basecrack/blob/master/setup.py): distribution definition · `setup.py`
- [Container image](https://github.com/mufeedvh/basecrack/tree/master/Dockerfile): container build · `Dockerfile`

## Connections

- Programmatic example → BaseCrack API: uses
- Strings and batch files → CLI orchestration: selected input
- CLI orchestration → Decode engine: dispatches
- BaseCrack API → Decode engine: calls
- CLI orchestration → Magic mode: magic option
- Magic mode → Decode chain: repeated candidates
- Decode engine → Decode chain: identifies scheme
- Decode chain → Standard base codecs: tries
- Decode chain → Base91 / Base92 codecs: tries
- Decode engine → Result messages: formats outcomes
- EXIF extraction → CLI orchestration: candidate text
- OCR extraction → CLI orchestration: candidate text
- CLI orchestration → EXIF extraction: EXIF mode
- CLI orchestration → OCR extraction: OCR mode
- OCR extraction → Tesseract OCR: invokes
- OCR configuration → OCR extraction: configures location
- Python dependencies → CLI orchestration: provides libraries
- Python package → BaseCrack API: packages
- Container image → Python dependencies: installs
- Container image → Tesseract OCR: includes runtime
