Branch Coverage

blib/lib/Captive/Portal.pm
Criterion Covered Total %
branch 61 128 47.6


line true false branch
141 0 8 unless my $class = shift()
147 0 8 if (ref $_[0] and ref $_[0] eq 'HASH') { }
155 8 0 if ($$opts{'cfg_file'})
166 0 5 unless $$self{'template'} = 'Template'->new({'INCLUDE_PATH', $self->cfg->{'TEMPLATE_INCLUDE_PATH'}})
171 0 5 unless $self->build_authenticator
187 0 7 unless my $query = shift()
230 0 7 if ($error)
287 3 4 if ($path_info =~ /\b status \b/x)
292 0 4 if (exists $query->Vars->{'status'})
299 1 3 if ($path_info =~ /\b is_running \b/x)
304 0 3 if (exists $query->Vars->{'is_running'})
316 0 3 unless my $session = $self->get_current_session
324 0 3 if exists $query->Vars->{'no_ssl'}
328 1 2 if exists $query->Vars->{'login'}
332 1 1 if exists $query->Vars->{'logout'}
336 1 0 if $$session{'STATE'} eq 'init'
340 0 0 if $$session{'STATE'} eq 'active'
344 0 0 if $$session{'STATE'} eq 'idle' and $self->match_cookie
370 0 0 unless $$self{'template'}->process($template, $$self{'CTX'}{'TMPL_VARS'}, $output)
399 0 0 if ($role eq 'victim') { }
0 0 elsif ($role eq 'mitm') { }
434 0 2 unless $$self{'template'}->process($template, $$self{'CTX'}{'TMPL_VARS'}, $output)
450 0 0 unless defined $self->fw_status
508 0 1 unless $$self{'template'}->process($template, $$self{'CTX'}{'TMPL_VARS'}, $output)
539 0 1 if ($$session{'STATE'} eq 'active')
553 1 0 if $username
555 0 1 unless ($username and $password)
569 0 1 unless ($self->authenticate($username, $password))
583 0 1 unless defined $self->fw_status
630 0 1 unless ($$session{'STATE'} eq 'active')
642 0 1 unless defined $self->fw_status
688 2 1 if (exists $query->Vars->{'admin_secret'})
690 0 2 unless $self->cfg->{'ADMIN_SECRET'}
693 2 0 if ($query->param('admin_secret') eq $self->cfg->{'ADMIN_SECRET'}) { }
723 0 1 if ($error)
730 0 1 unless ($session)
744 0 1 unless defined $self->fw_status
757 0 1 unless $$self{'template'}->process($template, $$self{'CTX'}{'TMPL_VARS'}, $output)
795 0 2 unless ($session)
807 0 2 if (defined $filter_by_state)
809 0 0 unless $$session{'STATE'} =~ /\Q$filter_by_state\E/i
812 0 2 if (defined $filter_by_ip)
814 0 0 unless $$session{'IP'} =~ /\Q$filter_by_ip\E/i
817 0 2 if (defined $filter_by_username)
819 0 0 unless $$session{'USERNAME'} =~ /\Q$filter_by_username\E/i
827 2 0 $start_time ? :
832 0 2 $stop_time ? :
846 0 2 if ($query->param('flip_sort_order')) { }
855 2 0 if $sort_reverse
858 0 2 if defined $query->param('sort_by_ip')
859 0 2 if defined $query->param('sort_by_mac')
860 0 2 if defined $query->param('sort_by_username')
861 0 2 if defined $query->param('sort_by_state')
862 0 2 if defined $query->param('sort_by_start_time')
863 0 2 if defined $query->param('sort_by_stop_time')
869 2 0 if $sort_by eq 'IP'
870 0 2 if $sort_by eq 'START_TIME'
871 0 2 if $sort_by eq 'STOP_TIME'
875 2 0 if ($sort_reverse) { }
884 0 2 unless defined $self->fw_status
898 1 1 if (exists $query->Vars->{'astext'}) { }
904 0 1 unless $$self{'template'}->process($template, $$self{'CTX'}{'TMPL_VARS'}, $output)
911 0 1 unless $$self{'template'}->process($template, $$self{'CTX'}{'TMPL_VARS'}, $output)
935 1 0 if (defined $session_count) { }