added better handling for network section and updates
This commit is contained in:
parent
1c713a65f5
commit
1be64f972c
1 changed files with 27 additions and 4 deletions
|
|
@ -10,6 +10,12 @@
|
||||||
###############################################################
|
###############################################################
|
||||||
|
|
||||||
source $prbl_functions
|
source $prbl_functions
|
||||||
|
prbl_functons_req_ver=1.1.3
|
||||||
|
|
||||||
|
if [[ $(vercomp $functionsrev $prbl_functons_req_ver) == 2 ]] ; then
|
||||||
|
warn "PRbL functions installed are lower than recommended ($prbl_functons_req_ver)"
|
||||||
|
warn "Some features may not work as expected"
|
||||||
|
fi
|
||||||
|
|
||||||
# Cache File Parameters
|
# Cache File Parameters
|
||||||
cachefile=quickinfo.cache
|
cachefile=quickinfo.cache
|
||||||
|
|
@ -256,15 +262,32 @@ fi
|
||||||
|
|
||||||
################################
|
################################
|
||||||
|
|
||||||
|
# Network display and filtering
|
||||||
|
|
||||||
|
filtered_adapters="lo"
|
||||||
|
declare -a adapters=()
|
||||||
|
declare -a ips=()
|
||||||
|
declare -a macs=()
|
||||||
|
for device in $(ls /sys/class/net/ | grep -v "$filtered_adapters") ; do
|
||||||
|
adapters+=($device)
|
||||||
|
_ip=$(/sbin/ifconfig $device 2> /dev/null | grep broadcast | awk '{print $2}' | cut -f 2 -d ":" |cut -f 1 -d " ")
|
||||||
|
if valid-ip $_ip ; then
|
||||||
|
ips=(${ips[@]} "$_ip")
|
||||||
|
else
|
||||||
|
ips=(${ips[@]} "${red}disconnected${dfl}")
|
||||||
|
fi
|
||||||
|
macs+=("$(/sbin/ifconfig $device | grep ether | awk '{print $2}')")
|
||||||
|
done
|
||||||
|
|
||||||
# Begin echo out of formatted table with agregated information
|
# Begin echo out of formatted table with agregated information
|
||||||
|
|
||||||
boxtop
|
boxtop
|
||||||
boxline ""
|
boxline ""
|
||||||
boxline "${bld}${unl}Location:${dfl} ${grn}${unl}$location${dfl}"
|
boxline "${bld}${unl}Location:${dfl} ${grn}${unl}$location${dfl}"
|
||||||
boxline ""
|
boxline ""
|
||||||
boxline "${bld}${unl}Network${dfl}"
|
# Echo out network arrays
|
||||||
for i in $(ls /sys/class/net/ | grep -v "lo") ; do
|
for((i=0; i<"${#adapters[@]}"; i++ )); do
|
||||||
boxline " $i: ${cyn}$(/sbin/ifconfig $i 2> /dev/null | grep broadcast | awk '{print $2}' | cut -f 2 -d ":" |cut -f 1 -d " " )${dfl} | ${blu}$(/sbin/ifconfig $i | grep ether | awk '{print $2}')${dfl}"
|
boxline " ${adapters[$i]}: ${cyn}${ips[$i]}${dfl} | ${blu}${macs[$i]}${dfl}"
|
||||||
done
|
done
|
||||||
boxline " WAN IP: ${ylw}${wan_ip}${dfl}"
|
boxline " WAN IP: ${ylw}${wan_ip}${dfl}"
|
||||||
boxline ""
|
boxline ""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue