# hackerhouse-opensource/electionhacking architecture

> Architecture diagram of the GitHub repository hackerhouse-opensource/electionhacking, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hackerhouse-opensource/electionhacking
- Repository: https://github.com/hackerhouse-opensource/electionhacking

## Overview

- The “binpack” folder holds a multitude of executables that appear to serve numerous low-level functions (from device management to multimedia apps) that can be injected or executed on the target system.
- The “cf_card” folder contains files (including configuration files, executables, and even game/emulator demos like Doom and Invaders) that are meant to be copied onto a CompactFlash card formatted in FAT16. This is central to the injection process.
- Folders like “rom” and “extracted_certs” indicate that the project also involves analyzing or extracting data (firmware images, certificates, keys) from the system.
- The “diebold” folder includes configuration payloads and additional binaries aimed specifically at the Diebold system.
- The “utils” folder likely provides ancillary utilities for modifying or inspecting binary images (e.g., dumprom.exe, cvrtbin.exe).

##### Main Components
- External Interfaces:
– Hardware Debugger (e.g., an OpenOCD-compatible device like the TinCanTools FlySwatter 2)
– PCMCIA/CompactFlash Adapter – indicating the interface used to access the storage device
- Storage Media:
– CompactFlash Card – containing the “cf_card” contents which include custom executables and configuration files to be loaded onto the AccuVote TSx.
- System Firmware/ROM:
– The “rom” folder content (e.g., system.bin, nk.bin, registry_dump.txt) that represents the native firmware structure of the Diebold AccuVote TSx.
- Tools & Utilities:
– “binpack” executables – tools that perform various tasks on the target system (e.g., process management, networking utilities).
– “diebold” and “utils” tools – that support flashing or interfacing with the device.
- Security and Configuration:
– Extracted Certificates/Keys (“extracted_certs”) needed for authentication or for bypassing security in the official system software.

##### Relationships and Data Flows
- How the Hardware Debugger connects to the Diebold system for direct memory access or flashing.
- Flow where the “binpack” tools and additional utilities are used to extract, modify, or inject code into the device’s ROM or firmware.
- Relationship between the extracted certificates/keys and how they connect to the secure boot or authentication processes within the AccuVote TSx system.

##### Architectural Patterns and Design Principles
- The design mostly follows an injection or “firmware modification” architecture: a preparation phase on an external PC to produce a modifiable CompactFlash device, and an injection/execution phase on the embedded hardware.
- There is a clear separation between the preparation of tools/executables (“cf_card” and “binpack”), the hardware interfacing (debugger and adapter), and the operating environment inside the embedded system (firmware, ROM, system configuration).

##### Relevant Technologies and Tools
- OpenOCD and compatible debugging hardware for interfacing with the embedded device.
- WinCE (as inferred from the CF card formatting instructions and WinCE-specific executables/files) as the target OS.
- FAT16 (W95 FAT16 LBA) file system details for the CF card.
- Various executables (e.g., TaskMgrARM.exe, NesCE.exe, etc.) that illustrate the wide range of functionalities that can be injected.

##### Final Inclusions
- Document the role of each executable group and file grouping as they relate to the system’s modifications.
- “extensibility points” such as the role of the debugger interface and possible areas for injection or modification.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Preparation Environment
    subgraph "Preparation Environment"
        HW["Hacker Workstation"]:::prepenv
        BUTIL["Binpack Utilities"]:::prepenv
        DPAY["Diebold-Specific Payloads"]:::prepenv
        UTILS["Utilities for Binary/Image Modification"]:::prepenv
    end

    %% Interface Hardware
    subgraph "Interface Hardware"
        ADPT["PCMCIA/CompactFlash Adapter"]:::interface
        DBG["Hardware Debugger (OpenOCD)"]:::interface
    end

    %% Target System
    subgraph "Target System"
        CF["CompactFlash Card (FAT16)"]:::target
        FIRM["System Firmware/ROM"]:::target
        SEC["Extracted Certificates/Keys"]:::security
    end

    %% Data Flow / Relationships
    HW -->|"executes"| BUTIL
    HW -->|"executes"| DPAY
    HW -->|"executes"| UTILS
    BUTIL -->|"prepare_CF_card"| ADPT
    DPAY -->|"prepare_CF_card"| ADPT
    UTILS -->|"prepare_CF_card"| ADPT
    ADPT -->|"insert_CF_card"| CF
    HW -->|"deploy_payload"| DBG
    DBG -->|"flash_access_firmware"| FIRM
    CF -->|"load_modified_firmware"| FIRM
    SEC -->|"bypass_secure_boot"| FIRM

    %% Styles
    classDef prepenv fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef interface fill:#d4edda,stroke:#333,stroke-width:2px;
    classDef target fill:#fff3cd,stroke:#333,stroke-width:2px;
    classDef security fill:#f8d7da,stroke:#333,stroke-width:2px;

    %% Click Events
    click BUTIL "https://github.com/hackerhouse-opensource/electionhacking/tree/master/binpack"
    click CF "https://github.com/hackerhouse-opensource/electionhacking/tree/master/cf_card"
    click FIRM "https://github.com/hackerhouse-opensource/electionhacking/tree/master/rom"
    click DPAY "https://github.com/hackerhouse-opensource/electionhacking/tree/master/diebold"
    click SEC "https://github.com/hackerhouse-opensource/electionhacking/tree/master/extracted_certs"
    click UTILS "https://github.com/hackerhouse-opensource/electionhacking/tree/master/utils"
```
