From d1e0999e7b0b0f1098a85c0cbe00cd6e97bf093d Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Mon, 25 Apr 2011 18:51:46 +0000 Subject: [PATCH] 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. --- inxi | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/inxi b/inxi index cda0cb9..9165021 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.4.80 -#### Date: April 24 2011 +#### version: 1.4.81 +#### Date: April 25 2011 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -4923,7 +4923,11 @@ print_network_advanced_data() duplex=${a_network_working[8]} fi if [[ -n ${a_network_working[9]} ]];then - mac_id=${a_network_working[9]} + if [[ $B_RUNNING_IN_SHELL == 'true' ]];then + mac_id=${a_network_working[9]} + else + mac_id='' + fi fi 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" @@ -4939,10 +4943,14 @@ print_networking_ip_data() eval $LOGFS local ip=$( get_networking_wan_ip_data ) local ip_data='' a_interfaces_working='' interfaces='' interfaces_2='' i='' + local if_id='' if_ip='' # set A_INTERFACES_DATA get_networking_local_ip_data # 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" ) # then create the list of local interface/ip @@ -4952,15 +4960,23 @@ print_networking_ip_data() IFS="," a_interfaces_working=(${A_INTERFACES_DATA[i]}) IFS="$ORIGINAL_IFS" + if_id='N/A' + if_ip='N/A' + if [[ -n ${a_interfaces_working[1]} ]];then + if [[ $B_RUNNING_IN_SHELL == 'true' ]];then + if_ip=${a_interfaces_working[1]} + else + if_ip='' + fi + fi + if [[ -n ${a_interfaces_working[0]} ]];then + if_id=${a_interfaces_working[0]} + fi if [[ $i -lt 3 ]];then - if [[ -n ${a_interfaces_working[0]} ]];then - interfaces="$interfaces ${C1}IF IP:${C2} ${a_interfaces_working[0]} ${C1}-${C2} ${a_interfaces_working[1]}" - fi + interfaces="$interfaces ${C1}IF IP:${C2} $if_id ${C1}-${C2} $if_ip" else - if [[ -n ${a_interfaces_working[0]} ]];then - # 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 + # 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++)) done @@ -5049,7 +5065,11 @@ print_partition_data() full_uuid=" ${C1}uuid:${C2} $part_uuid" fi fi - partitionIdClean=$( sed -r 's|/home/(.*)/(.*)|/home/##/\2|' <<< ${a_partition_working[0]} ) + if [[ $B_RUNNING_IN_SHELL == 'false' ]];then + 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 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 "