12 lines
387 B
Bash
Executable file
12 lines
387 B
Bash
Executable file
#!/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
|