Skip to content

petro-byte/constrained-channel-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Constrained Channel Lab

Experimental toolkit for encoding and transporting binary data across constrained or filtered communication channels.

Overview

This repository explores how binary data (e.g. ZIP archives) can be transferred through channels that only allow text or heavily restricted file formats.

Instead of relying on traditional file transfer mechanisms, this project demonstrates how data can be:

  • encoded into text representations
  • transported through constrained environments
  • reconstructed on the receiving side

It combines Python and Excel/VBA implementations to simulate real-world interoperability across heterogeneous systems.

Motivation

In many real-world environments, direct binary file transfer is not possible.

Examples include systems where:

  • only text fields are available
  • file uploads are restricted or filtered
  • data must pass through logging systems
  • clipboard-only workflows are enforced
  • legacy tools (e.g. Excel) act as data interfaces
  • certain file types are blocked entirely

In these situations, binary data must be transformed into a text-compatible representation before it can be transported.

This project explores how such pipelines can be built in a:

  • robust
  • reproducible
  • cross-platform

way — while staying compatible with constrained systems.

Core Components

1. Channel Text Codec

A streaming encoder/decoder that converts binary data into:

  • Base64
  • Hexadecimal

Features:

  • streaming processing (handles large files)
  • no inserted line breaks (channel-safe)
  • tolerant decoding (handles noisy input)
  • Python ↔ VBA compatibility

2. PDF Carrier Codec

A format-aware embedding mechanism that:

  • appends binary payloads to PDF files
  • extracts embedded payloads reliably
  • verifies integrity via CRC32

Concept:

ZIP → PDF (carrier) → ZIP

Key Features

  • Streaming Base64 / Hex encoding (no memory blowups)
  • Excel VBA + Python interoperability
  • PDF-based payload embedding with integrity checks (CRC32)
  • Fully reproducible demo pipeline
  • SHA-256 checksum validation for all artifacts

Repository Structure

constrained-channel-lab/
├── python/                  # Python CLI codec
├── vba/                     # Excel VBA modules
├── samples/                 # Input samples
├── demo_output/             # Generated demo artifacts
├── checksums/               # SHA256 verification
├── ConstrainedChannelLab_Demo.xlsm
└── generate_checksums.sh

Quick Start

Option 1 — Excel Demo (Recommended)

  1. Open:

    ConstrainedChannelLab_Demo.xlsm
    
  2. Enable macros

  3. Use the UI buttons:

  • Encode ZIP → Text
  • Encode Text → ZIP
  • Embed ZIP into PDF
  • Extract ZIP from PDF
  1. Select files from /samples

This is the fastest way to explore the system end-to-end.

Option 2 — Python CLI

Encode (Base64)

python python/channel_text_codec.py encode input.zip output.txt --mode base64

Decode (Base64)

python python/channel_text_codec.py decode output.txt reconstructed.zip --mode base64

Hex Mode

--mode hex

VBA Usage

Import modules into Excel:

  • ChannelTextCodec.bas
  • PdfCarrierCodec.bas

Steps:

  1. Open Excel VBA Editor (ALT + F11)
  2. Import .bas files
  3. Run macros or connect them to UI buttons

Demo Pipelines

Text Channel Pipeline

ZIP → Base64 TXT → ZIP

PDF Carrier Pipeline

ZIP → Embedded into PDF → Extracted ZIP

Pre-generated outputs are available in:

/demo_output/

Checksums & Reproducibility

To ensure reproducibility and integrity:

bash generate_checksums.sh

Output:

checksums/SHA256SUMS.txt

This allows you to verify that:

  • encoded/decoded files are identical
  • pipelines behave deterministically
  • demo artifacts are reproducible

Design Principles

The project was built with the following goals:

  • compatibility across languages (Python ↔ VBA)
  • streaming processing for large files
  • tolerance for noisy or lossy text channels
  • minimal dependencies
  • clear and inspectable implementation

Security Perspective

Constrained data channels appear in many areas of systems engineering and cybersecurity:

  • restricted enterprise environments
  • incident response setups
  • malware analysis labs
  • embedded debugging pipelines
  • legacy infrastructure

Understanding how data can be:

  • encoded
  • transported
  • reconstructed

across such channels is a valuable engineering skill — both for defensive and analytical purposes.

Example Scenario

Binary File
     ↓
Encoding (Base64 / Hex)
     ↓
Constrained Channel (Text-only)
     ↓
Decoding
     ↓
Original File

Disclaimer

This project is intended for educational and experimental purposes only.

Do not use it to bypass organizational policies or exfiltrate sensitive data.

Author

Luka Petrovic

About

Experimental toolkit for encoding and transporting binary data across constrained or text-only communication channels (Python + VBA, Base64/Hex, PDF carrier).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors