Branch Coverage

blib/lib/Virani.pm
Criterion Covered Total %
branch 0 220 0.0


line true false branch
52 0 0 unless (defined $opts{'conf'})
56 0 0 unless (-f $opts{'conf'})
62 0 0 if ($@ or not defined $raw_toml)
64 0 0 if ($@)
72 0 0 if ($@)
158 0 0 if (defined $opts{'allowed_subnets'} and ref $opts{'allowed_subnets'} eq 'ARRAY') { }
0 0 elsif (defined $opts{'allowed_subnets'} and ref $opts{'allowed_subnets'} ne 'ARRAY') { }
164 0 0 if (defined $opts{'sets'} and ref $opts{'sets'} eq 'HASH') { }
0 0 elsif (defined $opts{'sets'} and ref $opts{'allowed_subnets'} ne 'HASH') { }
176 0 0 if (defined $opts{$key})
223 0 0 unless (defined $bpf)
239 0 0 if ($not)
244 0 0 if ($item eq 'tcp' or $item eq 'udp' or $item eq 'icmp') { }
0 0 elsif ($item eq 'not') { }
0 0 elsif ($item eq ')') { }
0 0 elsif ($item eq ')') { }
0 0 elsif ($item eq 'or' or $item eq 'and') { }
0 0 elsif (not defined $previous[0] and $item eq 'src' || $item eq 'dst') { }
0 0 elsif (not defined $previous[0] and $item eq 'ether') { }
0 0 elsif (defined $previous[0] and $previous[0] eq 'ether' and $item eq 'src' || $item eq 'dst' || $item eq 'host') { }
0 0 elsif (not defined $previous[0] and $item eq 'port' || $item eq 'host') { }
0 0 elsif (defined $previous[0] and $previous[0] eq 'src' || $previous[0] eq 'dst' and $item eq 'host' || $item eq 'port') { }
0 0 elsif (defined $previous[0] and defined $previous[1] and $previous[0] eq 'ether' and $previous[1] eq 'src') { }
0 0 elsif (defined $previous[0] and defined $previous[1] and $previous[0] eq 'ether' and $previous[1] eq 'dst') { }
0 0 elsif (defined $previous[0] and defined $previous[1] and $previous[0] eq 'ether' and $previous[1] eq 'host') { }
0 0 elsif (defined $previous[0] and defined $previous[1] and $previous[0] eq 'src' and $previous[1] eq 'port') { }
0 0 elsif (defined $previous[0] and defined $previous[1] and $previous[0] eq 'dst' and $previous[1] eq 'port') { }
0 0 elsif (defined $previous[0] and defined $previous[1] and $previous[0] eq 'src' and $previous[1] eq 'port') { }
0 0 elsif (defined $previous[0] and defined $previous[1] and $previous[0] eq 'dst' and $previous[1] eq 'port') { }
0 0 elsif (defined $previous[0] and not defined $previous[1] and $previous[0] eq 'port') { }
0 0 elsif (defined $previous[0] and not defined $previous[1] and $previous[0] eq 'port') { }
264 0 0 if ($not) { }
276 0 0 if ($tshark_args[$#tshark_args] ne "and" and $tshark_args[$#tshark_args] ne "or")
436 0 0 unless (defined $string)
440 0 0 if ($string =~ /^\w*\-/)
472 0 0 if ($self->{'auth_by_IP_only'})
476 0 0 unless (defined $apikey)
480 0 0 if (not defined $self->{'apikey'} or $self->{'apikey'} eq "")
484 0 0 if ($apikey ne $self->{'apikey'})
506 0 0 unless (defined $ip)
510 0 0 unless (defined $self->{'allowed_subnets'}[0])
516 0 0 if ($@) { }
0 0 elsif (not defined $allowed_subnets) { }
522 0 0 if (&$allowed_subnets($ip))
545 0 0 unless (defined $type)
549 0 0 if ($type ne "tshark" and $type ne "tcpdump" and $type ne "bpf2tshark")
587 0 0 unless (defined $opts{'type'})
589 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'type'})
595 0 0 unless ($self->check_type($opts{"type"}))
600 0 0 if (not defined $opts{'start'}) { }
0 0 elsif (not defined $opts{'end'}) { }
0 0 elsif (ref $opts{'start'} ne 'Time::Piece') { }
0 0 elsif (ref $opts{'end'} ne 'Time::Piece') { }
0 0 elsif (defined $opts{'padding'} and not $opts{'padding'} =~ /^\d+/) { }
612 0 0 unless (defined $opts{'auto_no_cache'})
616 0 0 if (not defined $opts{'set'} or $opts{'set'} eq "")
621 0 0 if (not defined $self->{'sets'}{$opts{'set'}}) { }
0 0 elsif (not defined $self->{'sets'}{$opts{'set'}}{'path'}) { }
0 0 elsif (not -d $self->{'sets'}{$opts{'set'}}{'path'}) { }
633 0 0 unless (defined $opts{'padding'})
635 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'padding'})
644 0 0 if (defined $opts{'file'}) { }
648 0 0 if ($directories ne "" and not -d $directories)
657 0 0 if ($opts{'no_cache'}) { }
0 0 elsif ($opts{'auto_no_cache'} and not -d $self->{'cache'} && -w $self->{'cache'}) { }
0 0 elsif ($opts{'auto_no_cache'} and -d $self->{'cache'} || -w $self->{'cache'}) { }
0 0 elsif (not $opts{'auto_no_cache'} || -d $self->{'cache'} && -w $self->{'cache'}) { }
677 0 0 if (not -d $self->{'cache'}) { }
0 0 elsif (not -w $self->{'cache'}) { }
787 0 0 unless (defined $opts{'type'})
789 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'type'})
795 0 0 unless ($self->check_type($opts{"type"}))
801 0 0 if (not defined $opts{'start'}) { }
0 0 elsif (not defined $opts{'end'}) { }
0 0 elsif (ref $opts{'start'} ne 'Time::Piece') { }
0 0 elsif (ref $opts{'end'} ne 'Time::Piece') { }
0 0 elsif (defined $opts{'padding'} and not $opts{'padding'} =~ /^\d+$/) { }
815 0 0 unless (defined $opts{'auto_no_cache'})
820 0 0 unless (defined $opts{'no_cache'})
825 0 0 if (not defined $opts{'set'} or $opts{'set'} eq "")
831 0 0 if (not defined $self->{'sets'}{$opts{'set'}}) { }
0 0 elsif (not defined $self->{'sets'}{$opts{'set'}}{'path'}) { }
0 0 elsif (not -d $self->{'sets'}{$opts{'set'}}{'path'}) { }
843 0 0 unless (defined $opts{'padding'})
845 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'padding'})
857 0 0 if ($@)
863 0 0 if (defined $opts{'file'} and $opts{'file'} ne $cache_file and not $opts{'no_cache'} and -f $cache_file and -f $cache_file . '.json') { }
0 0 elsif (not defined $opts{'file'} || $opts{'no_cache'} and -f $cache_file and -f $cache_file . '.json') { }
876 0 0 if ($return_cache)
878 0 0 if (defined $opts{'file'} and $opts{'file'} ne $cache_file)
882 0 0 if (defined $opts{'file'} and $opts{'file'} ne $cache_file)
890 0 0 if ($@)
898 0 0 unless ($opts{'padding'} =~ /^[0-9]+$/)
911 0 0 unless (defined $set_path)
920 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'regex'}) { }
963 0 0 if ($opts{'type'} eq "bpf2tshark")
982 0 0 if ($opts{'type'} eq 'tcpdump') { }
993 0 0 if ($success) { }
1018 0 0 if ($to_return->{'success_count'} > 0) { }
1026 0 0 if ($success) { }
1030 0 0 if (-f $cache_file) { }
1043 0 0 if (-f $cache_file)
1077 0 0 if (defined $opts{'file'} and $cache_file ne $opts{'file'})
1102 0 0 unless (defined $set)
1106 0 0 unless (defined $self->{'sets'}{$set})
1110 0 0 unless (defined $self->{'sets'}{$set}{'path'})
1173 0 0 if (not defined $string or $string eq "")
1177 0 0 unless (defined $level)
1181 0 0 if ($self->{'verbose'})
1182 0 0 if ($self->{'verbose_to_syslog'}) { }