scapegoat

>_ scapegoat watch sensor

scapegoat

It speaks first, so the sensor starts sending.

Some sensors send nothing until a C2 system talks to them. scapegoat runs on a small computer on the sensor's network and plays that C2 side: it opens the link, keeps it alive and shows whether the sensor is answering. A protocol is a plugin, and the tracks a plugin reads go out as ASTERIX CAT062, CoT or SAPIENT.

$ python3 -m scapegoat sim toy --bind 127.0.0.1:47001 & python3 -m scapegoat serve --config deploy/scapegoat.toml

What it is

A sensor on a local network can wait for its C2 system to speak before it sends anything. scapegoat is that first voice. It runs as a systemd service on a Raspberry Pi or any Linux computer next to the sensor, with no internet access needed. It is part of goat: its tracks reach the data fabric as standard formats encoded by goat-transformers, and a whole node around it is built from one site file.

It speaks first and keeps the link alive

One UDP socket per sensor sends and receives. A keepalive goes to every candidate address until one answers; scapegoat then locks onto it and keeps the schedule going, even after the sensor goes quiet. scapegoat/core/session.py

It shows whether the sensor is answering

scapegoat status, events and watch on the command line, and the same view on a web page at 127.0.0.1:8730 with no build step. Every message is logged with its decoded fields and any problem found in it.

A protocol is a plugin

The core owns sockets, timers and state; a plugin builds and reads bytes and names its own device. The toy protocol and its simulator ship with the core, and scapegoat/conformance checks any plugin against the contract. docs/plugins.md

Every state change says why

The link moves through six states, and each move is an event with its reason. This is the event log from the session in the first screen: the simulator starts, is stopped, and starts again. scapegoat never stops sending, so the link comes back by itself.

disabled -> handshaking: socket open, sending keepaliveshandshaking -> establishing: first keepalive from peerestablishing -> established: 3 keepalives receivedestablished -> degraded: one keepalive from peer missed (3.9 s)degraded -> lost: no keepalive from peer for 6.8 s (two missed); still sending keepaliveslost -> establishing: peer keepalive after link lostestablishing -> established: 3 keepalives received

When more than one address could be the sensor, every one gets keepalives with its own counters until the first answers. scapegoat lock forces the choice; scapegoat reset starts over.

disabled handshaking establishing established lost degraded socket open first reply 3 replies 1 missed reply 2 missed reply keeps sending keepalives
The states and transitions in scapegoat/core/session.py. With the sim-local profile, three replies establish the link.

Tracks leave in standard formats

A protocol plugin that reads tracks from its sensor hands them to the core through one hook, tracks(msg). The core encodes each track with goat-transformers' published packs and sends it to every output you configure, over UDP (unicast or multicast) or to a Zenoh key. No format is encoded by hand, and the tests reproduce every CAT062 test vector in goat-transformers byte for byte.

Each output has its own enabled switch and optional session list. Without goat-transformers the outputs are off and scapegoat status says why.

[transformers]path = "/opt/goat-transformers" [outputs.cat062]format = "asterix-cat062"to = ["udp://239.255.62.1:8600", "zenoh:site/sensor/cat062"]sac = 1sic = 7
FormatSettings
asterix-cat062sac, sic
cot-xmlhow, stale_s, uid_prefix
sapientnode_id, uid_prefix

A whole node from one site file

deploy/field-node/ builds the computer scapegoat runs on: its addresses and network mode, scapegoat itself, capture of the sensor's traffic and goat-transformers at a pinned version. On the node, scapegoat net is a read-only view of interfaces, routes, neighbors, listeners and firewall, with a plain-language hint for each problem it finds. Changes to the network need allow_net_control = true in the config and --confirm on the command.

Installs offline

sudo ./deploy/install.sh puts the program in /opt/scapegoat, the config in /etc/scapegoat/scapegoat.toml and the scapegoat service under systemd. Nothing is downloaded.

Profiles hold the defaults

A site config names a profile and writes only what differs at that site. scapegoat profiles lists them; a plugin adds its own.

Simulators for every protocol

scapegoat sim toy is a peer that waits to be spoken to first, the way a real sensor does. The first screen of this page is scapegoat talking to it.

Quick start

Python 3.11 or newer on Linux or macOS. Nothing else to install.

git clone https://github.com/USAREUR-AF/scapegoat
cd scapegoat
python3 -m scapegoat sim toy --bind 127.0.0.1:47001 &
python3 -m scapegoat serve --config deploy/scapegoat.toml &
python3 -m scapegoat status
python3 -m scapegoat watch sensor

Then open http://127.0.0.1:8730. Tests: python3 -m unittest discover -s tests -t .

README · Writing a protocol plugin · Field node