Skip to content

Commit b1cc9c5

Browse files
committed
filter private ips if at least one public ip is present
1 parent e875673 commit b1cc9c5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

hi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use warnings;
66
use utf8;
77
use 5.010;
88

9-
my $VERSION = '0.7';
9+
my $VERSION = '0.8';
1010

1111
my %FONTS = (
1212
default => {
@@ -159,8 +159,8 @@ for my $c ( split(//,lc($info || '')) ) {
159159
if( $c eq 'k' ) {
160160
$l = 'kernel';
161161
$i = shell('uname -r');
162-
$z = shell('cat /etc/issue.net');
163-
$i = $z.' - '.$i if $z;
162+
#$z = shell('cat /etc/issue.net');
163+
#$i = $z.' - '.$i if $z;
164164
$i =~ s/[\n\r]+//g;
165165
} elsif( $c eq 'u' ) {
166166
$l = 'load/up';
@@ -178,7 +178,8 @@ for my $c ( split(//,lc($info || '')) ) {
178178
my $out = shell('/sbin/ip -4 addr 2>/dev/null');
179179
$out = shell('/sbin/ifconfig 2>/dev/null') unless $out;
180180
my @ips = grep { ! /255|^127\.0/ } ( $out =~ m/([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/gm );
181-
$i = join(' / ',@ips);
181+
my @pips = grep { ! /^10\.0|^192\.168|172\.(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\./ } @ips;
182+
$i = join(' / ',scalar @pips ? @pips : @ips);
182183
} elsif( $c eq 'c' ) {
183184
$l = 'cpu';
184185
if( $macmode ) {

0 commit comments

Comments
 (0)