#! /usr/bin/env bash
#
# Replace fields from "zeekctl peerstatus" output that are not predictable
# with Xs.

awk '{
    if ( $1 ~ /^[0-9]+\.[0-9]+$/ )
    {
        $1 = "XXXXXXXXXX.XXXXXX"

        if ( $2 ~ /^peer=/ ) { $2 = "peer=X" }
        if ( $3 ~ /^host=(::1|127\.0\.0\.1)$/ ) { $3 = "host=X" }
        if ( $4 ~ /^events_in=[0-9]+$/ ) { $4 = "events_in=X" }
        if ( $5 ~ /^events_out=[0-9]+$/ ) { $5 = "events_out=X" }
        if ( $6 ~ /^ops_in=[0-9]+$/ ) { $6 = "ops_in=X" }
        if ( $7 ~ /^ops_out=[0-9]+$/ ) { $7 = "ops_out=X" }
    }

    print
}'
