Skip to content

CLI Reference

tjnull edited this page Aug 11, 2026 · 2 revisions

CLI Reference

leetha [FLAGS] [SUBCOMMAND]

Invoking leetha without arguments drops into an interactive console with guided setup.


Top-Level Flags

Adapter selection

Flag Purpose
-i, --interface SPEC Attach to a network adapter. Repeatable. Spec format: name[:type[:label]]

Mode selection

Flag Purpose
start web Open the React web dashboard (replaced the older initialize command)
start cli Stream live packets to the terminal (replaced the older initialize command)
--decode Expand full protocol fields in start cli output
--filter EXPR Limit displayed packets by protocol name or mac=XX:XX:XX prefix
--on IFACE Restrict display output to a single adapter
--probe Run ServiceProbe plugins alongside passive capture. Enables active probing for deeper service enumeration on discovered endpoints

Web dashboard tuning

Flag Purpose
--host ADDR Dashboard listen address (default 0.0.0.0)
--port NUM Dashboard listen port (default 443)
--no-tls Disable TLS and serve over plain HTTP
--tls-cert PATH Path to a custom TLS certificate file
--tls-key PATH Path to a custom TLS private key file

Example Invocations

# React dashboard on the default adapter
leetha start web

# Dashboard bound to a specific adapter and port
leetha start web -i enp3s0 --port 9090

# Live CLI output with verbose decoding
leetha start cli --decode -i wlan0

# Multi-adapter capture with one VPN tunnel
leetha start web -i eth0 -i tun0:vpn:lab

# Protocol-filtered live view
leetha start cli --filter dhcpv4 -i tap0

# MAC-prefix filtered live view
leetha start cli --filter mac=00:1A:2B

Subcommands

sync -- Refresh Fingerprint Databases

leetha sync                        # pull all 12 sources
leetha sync --list                 # display each source with age and record count
leetha sync --source ja4           # update one source only

probe -- Interrogate a Single Endpoint

leetha probe 172.16.0.10:22       # identify the service on port 22
leetha probe 10.10.10.5:8443      # identify HTTPS variant

The probe subcommand creates a ServiceConnection, invokes the matching ServiceProbe.identify(conn), and prints the resulting ServiceIdentity.

override -- Pin Device Attributes Manually

leetha override show 00:11:22:33:44:55

leetha override set 00:11:22:33:44:55 \
    --device-type firewall \
    --manufacturer Fortinet \
    --os-family FortiOS \
    --os-version "7.4.1"

leetha override clear 00:11:22:33:44:55

Overrides are stored in the Store and take precedence over all automated verdicts.

device -- Custom Properties and Authorization

Manage the analyst-facing annotations on a device — owner, location, criticality, tags, notes — plus the tri-state authorization (approved / unapproved / rejected).

Custom properties (device set)

leetha device set 00:11:22:33:44:55 \
    --owner alice \
    --location "rack-03" \
    --criticality high \
    --tags "production,core" \
    --notes "primary edge router"

Flags accepted: --owner, --location, --criticality (one of low/medium/high/critical), --tags (comma-separated), --notes.

Tag helpers

leetha device tags add 00:11:22:33:44:55 dmz
leetha device tags remove 00:11:22:33:44:55 dmz

Tag adds are idempotent; removes of unknown tags are silent no-ops.

Authorization transitions

leetha device approve 00:11:22:33:44:55 --reason "onboarding"
leetha device reject  00:11:22:33:44:55 --reason "unrecognized"
leetha device revoke  00:11:22:33:44:55

All three commands write an audit row to authorization_history. The --actor flag records a custom actor string (defaults to cli). See Device Authorization for how these states change new_host finding severity.

baseline -- Learning Window

leetha baseline status              # learning state + authorization counts
leetha baseline finish              # stop learning now, start alerting
leetha baseline restart             # re-enter learning (e.g. a new network)
leetha baseline reset               # revoke every device back to unapproved
leetha baseline clear-attestations  # undo approvals from the removed bulk command

You normally do not need any of these. Leetha stays quiet while it is still learning the network and starts escalating once device discovery goes quiet, so a freshly-deployed sensor does not alert on the hosts that were already there.

baseline finish is for when you know the inventory is complete and would rather not wait for the quiet period. It is a policy action: it changes alerting posture and touches no device records.

Removed: leetha baseline set bulk-approved every device. Approval means "I know this device and leetha's fingerprint of it is accurate" -- a human attestation -- and applying it to hundreds of unreviewed devices recorded something untrue. Alert noise is handled by the learning window instead.

Stopping Leetha

From the interactive console, Ctrl+C stops whatever is running and returns you to the leetha> prompt -- so the first press stops the web dashboard, and a second exits leetha. exit (or Ctrl+D) shuts down the same way.

Run directly (leetha start web, leetha --web), a single Ctrl+C exits.

dhcp-leases -- DHCP Lease File Importer

Ingest a DHCP server's lease file to pre-populate the device inventory. Both ISC dhcpd (dhcpd.leases) and dnsmasq (dnsmasq.leases) formats are auto-detected.

# One-shot import
leetha dhcp-leases import /var/lib/dhcp/dhcpd.leases

# Configure the scheduled importer (re-reads periodically)
leetha dhcp-leases set-path /var/lib/dhcp/dhcpd.leases

Imported devices are flagged passively_observed=False until a real packet arrives for them, suppressing the new_host rule for devices that exist on paper but haven't been seen on the wire yet. See Inventory Sources for the importer framework.

patterns -- Manage Custom Fingerprint Patterns

leetha patterns list

# Match hostnames beginning with "PLC-"
leetha patterns add hostname \
    --pattern "^PLC-.*" \
    --device-type plc \
    --manufacturer "Allen-Bradley" \
    --confidence 90

# Match a DHCP vendor class string
leetha patterns add dhcp_opt60 \
    --key "Cisco AP" \
    --device-type access_point \
    --os-family IOS

# Match a MAC OUI prefix
leetha patterns add mac_prefix \
    --key "DC:A6:32" \
    --device-type sbc \
    --manufacturer "Raspberry Pi"

leetha patterns remove hostname 0

# Bulk export / import
leetha patterns export > custom_rules.json
leetha patterns import < custom_rules.json

Custom patterns are loaded by PatternLoader alongside the built-in JSON files in patterns/data/.

validate -- Check Data Integrity

leetha validate                    # execute every check
leetha validate --check oui        # verify OUI prefix accuracy
leetha validate --check manufacturer # cross-check vendor names
leetha validate --check stale      # flag outdated sources
leetha validate --verbose          # include per-host breakdown

interfaces -- Adapter Management

leetha interfaces list             # run scan_adapters and print results
leetha interfaces add wlan0        # persist adapter choice
leetha interfaces add tun0:vpn     # persist with classification
leetha interfaces remove wlan0     # drop from saved set
leetha interfaces show wlan0       # details for one adapter

Console Commands (Interactive Mode)

After launching leetha -i <adapter>, the REPL accepts:

Input Shortcut What It Does
help h / ? Print command listing
devices d / dev Tabulate discovered hosts from HostRepository
alerts a Display active findings and advisories
start web w Launch the React dashboard in-process
start cli l Switch to live packet streaming
sync s Trigger a database refresh
sources src Show each source with sync timestamp
status st Print adapter state, Store stats, and uptime
clear cls Wipe the terminal
exit quit / q Shut down Leetha

The console supports readline history and tab completion.

Exiting: Ctrl+C exits the console immediately (well under 1 ms) — SQLite WAL journaling makes abrupt exit safe, and capture/background tasks are daemon threads. If you want a graceful shutdown (close DB + drain queues), type exit or hit Ctrl+D at the prompt.

Clone this wiki locally