You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
you might want to update to us SS -ano if netstat is missing
if [[ -x "$(command -v netstat)" ]]; then
if [[ $(netstat -ano | grep LISTEN | grep 1234) ]]; then
listening_port=true
echo "[*] Listening on port 1234"
fi
fi
if [[ -x "$(command -v ss)" ]]; then
if [[ $(ss -ano | grep LISTEN | grep 1234) ]]; then
listening_port=true
echo "[*] Listening on port 1234"
fi
fi
The text was updated successfully, but these errors were encountered:
if grep -q '00000000:04D2 [0:]* 0A ' /proc/net/tcp*; then
listening_port=true
echo "[*] Listening on port 1234 (ipv4 or ipv6)"
fi
if grep ':04D2 ' /proc/net/tcp* | grep -v ' 00000000*:0000 0A'; then
echo "[*] Active connection on port 1234 (ipv4 or ipv6)"
fi
Explanation:
/proc/net/tcp and /proc/net/tcp6 are the tcp network connections known to the kernel
04D2 is the hexadecimal equivalent of 1234
0A is the status flag for 'listening', and the remote address is all zeros
netstat missing
you might want to update to us SS -ano if netstat is missing
The text was updated successfully, but these errors were encountered: