line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
########################################### |
2
|
|
|
|
|
|
|
package PasswordMonkey::Bouncer::Retry; |
3
|
|
|
|
|
|
|
########################################### |
4
|
1
|
|
|
1
|
|
615
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
6
|
1
|
|
|
1
|
|
5
|
use PasswordMonkey; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
7
|
1
|
|
|
1
|
|
5
|
use base qw(PasswordMonkey::Bouncer); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
507
|
|
8
|
1
|
|
|
1
|
|
6
|
use Log::Log4perl qw(:easy); |
|
1
|
|
|
|
|
32
|
|
|
1
|
|
|
|
|
6
|
|
9
|
1
|
|
|
1
|
|
1738
|
use Data::Dumper; |
|
1
|
|
|
|
|
10508
|
|
|
1
|
|
|
|
|
297
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
PasswordMonkey::make_accessor( __PACKAGE__, $_ ) for qw( |
12
|
|
|
|
|
|
|
timeout |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
########################################### |
16
|
|
|
|
|
|
|
sub init { |
17
|
|
|
|
|
|
|
########################################### |
18
|
1
|
|
|
1
|
0
|
5
|
my($self) = @_; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
21
|
$self->{name} = "Retry Bouncer"; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
########################################### |
24
|
|
|
|
|
|
|
sub check { |
25
|
|
|
|
|
|
|
########################################### |
26
|
1
|
|
|
1
|
0
|
6
|
my($self) = @_; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
28
|
my $prompt_match = $self->{expect}->match(); |
29
|
1
|
|
|
|
|
38
|
my $prompt_comes_back = 0; |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
10
|
DEBUG "Hitting Return and waiting $self->{timeout} seconds ", |
32
|
|
|
|
|
|
|
"to see if the prompt ($prompt_match) reappears"; |
33
|
1
|
|
|
|
|
18
|
$self->{expect}->send( "\n" ); |
34
|
1
|
|
|
|
|
117
|
DEBUG "Waiting for prompt to reappear"; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$self->{expect}->expect( |
37
|
|
|
|
|
|
|
$self->{timeout}, |
38
|
|
|
|
|
|
|
[ qr/\Q$prompt_match\E/ => sub { |
39
|
1
|
|
|
1
|
|
1001358
|
DEBUG "Prompt ($prompt_match) came back"; |
40
|
1
|
|
|
|
|
59
|
DEBUG "Match before: ", $self->{expect}->before(); |
41
|
1
|
|
|
|
|
67
|
$prompt_comes_back = 1; |
42
|
|
|
|
|
|
|
} |
43
|
1
|
|
|
|
|
76
|
] |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
1
|
50
|
|
|
|
71
|
if(! $prompt_comes_back) { |
47
|
0
|
|
|
|
|
0
|
LOGWARN "$self->{name}: Prompt didn't come back"; |
48
|
0
|
|
|
|
|
0
|
return 0; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
14
|
return 1; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |