From e1ce009abec69d0a44862793106338f21a477a25 Mon Sep 17 00:00:00 2001 From: Root THC Date: Fri, 4 Apr 2025 11:58:55 +0100 Subject: [PATCH] hide ps myself --- tools/whatserver.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/whatserver.sh b/tools/whatserver.sh index 12a5bd3..a618ff3 100755 --- a/tools/whatserver.sh +++ b/tools/whatserver.sh @@ -431,9 +431,12 @@ command -v netstat >/dev/null && { } echo -e "${CDR}>>>>> Process List${CN}" -# Dont display kernel threads +# Don't display kernel threads # BusyBox only supports "ps w" -{ ps --ppid 2 -p 2 --deselect flwww || ps alxwww || ps w;} 2>/dev/null | head -n 500 +# Hide ws if piped into bash (ppid=$PPID) or if sourced (ppid=$$). +HIDE_PPID=$PPID +[ "$HIDE_PPID" -eq 1 ] && HIDE_PPID=$$ +{ ps --ppid 2,${HIDE_PPID:-0} -p 2,$$ --deselect flwww || ps alxwww || ps w;} 2>/dev/null | head -n 500 # use "|head -n-1" to not display this line echo -e "${CW}>>>>> 📖 Please help to make this tool better - https://thc.org/ops${CN} 😘"