X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=home%2Flib%2Flogin_functions.sh;h=51bc7f5afb485ec90e771bcc95f456ae1f1ebec4;hb=857e80acff709b05a4f4c2ade3911df7593c0ec8;hp=a497cbc804120a5d74298eb0e05a50704b01148b;hpb=e89edca77d0e773d87d8458e0d003f4e0ffdea8b;p=khome.git diff --git a/home/lib/login_functions.sh b/home/lib/login_functions.sh index a497cbc..51bc7f5 100644 --- a/home/lib/login_functions.sh +++ b/home/lib/login_functions.sh @@ -455,7 +455,7 @@ motd() { echo echo 'Network' - echo "${indent_unit}interfaces:" + echo "${indent_unit}if" (ifconfig; iwconfig) 2> /dev/null \ | awk ' /^[^ ]/ { @@ -499,12 +499,32 @@ motd() { | indent "${indent_unit}${indent_unit}" # WARN: ensure: $USER ALL=(ALL) NOPASSWD:/bin/netstat - echo "${indent_unit}TCP servers" + + echo "${indent_unit}-->" + + printf '%sUDP: ' "${indent_unit}${indent_unit}" + sudo -n netstat -ulnp \ + | awk 'NR > 2 {print $6}' \ + | awk -F/ '{print $2}' \ + | sort -u \ + | xargs \ + | column -t + + printf '%sTCP: ' "${indent_unit}${indent_unit}" sudo -n netstat -tlnp \ | awk 'NR > 2 {print $7}' \ | awk -F/ '{print $2}' \ | sort -u \ | xargs \ - | column -t \ - | indent "${indent_unit}${indent_unit}" + | column -t + + echo "${indent_unit}<->" + + printf '%sTCP: ' "${indent_unit}${indent_unit}" + sudo -n netstat -tnp \ + | awk 'NR > 2 && $6 == "ESTABLISHED" {print $7}' \ + | awk -F/ '{print $2}' \ + | sort -u \ + | xargs \ + | column -t }