diff --git a/colourfiles/conf.sockstat b/colourfiles/conf.sockstat new file mode 100644 index 0000000..2eb12c5 --- /dev/null +++ b/colourfiles/conf.sockstat @@ -0,0 +1,93 @@ +======= +# CAPS LINE +regexp=^[A-Z\s%]*([A-Z]{3})[A-Z\s%]*$ +colours=underline +======= +# root +regexp=^root(?=\s|$) +colours=bold red +======= +# non-root users +regexp=^(?:(?!root|USER))([^\s]+) +colours=bold yellow,unchanged +======= +# CMD +regexp=^[a-zA-Z]+\w+\s+(\w+)\s+\d+ +colours=unchanged,bold cyan +======= +# FD +regexp=^[a-zA-Z]+\w+\s+\w+\s+\d+\s+(\d+) +colours=unchanged,yellow +======= +# PID +regexp=^[a-zA-Z]+\w+\s+[a-zA-Z]+\w+\s+(\d+) +colours=unchanged,bold magenta +======= +# PROTOCOLS +regexp=(tcp4|udp4|tcp6|udp6|stream|dgram) +colours=bold blue +======= +# hostname:service +regexp=([\w\.\-]+):([\w\-]+)\b +colours=yellow, bold green, bold yellow +======= +# hostname:port +regexp=([\w\.\-]+):(\d+)\b +colours=yellow, bold green, bold red +======= +# *:service +regexp=(\*):([\w\-]+)\b +colours=yellow, yellow, bold red +======= +# PATH +regexp=\s\/.*\/(\S+)($| \(.*\)) +colours=green,bright_green,red +======= +# status +regexp=FIN_WAIT.* +colours=red +======= +# status +regexp=SYN.*? +colours=bold red +======= +# status +regexp=LISTEN(ING)? +colours=bold blue +======= +# status +regexp=TIME_WAIT +colours=bold red +======= +# status +regexp=CLOS(E(_WAIT)?|ING) +colours=red +skip=yes +======= +# status +regexp=LAST_ACK +colours=red +======= +# status +regexp=ESTAB.*?\b|CONNECTED +colours=bold yellow +======= +# status +regexp=FREE +colours=bold green +======= +# status +regexp=DISCONNECTING +colours=red +======= +# status +regexp=CONNECTING +colours=green +======= +# status +regexp=CONNECTING +colours=green +======= +# status +regexp=UNKNOWN +colours=blink bold red diff --git a/grc.bashrc b/grc.bashrc index 0b2593c..9fc18fe 100644 --- a/grc.bashrc +++ b/grc.bashrc @@ -42,5 +42,6 @@ if [ "$TERM" != dumb ] && [ -n "$GRC" ]; then alias semanage='colourify semanage' alias getsebool='colourify getsebool' alias ifconfig='colourify ifconfig' + alias sockstat='colourify sockstat' fi diff --git a/grc.conf b/grc.conf index bc4702c..43d7f5c 100644 --- a/grc.conf +++ b/grc.conf @@ -294,3 +294,6 @@ conf.whois (^|[/\w\.]+/)go test\b conf.go-test +# sockstat command +(^|[/\w\.]+/)sockstat\s? +conf.sockstat diff --git a/grc.fish b/grc.fish index cd0c6fb..3e643aa 100644 --- a/grc.fish +++ b/grc.fish @@ -11,7 +11,7 @@ set -U grc_plugin_execs cat cvs df diff dig gcc g++ ls ifconfig \ wdiff blkid du dnf docker docker-compose docker-machine env id ip iostat journalctl kubectl \ last lsattr lsblk lspci lsmod lsof getfacl getsebool ulimit uptime nmap \ fdisk findmnt free semanage sar ss sysctl systemctl stat showmount \ - tcpdump tune2fs vmstat w who + tcpdump tune2fs vmstat w who sockstat for executable in $grc_plugin_execs if type -q $executable diff --git a/grc.zsh b/grc.zsh index 429c330..be69ac3 100644 --- a/grc.zsh +++ b/grc.zsh @@ -72,6 +72,7 @@ if [[ "$TERM" != dumb ]] && (( $+commands[grc] )) ; then vmstat wdiff whois + sockstat ) # Set alias for available commands.