This commit is contained in:
61
proxDoc.sh
61
proxDoc.sh
@@ -159,10 +159,13 @@ get_network_info() {
|
|||||||
|
|
||||||
get_detailed_network() {
|
get_detailed_network() {
|
||||||
echo -e "\n${GREEN}=== Network Interface Statistics ===${NC}"
|
echo -e "\n${GREEN}=== Network Interface Statistics ===${NC}"
|
||||||
# Show only physical interfaces and bridges, skip virtual/firewall interfaces
|
|
||||||
for iface in $(ls /sys/class/net | grep -v lo | grep -v -E "^veth|^fwbr|^fwln|^fwpr|^tap"); do
|
local iface
|
||||||
|
while IFS= read -r iface; do
|
||||||
|
[[ -z "$iface" ]] && continue
|
||||||
ip -s link show "$iface" 2>/dev/null
|
ip -s link show "$iface" 2>/dev/null
|
||||||
done
|
done < <(get_physical_interfaces)
|
||||||
|
|
||||||
echo -e "\n${GREEN}=== Network Statistics ===${NC}"
|
echo -e "\n${GREEN}=== Network Statistics ===${NC}"
|
||||||
if command -v ss >/dev/null 2>&1; then
|
if command -v ss >/dev/null 2>&1; then
|
||||||
ss -s
|
ss -s
|
||||||
@@ -232,42 +235,68 @@ get_memory_details() {
|
|||||||
|
|
||||||
get_nic_details() {
|
get_nic_details() {
|
||||||
echo -e "\n${GREEN}=== Network Interface Details ===${NC}"
|
echo -e "\n${GREEN}=== Network Interface Details ===${NC}"
|
||||||
# Show only physical interfaces and bridges, skip virtual/firewall interfaces
|
|
||||||
for iface in $(ls /sys/class/net | grep -v lo | grep -v -E "^veth|^fwbr|^fwln|^fwpr|^tap"); do
|
local iface
|
||||||
|
while IFS= read -r iface; do
|
||||||
|
[[ -z "$iface" ]] && continue
|
||||||
|
|
||||||
echo -e "\n${GREEN}Interface: $iface${NC}"
|
echo -e "\n${GREEN}Interface: $iface${NC}"
|
||||||
|
|
||||||
# Get driver info
|
# Get driver info
|
||||||
if [ -L "/sys/class/net/$iface/device/driver" ]; then
|
if [[ -L "/sys/class/net/$iface/device/driver" ]]; then
|
||||||
driver=$(basename $(readlink /sys/class/net/$iface/device/driver))
|
local driver
|
||||||
|
driver=$(basename "$(readlink "/sys/class/net/$iface/device/driver")")
|
||||||
echo -e " Driver: $driver"
|
echo -e " Driver: $driver"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get MAC address
|
# Get MAC address
|
||||||
if [ -f "/sys/class/net/$iface/address" ]; then
|
if [[ -f "/sys/class/net/$iface/address" ]]; then
|
||||||
echo -e " MAC: $(cat /sys/class/net/$iface/address)"
|
echo -e " MAC: $(cat "/sys/class/net/$iface/address")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get link state
|
# Get link state
|
||||||
if [ -f "/sys/class/net/$iface/operstate" ]; then
|
if [[ -f "/sys/class/net/$iface/operstate" ]]; then
|
||||||
echo -e " State: $(cat /sys/class/net/$iface/operstate)"
|
echo -e " State: $(cat "/sys/class/net/$iface/operstate")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use ethtool if available
|
# Use ethtool if available
|
||||||
if command -v ethtool >/dev/null 2>&1; then
|
if command -v ethtool >/dev/null 2>&1; then
|
||||||
# Get speed and duplex
|
# Get speed and duplex
|
||||||
link_info=$(ethtool $iface 2>/dev/null | grep -E "Speed:|Duplex:|Link detected:")
|
local link_info
|
||||||
if [ -n "$link_info" ]; then
|
link_info=$(ethtool "$iface" 2>/dev/null | grep -E "Speed:|Duplex:|Link detected:")
|
||||||
echo "$link_info" | while read line; do
|
if [[ -n "$link_info" ]]; then
|
||||||
|
echo "$link_info" | while IFS= read -r line; do
|
||||||
echo -e " $line"
|
echo -e " $line"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get firmware version
|
# Get firmware version
|
||||||
fw_ver=$(ethtool -i $iface 2>/dev/null | grep "firmware-version" | awk '{print $2}')
|
local fw_ver
|
||||||
if [ -n "$fw_ver" ] && [ "$fw_ver" != "" ]; then
|
fw_ver=$(ethtool -i "$iface" 2>/dev/null | grep "firmware-version" | awk '{print $2}')
|
||||||
|
if [[ -n "$fw_ver" ]]; then
|
||||||
echo -e " Firmware: $fw_ver"
|
echo -e " Firmware: $fw_ver"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
done < <(get_physical_interfaces)
|
||||||
|
}
|
||||||
|
|
||||||
|
get_physical_interfaces() {
|
||||||
|
local iface
|
||||||
|
for iface in /sys/class/net/*; do
|
||||||
|
# Skip if glob didn't match anything
|
||||||
|
[[ -e "$iface" ]] || continue
|
||||||
|
|
||||||
|
# Get just the interface name
|
||||||
|
iface=$(basename "$iface")
|
||||||
|
|
||||||
|
# Skip loopback
|
||||||
|
[[ "$iface" == "lo" ]] && continue
|
||||||
|
|
||||||
|
# Skip virtual/firewall interfaces
|
||||||
|
[[ "$iface" =~ ^(veth|fwbr|fwln|fwpr|tap) ]] && continue
|
||||||
|
|
||||||
|
# This is a physical interface
|
||||||
|
echo "$iface"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user