new netstat script
This commit is contained in:
parent
72eb89db56
commit
8cd6159c4a
1 changed files with 12 additions and 0 deletions
12
netstat.sh
Executable file
12
netstat.sh
Executable file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# ugliest netstat pwnage.
|
||||||
|
|
||||||
|
MY_UID=$(id -g)
|
||||||
|
|
||||||
|
if [ $MY_UID -gt 0 ]; then
|
||||||
|
echo "You must be root, running limited version without -p"
|
||||||
|
netstat -tlen | grep LISTEN | awk '{print $4}' | sed 's/:::/:/g' | cut -d ":" -f2
|
||||||
|
else
|
||||||
|
netstat -tlpen | grep LISTEN | awk '{print $4 ":" $9}' | sed 's/:::/:/g' | cut -d ":" -f2-3 | sed 's/\//:/g' | cut -d ":" -f1,3
|
||||||
|
fi
|
||||||
Loading…
Add table
Add a link
Reference in a new issue