Astro~/0.3
** CLI / astro spp * PAGE 01 / 22
** Astro * CLI
** /cli/spp

astro spp

Space Packets, encode, decode, inspect, validate, stream.

Space Packet Protocol operations: encode, decode, inspect, validate, and stream CCSDS Space Packets (CCSDS 133.0-B-2).

Subcommands

CommandDescription
astro spp decodeDecode raw bytes into Space Packet fields
astro spp encodeConstruct a Space Packet from header fields and user data
astro spp inspectPretty-print an annotated packet breakdown with hex dump
astro spp validateCheck field ranges, length consistency, and optional CRC
astro spp streamDecode a stream of concatenated Space Packets
astro spp genGenerate synthetic Space Packets

Common flags

All subcommands that read input support:

FlagDefaultDescription
--inputhexInput format: hex (hex-encoded text) or bin (raw binary)

All subcommands that produce output support:

FlagDefaultDescription
--formatvariesOutput format: text, json, or hex

Input can be provided as a file argument or piped via stdin. Hex input accepts optional 0x prefix, spaces, and newlines.


astro spp decode

Decode a Space Packet from raw bytes, printing its header fields and user data.

astro spp decode [file] [flags]

Flags

FlagDefaultDescription
--inputhexInput format: hex or bin
--formattextOutput format: text, json, or hex
--crcfalseTreat the last 2 octets as a CRC-16-CCITT error control field and verify it

Without --crc the two CRC octets are indistinguishable from payload, so a packet built with astro spp encode --crc decodes with them shown at the end of its user data. Pass --crc to split them off and check them.

Examples

# Decode hex from stdin
echo "0064c000000361626364" | astro spp decode --input hex

# Decode with JSON output
echo "0064c000000361626364" | astro spp decode --input hex --format json

# Decode a binary file
astro spp decode --input bin packet.bin

# Round-trip a packet that carries a CRC
astro spp encode --apid 100 --type tm --data 61626364 --crc | astro spp decode --crc

astro spp encode

Construct a Space Packet from individual header fields and hex-encoded user data.

astro spp encode [flags]

Flags

FlagDefaultDescription
--apid0Application Process Identifier (0-2047)
--typetmPacket type: tm or tc
--data(required)User data as hex string
--seq-count0Sequence count (0-16383)
--seq-flags3Sequence flags (0=continuation, 1=first, 2=last, 3=unsegmented)
--crcfalseAppend CRC-16-CCITT error control field
--formathexOutput format: text, json, or hex

Examples

# Encode a TM packet
astro spp encode --apid 100 --type tm --data 68656c6c6f

# Encode a TC packet with CRC
astro spp encode --apid 42 --type tc --data a1b2c3d4 --crc

# Encode with JSON output
astro spp encode --apid 100 --type tm --data 61626364 --format json

astro spp inspect

Display an annotated breakdown of a Space Packet including header field table, user data hex dump, and full raw packet hex dump.

astro spp inspect [file] [flags]

Flags

FlagDefaultDescription
--inputhexInput format: hex or bin
--crcfalseTreat the last 2 octets as a CRC-16-CCITT error control field and verify it

Examples

# Inspect from hex stdin
echo "0064c000000361626364" | astro spp inspect --input hex

# Inspect a binary file
astro spp inspect --input bin packet.bin

# Inspect a packet that carries a CRC
astro spp encode --apid 100 --type tm --data 61626364 --crc | astro spp inspect --crc

Sample Output

Space Packet Inspector
────────────────────────────────────────────────────────────
Primary Header (6 bytes)
  Version .............. 0
  Type ................. 0 (TM)
  Secondary Header Flag  0
  APID ................. 100 (0x064)
  Sequence Flags ....... 3 (unsegmented)
  Sequence Count ....... 0
  Packet Data Length ... 3 (total packet: 10 bytes)
────────────────────────────────────────────────────────────
User Data (4 bytes)
  0000  61 62 63 64                                       |abcd|
────────────────────────────────────────────────────────────
Raw Packet (10 bytes)
  0000  00 64 c0 00 00 03 61 62  63 64                    |.d....abcd|

astro spp validate

Validate a Space Packet for CCSDS conformance: checks version, field ranges, packet length consistency, and optionally verifies the CRC-16-CCITT error control field.

astro spp validate [file] [flags]

Flags

FlagDefaultDescription
--inputhexInput format: hex or bin
--crcfalseVerify CRC-16-CCITT error control field

Examples

# Validate a packet
echo "0064c000000361626364" | astro spp validate --input hex

# Validate with CRC verification
astro spp encode --apid 100 --type tm --data a1b2c3d4 --crc | astro spp validate --input hex --crc

astro spp stream

Decode a stream of concatenated Space Packets, printing each packet as it is parsed. Useful for processing capture files containing multiple back-to-back packets.

astro spp stream [file] [flags]

Flags

FlagDefaultDescription
--inputhexInput format: hex or bin
--formattextOutput format: text, json, or hex
--crcfalseTreat the last 2 octets of each packet as a CRC-16-CCITT error control field and verify it

With --format json, each packet is printed as a single JSON line (NDJSON), suitable for piping to jq or other tools.

A stream of packets built with astro spp encode --crc needs --crc here too; otherwise every packet shows its CRC octets as the tail of its user data.

Examples

# Stream decode a binary capture
astro spp stream --input bin capture.bin

# Stream decode with JSON output for jq processing
astro spp stream --input bin capture.bin --format json | jq '.apid'

# Concatenate multiple encoded packets and stream decode
P1=$(astro spp encode --apid 100 --type tm --data aabb)
P2=$(astro spp encode --apid 200 --type tc --data ccdd)
echo "${P1}${P2}" | astro spp stream --input hex

astro spp gen

Generate a stream of synthetic Space Packets with incrementing sequence counts and random data.

astro spp gen [flags]

Flags

FlagDefaultDescription
--apid0Application Process Identifier (0-2047)
--typetmPacket type: tm or tc
--count10Number of packets to generate
--size64User data size in bytes per packet
--crcfalseAppend CRC-16-CCITT error control field
--formatbinOutput format: bin or hex

Examples

# Generate 10 TM packets of 64 bytes each
astro spp gen --apid 100 --count 10 --size 64

# Generate packets and pipe into stream
astro spp gen --apid 100 --count 50 --size 128 --format bin | astro spp stream --input bin

# Generate with a CRC
astro spp gen --apid 100 --count 5 --size 32 --crc

Piping

All commands support stdin/stdout piping for composability:

# Encode -> Inspect
astro spp encode --apid 255 --type tc --data 0102030405 | astro spp inspect --input hex

# Encode with CRC -> Validate CRC
astro spp encode --apid 100 --type tm --data a1b2c3d4 --crc | astro spp validate --input hex --crc

# Encode -> Decode as JSON
astro spp encode --apid 42 --type tm --data 0102030405 | astro spp decode --input hex --format json

See also: the protocol page for the standard and the Go API, and the conformance statement for what is and is not implemented.

** Conformance-tested CCSDS and ECSS protocols for building spacecraft and ground software. **PAGE 01 / 22