Branch Coverage

blib/lib/Virani.pm
Criterion Covered Total %
branch 0 224 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') { }
177 0 0 if (defined $opts{$key})
230 0 0 unless (defined $bpf)
246 0 0 if ($not)
251 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 'host') { }
0 0 elsif (defined $previous[0] and defined $previous[1] and $previous[0] eq 'dst' and $previous[1] eq 'host') { }
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 'host') { }
0 0 elsif (defined $previous[0] and not defined $previous[1] and $previous[0] eq 'src') { }
0 0 elsif (defined $previous[0] and not defined $previous[1] and $previous[0] eq 'dst') { }
271 0 0 if ($not) { }
283 0 0 if ($tshark_args[$#tshark_args] ne "and" and $tshark_args[$#tshark_args] ne "or")
457 0 0 unless (defined $string)
461 0 0 if ($string =~ /^\w*\-/)
493 0 0 if ($self->{'auth_by_IP_only'})
497 0 0 unless (defined $apikey)
501 0 0 if (not defined $self->{'apikey'} or $self->{'apikey'} eq "")
505 0 0 if ($apikey ne $self->{'apikey'})
527 0 0 unless (defined $ip)
531 0 0 unless (defined $self->{'allowed_subnets'}[0])
537 0 0 if ($@) { }
0 0 elsif (not defined $allowed_subnets) { }
543 0 0 if (&$allowed_subnets($ip))
566 0 0 unless (defined $type)
570 0 0 if ($type ne "tshark" and $type ne "tcpdump" and $type ne "bpf2tshark")
608 0 0 unless (defined $opts{'type'})
610 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'type'})
616 0 0 unless ($self->check_type($opts{"type"}))
621 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+/) { }
633 0 0 unless (defined $opts{'auto_no_cache'})
637 0 0 if (not defined $opts{'set'} or $opts{'set'} eq "")
642 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'}) { }
654 0 0 unless (defined $opts{'padding'})
656 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'padding'})
665 0 0 if (defined $opts{'file'}) { }
669 0 0 if ($directories ne "" and not -d $directories)
678 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'}) { }
698 0 0 if (not -d $self->{'cache'}) { }
0 0 elsif (not -w $self->{'cache'}) { }
808 0 0 unless (defined $opts{'type'})
810 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'type'})
816 0 0 unless ($self->check_type($opts{"type"}))
822 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+$/) { }
836 0 0 unless (defined $opts{'auto_no_cache'})
841 0 0 unless (defined $opts{'no_cache'})
846 0 0 if (not defined $opts{'set'} or $opts{'set'} eq "")
852 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'}) { }
864 0 0 unless (defined $opts{'padding'})
866 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'padding'})
878 0 0 if ($@)
884 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') { }
897 0 0 if ($return_cache)
899 0 0 if (defined $opts{'file'} and $opts{'file'} ne $cache_file)
903 0 0 if (defined $opts{'file'} and $opts{'file'} ne $cache_file)
911 0 0 if ($@)
919 0 0 unless ($opts{'padding'} =~ /^[0-9]+$/)
931 0 0 unless (defined $set_path)
940 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'regex'}) { }
983 0 0 if ($opts{'type'} eq "bpf2tshark")
1003 0 0 if ($opts{'type'} eq 'tcpdump') { }
1014 0 0 if ($success) { }
1039 0 0 if ($to_return->{'success_count'} > 0) { }
1047 0 0 if ($success) { }
1051 0 0 if (-f $cache_file) { }
1064 0 0 if (-f $cache_file)
1098 0 0 if (defined $opts{'file'} and $cache_file ne $opts{'file'})
1123 0 0 unless (defined $set)
1127 0 0 unless (defined $self->{'sets'}{$set})
1131 0 0 unless (defined $self->{'sets'}{$set}{'path'})
1194 0 0 if (not defined $string or $string eq "")
1198 0 0 unless (defined $level)
1202 0 0 if ($self->{'verbose'})
1203 0 0 if ($self->{'verbose_to_syslog'}) { }