File: diff-peerstatus-output

package info (click to toggle)
zeekctl 2.2.0%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,544 kB
  • sloc: python: 5,639; sh: 1,374; makefile: 71; awk: 24
file content (21 lines) | stat: -rwxr-xr-x 574 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /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
}'