Compare commits
1 Commits
master
...
tweak/nets
Author | SHA1 | Date | |
---|---|---|---|
|
1721a1f4a9 |
13
pihole
13
pihole
@@ -283,26 +283,28 @@ Options:
|
|||||||
}
|
}
|
||||||
|
|
||||||
analyze_ports() {
|
analyze_ports() {
|
||||||
|
local listening port=${1}
|
||||||
# FTL is listening at least on at least one port when this
|
# FTL is listening at least on at least one port when this
|
||||||
# function is getting called
|
# function is getting called
|
||||||
# Check individual address family/protocol combinations
|
# Check individual address family/protocol combinations
|
||||||
# For a healthy Pi-hole, they should all be up (nothing printed)
|
# For a healthy Pi-hole, they should all be up (nothing printed)
|
||||||
if grep -q "IPv4.*UDP" <<< "${1}"; then
|
listening="$(netstat --listening --numeric --tcp --udp | grep ":${port} ")"
|
||||||
|
if grep -q "udp " <<< "${listening}"; then
|
||||||
echo -e " ${TICK} UDP (IPv4)"
|
echo -e " ${TICK} UDP (IPv4)"
|
||||||
else
|
else
|
||||||
echo -e " ${CROSS} UDP (IPv4)"
|
echo -e " ${CROSS} UDP (IPv4)"
|
||||||
fi
|
fi
|
||||||
if grep -q "IPv4.*TCP" <<< "${1}"; then
|
if grep -q "tcp " <<< "${listening}"; then
|
||||||
echo -e " ${TICK} TCP (IPv4)"
|
echo -e " ${TICK} TCP (IPv4)"
|
||||||
else
|
else
|
||||||
echo -e " ${CROSS} TCP (IPv4)"
|
echo -e " ${CROSS} TCP (IPv4)"
|
||||||
fi
|
fi
|
||||||
if grep -q "IPv6.*UDP" <<< "${1}"; then
|
if grep -q "udp6 " <<< "${listening}"; then
|
||||||
echo -e " ${TICK} UDP (IPv6)"
|
echo -e " ${TICK} UDP (IPv6)"
|
||||||
else
|
else
|
||||||
echo -e " ${CROSS} UDP (IPv6)"
|
echo -e " ${CROSS} UDP (IPv6)"
|
||||||
fi
|
fi
|
||||||
if grep -q "IPv6.*TCP" <<< "${1}"; then
|
if grep -q "tcp6 " <<< "${listening}"; then
|
||||||
echo -e " ${TICK} TCP (IPv6)"
|
echo -e " ${TICK} TCP (IPv6)"
|
||||||
else
|
else
|
||||||
echo -e " ${CROSS} TCP (IPv6)"
|
echo -e " ${CROSS} TCP (IPv6)"
|
||||||
@@ -324,7 +326,6 @@ statusFunc() {
|
|||||||
else
|
else
|
||||||
#get the port pihole-FTL is listening on by using FTL's telnet API
|
#get the port pihole-FTL is listening on by using FTL's telnet API
|
||||||
port="$(echo ">dns-port >quit" | nc 127.0.0.1 4711)"
|
port="$(echo ">dns-port >quit" | nc 127.0.0.1 4711)"
|
||||||
listening="$(lsof -Pni:${port})"
|
|
||||||
if [[ "${port}" == "0" ]]; then
|
if [[ "${port}" == "0" ]]; then
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
"web") echo "-1";;
|
"web") echo "-1";;
|
||||||
@@ -334,7 +335,7 @@ statusFunc() {
|
|||||||
else
|
else
|
||||||
if [[ "${1}" != "web" ]]; then
|
if [[ "${1}" != "web" ]]; then
|
||||||
echo -e " ${TICK} FTL is listening on port ${port}"
|
echo -e " ${TICK} FTL is listening on port ${port}"
|
||||||
analyze_ports "${listening}"
|
analyze_ports "${port}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user