diff --git a/inxi b/inxi index 3d01876..c758ca1 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.7.32 +#### version: 1.7.33 #### Date: April 16 2012 #### Patch Number: 00 ######################################################################## @@ -4699,13 +4699,20 @@ get_networking_wan_ip_data() # get ip using wget redirect to stdout. This is a clean, text only IP output url, # single line only, ending in the ip address. May have to modify this in the future # to handle ipv4 and ipv6 addresses but should not be necessary. - ip=$( wget -q -O - $WAN_IP_URL | gawk '{ + # awk has bad regex handling so checking it with grep -E instead + # ip=$( echo 2001:0db8:85a3:0000:0000:8a2e:0370:7334 | gawk --re-interval ' + # ip=$( wget -q -O - $WAN_IP_URL | gawk --re-interval ' + ip=$( wget -q -O - $WAN_IP_URL | gawk --re-interval ' + { #gsub("\n","",$2") print $NF }' ) - + # validate the data if [[ -z $ip ]];then ip='None Detected!' + elif [[ -z $( grep -Es \ + '^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|[[:alnum:]]{0,4}:[[:alnum:]]{0,4}:[[:alnum:]]{0,4}:[[:alnum:]]{0,4}:[[:alnum:]]{0,4}:[[:alnum:]]{0,4}:[[:alnum:]]{0,4}:[[:alnum:]]{0,4})$' <<< $ip ) ]];then + ip='IP Source Corrupt!' fi echo "$ip" log_function_data "ip: $ip"