2 # show (or find) list of bad dx nodes
4 # Copyright (c) 2021-2023 - Dirk Koopman G1TLH
8 my ($self, $line) = @_;
9 return (1, $self->msg('e5')) if $self->remotecmd;
11 return (1, $self->msg('e5')) if $self->priv < 6;
12 return (1, q{Please install Net::CIDR::Lite or libnet-cidr-lite-perl to use this command}) unless $DXCIDR::active;
16 my @in = split /\s+/, $line;
18 my $width = $self->width // 80;
25 foreach my $ip (@in) {
26 if (DXCIDR::find($ip)) {
27 push @out, "$ip DIRTY";
30 push @out, "$ip CLEAN";
36 my @list = map {my $s = $_; $s =~ s!/(?:32|128)$!!; $maxlth = length $s if length $s > $maxlth; $s =~ /^1$/?undef:$s} DXCIDR::list();
39 my $n = int ($width/($maxlth+1));
40 my $format = "\%-${maxlth}s " x $n;
43 foreach my $list (@list) {
46 push @out, sprintf $format, @l;
51 push @l, "" while @l < $n;
52 push @out, sprintf $format, @l;
55 push @out, "show/badip: $count records found";