Branch Coverage

blib/lib/Virani.pm
Criterion Covered Total %
branch 0 228 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 ($@)
168 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') { }
174 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') { }
187 0 0 if (defined $opts{$key})
240 0 0 unless (defined $bpf)
256 0 0 if ($not)
261 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') { }
281 0 0 if ($not) { }
293 0 0 if ($tshark_args[$#tshark_args] ne "and" and $tshark_args[$#tshark_args] ne "or")
467 0 0 unless (defined $string)
471 0 0 if ($string =~ /^\w*\-/)
503 0 0 if ($self->{'auth_by_IP_only'})
507 0 0 unless (defined $apikey)
511 0 0 if (not defined $self->{'apikey'} or $self->{'apikey'} eq "")
515 0 0 if ($apikey ne $self->{'apikey'})
537 0 0 unless (defined $ip)
541 0 0 unless (defined $self->{'allowed_subnets'}[0])
547 0 0 if ($@) { }
0 0 elsif (not defined $allowed_subnets) { }
553 0 0 if (&$allowed_subnets($ip))
576 0 0 unless (defined $type)
580 0 0 if ($type ne "tshark" and $type ne "tcpdump" and $type ne "bpf2tshark")
618 0 0 unless (defined $opts{'type'})
620 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'type'})
626 0 0 unless ($self->check_type($opts{"type"}))
631 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+/) { }
643 0 0 unless (defined $opts{'auto_no_cache'})
647 0 0 if (not defined $opts{'set'} or $opts{'set'} eq "")
652 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'}) { }
664 0 0 unless (defined $opts{'padding'})
666 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'padding'})
675 0 0 if (defined $opts{'file'}) { }
679 0 0 if ($directories ne "" and not -d $directories)
688 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'}) { }
708 0 0 if (not -d $self->{'cache'}) { }
0 0 elsif (not -w $self->{'cache'}) { }
822 0 0 if (not defined $opts{'set'} or $opts{'set'} eq "")
828 0 0 unless (defined $opts{'type'})
830 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'type'})
837 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'ts_is_unixtime'}) { }
845 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'pcap_glob'}) { }
853 0 0 unless ($self->check_type($opts{"type"}))
859 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+$/) { }
873 0 0 unless (defined $opts{'auto_no_cache'})
878 0 0 unless (defined $opts{'no_cache'})
884 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'}) { }
896 0 0 unless (defined $opts{'padding'})
898 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'padding'})
910 0 0 if ($@)
916 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') { }
926 0 0 if ($return_cache)
928 0 0 if (defined $opts{'file'} and $opts{'file'} ne $cache_file)
932 0 0 if (defined $opts{'file'} and $opts{'file'} ne $cache_file)
940 0 0 if ($@)
948 0 0 unless ($opts{'padding'} =~ /^[0-9]+$/)
960 0 0 unless (defined $set_path)
969 0 0 if (defined $self->{'sets'}{$opts{'set'}}{'regex'}) { }
1016 0 0 if ($opts{'type'} eq "bpf2tshark")
1036 0 0 if ($opts{'type'} eq 'tcpdump') { }
1047 0 0 if ($success) { }
1072 0 0 if ($to_return->{'success_count'} > 0) { }
1080 0 0 if ($success) { }
1084 0 0 if (-f $cache_file) { }
1097 0 0 if (-f $cache_file)
1131 0 0 if (defined $opts{'file'} and $cache_file ne $opts{'file'})
1156 0 0 unless (defined $set)
1160 0 0 unless (defined $self->{'sets'}{$set})
1164 0 0 unless (defined $self->{'sets'}{$set}{'path'})
1227 0 0 if (not defined $string or $string eq "")
1231 0 0 unless (defined $level)
1235 0 0 if ($self->{'verbose'})
1236 0 0 if ($self->{'verbose_to_syslog'}) { }