added some irc blocked output for security, cleaned up a few glitches in -i and -n functions.

Now non irc output is unfiltered, and irc local mac, ip, username output is filtered.
This commit is contained in:
inxi-svn 2011-04-25 18:51:46 +00:00
parent 289a50fe09
commit d1e0999e7b

38
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.4.80 #### version: 1.4.81
#### Date: April 24 2011 #### Date: April 25 2011
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
######################################################################## ########################################################################
@ -4923,7 +4923,11 @@ print_network_advanced_data()
duplex=${a_network_working[8]} duplex=${a_network_working[8]}
fi fi
if [[ -n ${a_network_working[9]} ]];then if [[ -n ${a_network_working[9]} ]];then
if [[ $B_RUNNING_IN_SHELL == 'true' ]];then
mac_id=${a_network_working[9]} mac_id=${a_network_working[9]}
else
mac_id='<irc-filter>'
fi
fi fi
network_data="${C1}IF:${C2} $if_id ${C1}State:${C2} $oper_state ${C1}Speed:${C2} $speed" network_data="${C1}IF:${C2} $if_id ${C1}State:${C2} $oper_state ${C1}Speed:${C2} $speed"
network_data="$network_data ${C1}Duplex:${C2} $duplex ${C1}Mac:${C2} $mac_id" network_data="$network_data ${C1}Duplex:${C2} $duplex ${C1}Mac:${C2} $mac_id"
@ -4939,10 +4943,14 @@ print_networking_ip_data()
eval $LOGFS eval $LOGFS
local ip=$( get_networking_wan_ip_data ) local ip=$( get_networking_wan_ip_data )
local ip_data='' a_interfaces_working='' interfaces='' interfaces_2='' i='' local ip_data='' a_interfaces_working='' interfaces='' interfaces_2='' i=''
local if_id='' if_ip=''
# set A_INTERFACES_DATA # set A_INTERFACES_DATA
get_networking_local_ip_data get_networking_local_ip_data
# first print output for wan ip line. Null is handled in the get function # first print output for wan ip line. Null is handled in the get function
if [[ -z $ip ]];then
ip='N/A'
fi
ip_data=$( create_print_line " " "${C1}Wan IP:${C2} $ip" ) ip_data=$( create_print_line " " "${C1}Wan IP:${C2} $ip" )
# then create the list of local interface/ip # then create the list of local interface/ip
@ -4952,16 +4960,24 @@ print_networking_ip_data()
IFS="," IFS=","
a_interfaces_working=(${A_INTERFACES_DATA[i]}) a_interfaces_working=(${A_INTERFACES_DATA[i]})
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
if [[ $i -lt 3 ]];then if_id='N/A'
if [[ -n ${a_interfaces_working[0]} ]];then if_ip='N/A'
interfaces="$interfaces ${C1}IF IP:${C2} ${a_interfaces_working[0]} ${C1}-${C2} ${a_interfaces_working[1]}" if [[ -n ${a_interfaces_working[1]} ]];then
fi if [[ $B_RUNNING_IN_SHELL == 'true' ]];then
if_ip=${a_interfaces_working[1]}
else else
if [[ -n ${a_interfaces_working[0]} ]];then if_ip='<irc-filter>'
# space on end here for lining up with line starter
interfaces_2="$interfaces_2${C1}IF IP:${C2} ${a_interfaces_working[0]} ${C1}-${C2} ${a_interfaces_working[1]} "
fi fi
fi fi
if [[ -n ${a_interfaces_working[0]} ]];then
if_id=${a_interfaces_working[0]}
fi
if [[ $i -lt 3 ]];then
interfaces="$interfaces ${C1}IF IP:${C2} $if_id ${C1}-${C2} $if_ip"
else
# space on end here for lining up with line starter
interfaces_2="$interfaces_2${C1}IF IP:${C2} $if_id ${C1}-${C2} $if_ip "
fi
((i++)) ((i++))
done done
print_screen_output "$ip_data$interfaces" print_screen_output "$ip_data$interfaces"
@ -5049,7 +5065,11 @@ print_partition_data()
full_uuid=" ${C1}uuid:${C2} $part_uuid" full_uuid=" ${C1}uuid:${C2} $part_uuid"
fi fi
fi fi
if [[ $B_RUNNING_IN_SHELL == 'false' ]];then
partitionIdClean=$( sed -r 's|/home/(.*)/(.*)|/home/##/\2|' <<< ${a_partition_working[0]} ) partitionIdClean=$( sed -r 's|/home/(.*)/(.*)|/home/##/\2|' <<< ${a_partition_working[0]} )
else
partitionIdClean=${a_partition_working[0]}
fi
# because these lines can vary widely, using dynamic length handling here # because these lines can vary widely, using dynamic length handling here
a_partition_data[$counter]="${a_partition_data[$counter]}${C1}ID:${C2}$partitionIdClean ${C1}size:${C2} ${a_partition_working[1]}$partition_used$full_fs$full_dev$full_label$full_uuid " a_partition_data[$counter]="${a_partition_data[$counter]}${C1}ID:${C2}$partitionIdClean ${C1}size:${C2} ${a_partition_working[1]}$partition_used$full_fs$full_dev$full_label$full_uuid "