v1.0.2-stable MIT License

Air-Gap Data Encoder

A forensic Python utility designed to exfiltrate data from isolated (air-gapped) systems by converting raw binary/text into a visual QR code stream.


1. Introduction

In high-security environments, systems are often "air-gapped" (physically isolated from the internet and USB ports). Moving data out of these systems is challenging.

The Air-Gap Encoder solves this by utilizing the system's display. It takes a payload (JSON, Text, or Files), chunks it into small packets, and renders them as a high-speed video of QR codes.

2. Technical Workflow

INPUT DATA (JSON/Text)

CHUNKING ALGORITHM (200 bytes/frame)

QR GENERATION (Error Correction Level: L)

OPENCV RENDERING (Frame Sequencing)

OUTPUT: .AVI Video Stream

3. System Requirements

You need Python 3.7+ installed. The script relies on opencv-python for video rendering and qrcode for matrix generation.

$ pip install opencv-python qrcode numpy

4. Usage Guide

Run the script directly from the terminal. You can modify the sample_data variable inside the script to change the payload.

$ python encoder.py
>> Initializing Encoder...
>> Total Chunks: 50
[+] Encoding Frame 1/50
[+] Encoding Frame 2/50
...
>> Video Sequence Complete. Saved as output.avi

5. Source Code

The core logic is open-source. You can review the implementation below before downloading.

encoder.py

import cv2
import qrcode
import numpy as np

# Configuration
CHUNK_SIZE = 200
OUTPUT_FILE = "evidence.avi"

def text_to_qr_video(data):
    print(f">> Processing {len(data)} bytes...")
    
    # Initialize Video Writer (XVID Codec)
    fourcc = cv2.VideoWriter_fourcc(*'XVID')
    out = cv2.VideoWriter(OUTPUT_FILE, fourcc, 2.0, (500, 500))
    
    # Split Data
    chunks = [data[i:i+CHUNK_SIZE] for i in range(0, len(data), CHUNK_SIZE)]

    for i, chunk in enumerate(chunks):
        # Create QR Matrix
        qr = qrcode.QRCode(box_size=10, border=4)
        qr.add_data(chunk)
        qr.make(fit=True)
        
        # Convert to Image Frame
        img = qr.make_image(fill='black', back_color='white')
        frame = np.array(img.convert('RGB'))
        frame = cv2.resize(frame, (500, 500))
        
        out.write(frame)
        
    out.release()
    print(">> Done.")
                    

Ready to deploy?

Download the standalone Python script.

Download Source (.py)