Aller au contenu

TUI — Terminal Interface

C3PO's default mode is an interactive TUI built with Textual. It provides multi-device management, command dispatch, and live log streaming in a rich terminal interface.


Layout

┌─────────────────────────────────────────────────────────┐
│  [Device 1] [Device 2] [Device 3]     ← Device Tabs    │
├────────────────────────────────┬────────────────────────┤
│                                │                        │
│   Device 1 Logs                │   Global Server Log    │
│   > system_info                │   [12:01] New conn...  │
│   chip: esp32                  │   [12:02] Probe sent   │
│   modules: network,recon       │   [12:03] Frame rx'd   │
│                                │                        │
│   Device 2 Logs                │                        │
│   > ping 8.8.8.8              │                        │
│   Reply: 23ms                  │                        │
│                                │                        │
├────────────────────────────────┴────────────────────────┤
│  [Alt+G Global] [Ctrl+L Clear] [Ctrl+Q Quit] [Tab ↹]   │
│  ❯ send abc12345 ping 8.8.8.8_                         │
└─────────────────────────────────────────────────────────┘
Zone ID Description
Top bar tab-bar Device tabs — one per connected agent
Left panel devices-panel Stacked per-device log panes
Right panel global-log Server-wide events (connections, errors)
Bottom bar input-container Shortcuts + command input

Keyboard Shortcuts

Key Action Description
Alt+G toggle_global Show/hide global log panel
Ctrl+L clear_global Clear the global log pane
Ctrl+Q quit Exit C3PO
Esc focus_input Move focus to command input
Tab tab_complete Auto-complete command/device/group

Commands

send — Dispatch Command to Device

send <target> <command> [args...]

Targets:

Target Example Description
Device ID send abc12345 ping 8.8.8.8 Single device
all send all system_mem All connected devices
group <name> send group floor2 system_reboot All devices in group

Examples:

# Ping from a specific device
send abc12345 ping 8.8.8.8

# Get memory status from all devices
send all system_mem

# Reboot a group
send group sensors system_reboot

# Start fake AP
send abc12345 fakeap_start MyNetwork

# Start camera
send cam01 cam_start

# CAN bus sniff
send candev can_sniff 500000

list — Show Connected Devices

list

Displays all devices with ID, IP, status, chip, modules, and connection time.

modules — Show ESP32 Commands

modules

Lists all available ESP32 commands organized by module:

  • system: system_reboot, system_mem, system_uptime
  • network: ping, arp_scan, proxy_start/stop, dos_tcp
  • fakeap: fakeap_start/stop/status/clients, fakeap_portal_start/stop, fakeap_sniffer_on/off
  • recon: cam_start/stop, mlat config/mode/start/stop/status
  • redteam: rt_hunt, rt_stop, rt_status, rt_scan, rt_net_add/list, rt_mesh
  • honeypot: hp_svc, hp_wifi, hp_net, hp_config_set/get/list/reset, hp_status
  • canbus: can_sniff/stop/filter/stats, can_send/flood, UDS (can_uds_*), OBD-II (can_obd_*), fuzzing (can_fuzz_*)
  • ota: ota_update, ota_status

group — Manage Device Groups

group add <name>                    # Create a group
group remove <name>                 # Delete a group
group add-device <group> <device>   # Add device to group
group remove-device <group> <device># Remove device from group
group list                          # List all groups
group show <name>                   # Show devices in group

Example workflow:

group add pentest-floor3
group add-device pentest-floor3 abc12345
group add-device pentest-floor3 def67890
send group pentest-floor3 arp_scan
group list

web — Control Web Dashboard

web start    # Start Flask web server
web stop     # Stop web server
web status   # Show web server state and URL

camera — Control Camera Receiver

camera start    # Start UDP receiver
camera stop     # Stop UDP receiver
camera status   # Show receiver state

can — CAN Bus Info

can              # Show CAN store stats
can stats        # Detailed statistics

active_commands — In-Flight Commands

active_commands

Shows all pending commands awaiting responses, with device ID, command name, and elapsed time.

help — Help System

help                     # Global help (all C2 + ESP commands)
help <command>           # Detailed help for a specific command
help send                # Usage for send command
help ping                # Usage for ESP ping command

Auto-Completion

Press Tab at any point to auto-complete:

Context Completions
Empty input send, list, modules, group, web, camera, help, ...
send Device IDs + all + group
send group Group names
send abc12345 ESP command names (ping, system_mem, ...)
group add, remove, add-device, remove-device, list, show
web start, stop, status

Workflows

Monitor Multiple Devices

  1. Launch C3PO: python c3po.py
  2. Wait for agents to connect (tabs appear automatically)
  3. list — verify all devices
  4. send all system_info — get chip/module info
  5. Toggle global log with Alt+G to see server events

Pentest Session

# Create operational group
group add target-net

# Add devices
group add-device target-net scanner1
group add-device target-net scanner2

# Recon
send group target-net arp_scan

# Launch fake AP on one device
send scanner1 fakeap_start FreeWiFi

# Monitor sniffer
send scanner1 fakeap_sniffer_on

# Check status
send scanner1 fakeap_status

CAN Bus Analysis

# Start sniffing
send candev can_sniff 500000

# Check stats in TUI
can stats

# View frames via web API
web start
# → Open http://localhost:8000/ota for build/deploy

TUI Styling

The TUI uses a custom TCSS stylesheet at tui/styles/c2.tcss with the ESPILON violet theme.

Element Color
Active tab #a855f7 (violet)
Device logs Dark background with syntax highlighting
Error messages #f87171 (red)
Success #4ade80 (green)
Input prompt #a855f7 (violet)

Next

For web-based control: Dashboard → For programmatic access: API Reference