home
/
code
/
khome.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e89edca
)
Add net reporting on UDP servers and ESTABLISHED conns
author
Siraaj Khandkar
<siraaj@khandkar.net>
Sun, 1 Nov 2020 20:01:14 +0000
(15:01 -0500)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Sun, 1 Nov 2020 20:01:14 +0000
(15:01 -0500)
home/lib/login_functions.sh
patch
|
blob
|
blame
|
history
diff --git
a/home/lib/login_functions.sh
b/home/lib/login_functions.sh
index
a497cbc
..
51bc7f5
100644
(file)
--- a/
home/lib/login_functions.sh
+++ b/
home/lib/login_functions.sh
@@
-455,7
+455,7
@@
motd() {
echo
echo 'Network'
echo
echo 'Network'
- echo "${indent_unit}i
nterfaces:
"
+ echo "${indent_unit}i
f
"
(ifconfig; iwconfig) 2> /dev/null \
| awk '
/^[^ ]/ {
(ifconfig; iwconfig) 2> /dev/null \
| awk '
/^[^ ]/ {
@@
-499,12
+499,32
@@
motd() {
| indent "${indent_unit}${indent_unit}"
# WARN: ensure: $USER ALL=(ALL) NOPASSWD:/bin/netstat
| 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 \
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
}
}
This page took
0.036427 seconds
and
4
git commands to generate.