| 1 | package TaskPipe::TorManager; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | with 'MooseX::ConfigCascade'; | |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use IO::Socket::INET; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Digest::MD5 'md5_hex'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Net::EmptyPort; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Path::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Proc::Background; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Log::Log4perl; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use DateTime; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Module::Runtime 'require_module'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use TryCatch; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use TaskPipe::PortManager; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | has settings => (is => 'ro', isa => __PACKAGE__.'::Settings', default => sub{ | ||||||||||||||||||||||||||||
| 21 | 1 | ▶ | my $module = __PACKAGE__.'::Settings'; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 1 | require_module( $module ); | |||||||||||||||||||||||||||
| 23 | 1 | $module->new; | |||||||||||||||||||||||||||
| 24 | 1 | }); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | has run_info => (is => 'rw', isa => 'TaskPipe::RunInfo', default => sub{ | ||||||||||||||||||||||||||||
| 27 | 1 | ▶ | TaskPipe::RunInfo->new | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | 1 | }); | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 1 | has password => (is => 'rw', isa => 'Str'); | |||||||||||||||||||||||||||
| 31 | 1 | has port => (is => 'rw', isa => 'Int'); | |||||||||||||||||||||||||||
| 32 | 1 | has control_port => (is => 'rw', isa => 'Int'); | |||||||||||||||||||||||||||
| 33 | 1 | has proc => (is => 'rw', isa => 'Proc::Background'); | |||||||||||||||||||||||||||
| 34 | 1 | has proc_pid => (is => 'rw', isa => 'Str'); | |||||||||||||||||||||||||||
| 35 | 1 | has data_dir => (is => 'rw', isa => 'Path::Tiny'); | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 1 | has tor_socket => (is => 'rw', isa => 'IO::Socket::INET'); | |||||||||||||||||||||||||||
| 38 | 1 | has gm => (is => 'rw', isa => 'TaskPipe::SchemaManager'); | |||||||||||||||||||||||||||
| 39 | has port_manager => (is => 'ro', isa => 'TaskPipe::PortManager', lazy => 1, default => sub{ | ||||||||||||||||||||||||||||
| 40 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | TaskPipe::PortManager->new( | |||||||||||||||||||||||||||
| 43 | process_name => $self->settings->process_name, | ||||||||||||||||||||||||||||
| 44 | base_port => $self->settings->base_port, | ||||||||||||||||||||||||||||
| 45 | gm => $self->gm | ||||||||||||||||||||||||||||
| 46 | ); | ||||||||||||||||||||||||||||
| 47 | 1 | }); | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | sub connect_socket{ | ||||||||||||||||||||||||||||
| 51 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
connect_socket: not called CC=10 SCAR=45.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 0 | my $logger = Log::Log4perl->get_logger; | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | my $thread_row = $self->gm->table('spawned')->find({ | |||||||||||||||||||||||||||
| 56 | process_name => $self->settings->process_name, | ||||||||||||||||||||||||||||
| 57 | job_id => $self->run_info->job_id, | ||||||||||||||||||||||||||||
| 58 | thread_id => $self->run_info->thread_id | ||||||||||||||||||||||||||||
| 59 | }); | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | my $socket; | |||||||||||||||||||||||||||
| 62 | 0 | ▶ | if ( $thread_row ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | $self->port( $thread_row->port ); | |||||||||||||||||||||||||||
| 65 | 0 | $self->control_port( $thread_row->control_port ); | |||||||||||||||||||||||||||
| 66 | 0 | $self->password( $thread_row->password ); | |||||||||||||||||||||||||||
| 67 | 0 | $socket = $self->get_socket; | |||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | } else { | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | $self->port( $self->port_manager->get_new_port_number ); | |||||||||||||||||||||||||||
| 72 | 0 | $self->control_port( $self->port_manager->get_new_port_number ); | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 0 | ▶ | if ( ! $socket ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 0 | $self->new_password; | |||||||||||||||||||||||||||
| 79 | 0 | $self->start_tor; | |||||||||||||||||||||||||||
| 80 | 0 | $socket = $self->get_socket; | |||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 0 | my $duplicate; | |||||||||||||||||||||||||||
| 84 | 0 | my $counter = 0; | |||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 0 | ▶ | do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$duplicate and $counter < 4
MC/DC0%0/2
$duplicate and $counter < 4
$duplicate
$counter < 4
Truth table0%0/3
A and B
A= $duplicateB= $counter < 4
| |||||||||||||||||||||||||||||
| 87 | 0 | $duplicate = ''; | |||||||||||||||||||||||||||
| 88 | 1 | ▶ | try { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=4.1
| |||||||||||||||||||||||||||||
| 89 | 0 | $self->gm->table('spawned')->create({ | |||||||||||||||||||||||||||
| 90 | process_name => $self->settings->process_name, | ||||||||||||||||||||||||||||
| 91 | thread_id => $self->run_info->thread_id, | ||||||||||||||||||||||||||||
| 92 | job_id => $self->run_info->job_id, | ||||||||||||||||||||||||||||
| 93 | used_by_pid => $$, | ||||||||||||||||||||||||||||
| 94 | pid => $self->proc_pid, | ||||||||||||||||||||||||||||
| 95 | port => $self->port, | ||||||||||||||||||||||||||||
| 96 | control_port => $self->control_port, | ||||||||||||||||||||||||||||
| 97 | password => $self->password, | ||||||||||||||||||||||||||||
| 98 | status => 'connecting', | ||||||||||||||||||||||||||||
| 99 | temp_dir => $self->data_dir | ||||||||||||||||||||||||||||
| 100 | }); | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 1 | ▶ | } catch ( DBIx::Error::IntegrityConstraintViolation $err ){ | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=5.6
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 0 | $duplicate = $err; | |||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 1 | ▶ | } catch ( DBIx::Error $err ){ | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 0 | confess "Error creating record on spawned table. SQLSTATE = ".$err->state.":\n$err"; | |||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 0 | }; | |||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 0 | $counter++; | |||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | } while ( $duplicate && $counter < 4 ); | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 0 | ▶ | confess "Duplicate error condition persisted while trying to create record, despite retry attempts: ".$duplicate if $duplicate; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if ( ! $socket ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 120 | 0 | my $msg = "Failed to connect to socket"; | |||||||||||||||||||||||||||
| 121 | 0 | $self->set_status($msg); | |||||||||||||||||||||||||||
| 122 | 0 | confess $msg; | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 0 | $self->set_status("Connected"); | |||||||||||||||||||||||||||
| 126 | 0 | $logger->info("TOR Connection established"); | |||||||||||||||||||||||||||
| 127 | 0 | $self->tor_socket( $socket ); | |||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | sub get_socket{ | ||||||||||||||||||||||||||||
| 134 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
get_socket: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | 0 | my $socket = IO::Socket::INET->new( | |||||||||||||||||||||||||||
| 137 | PeerAddr => $self->settings->ip, | ||||||||||||||||||||||||||||
| 138 | PeerPort => $self->control_port, | ||||||||||||||||||||||||||||
| 139 | Proto => 'tcp' | ||||||||||||||||||||||||||||
| 140 | ); | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 0 | return $socket; | |||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | sub start_tor{ | ||||||||||||||||||||||||||||
| 148 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
start_tor: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 149 | 0 | my $logger = Log::Log4perl->get_logger; | |||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 0 | my $opts = $self->settings->exec_opts; | |||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | 0 | my $hashed_password_cmd = "tor ${\$opts->{'hash-password'}} ${\$self->password}"; | |||||||||||||||||||||||||||
| 154 | 0 | my $hashed_password = `$hashed_password_cmd`; | |||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 0 | ($hashed_password) = $hashed_password =~ /(16:\w*)$/s; | |||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 0 | ▶ | confess "Command '$hashed_password_cmd' did not seem to produce a tor password" unless $hashed_password; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 0 | my $data_dir = Path::Tiny->tempdir( CLEANUP => 0 ); | |||||||||||||||||||||||||||
| 161 | #my $data_dir = Path::Tiny->tempdir; | ||||||||||||||||||||||||||||
| 162 | 0 | $self->data_dir( $data_dir ); | |||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | my $cmd = join(' ',$self->settings->exec_name, | ||||||||||||||||||||||||||||
| 165 | $opts->{'ControlPort'} => $self->control_port, | ||||||||||||||||||||||||||||
| 166 | $opts->{'SocksPort'} => $self->port, | ||||||||||||||||||||||||||||
| 167 | $opts->{'DataDirectory'} => $self->data_dir, | ||||||||||||||||||||||||||||
| 168 | $opts->{'HashedControlPassword'} => $hashed_password, | ||||||||||||||||||||||||||||
| 169 | 0 | $opts->{'f'} => $self->settings->config_path | |||||||||||||||||||||||||||
| 170 | ); | ||||||||||||||||||||||||||||
| 171 | 0 | $self->proc( Proc::Background->new($cmd) ); | |||||||||||||||||||||||||||
| 172 | 0 | $logger->info("TOR instance launched successfully"); | |||||||||||||||||||||||||||
| 173 | 0 | $self->proc_pid( $self->proc->pid ); | |||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 0 | sleep 1; | |||||||||||||||||||||||||||
| 176 | 0 | ▶ | if ( ! $self->proc->alive ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 0 | my $cmd_resp = `$cmd`; | |||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | 0 | confess "Attempt to start tor on port ".$self->port." failed. The command was repeated synchronously to determine the error message. The command was: [$cmd] with response [$cmd_resp]"; | |||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | sub stop_tor{ | ||||||||||||||||||||||||||||
| 186 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
stop_tor: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 0 | ▶ | return unless $self->tor_socket; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 189 | 0 | $self->tor_socket->send("SIGNAL SHUTDOWN\n"); | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | sub set_status{ | ||||||||||||||||||||||||||||
| 195 | 0 | ▶ | my ($self,$new_status) = @_; | ||||||||||||||||||||||||||
|
Subroutine
set_status: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | 0 | my $dt = DateTime->now; | |||||||||||||||||||||||||||
| 198 | 0 | my $datetime = $dt->ymd.' '.$dt->hms; | |||||||||||||||||||||||||||
| 199 | 0 | $self->gm->table('spawned')->find({ | |||||||||||||||||||||||||||
| 200 | process_name => $self->settings->process_name, | ||||||||||||||||||||||||||||
| 201 | thread_id => $self->run_info->thread_id, | ||||||||||||||||||||||||||||
| 202 | job_id => $self->run_info->job_id | ||||||||||||||||||||||||||||
| 203 | })->update({ | ||||||||||||||||||||||||||||
| 204 | status => $new_status, | ||||||||||||||||||||||||||||
| 205 | used_by_pid => $$, | ||||||||||||||||||||||||||||
| 206 | last_checked => $datetime | ||||||||||||||||||||||||||||
| 207 | }); | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | sub url{ | ||||||||||||||||||||||||||||
| 214 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
url: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 215 | 0 | return $self->settings->scheme."://".$self->settings->ip.':'.$self->port; | |||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | sub change_ip{ | ||||||||||||||||||||||||||||
| 220 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
change_ip: not called CC=7 SCAR=39.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | 0 | my $logger = Log::Log4perl->get_logger; | |||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | 0 | my $counter = 0; | |||||||||||||||||||||||||||
| 225 | 0 | my $err; | |||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | 0 | ▶ | do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$err and $counter < 4
MC/DC0%0/2
$err and $counter < 4
$err
$counter < 4
Truth table0%0/3
A and B
A= $errB= $counter < 4
| |||||||||||||||||||||||||||||
| 228 | 0 | $err = ''; | |||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 1 | ▶ | try { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=4.1
| |||||||||||||||||||||||||||||
| 231 | 0 | my $answer = ""; | |||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | 0 | $self->tor_socket->send('AUTHENTICATE "'.$self->password.qq|"\n|); | |||||||||||||||||||||||||||
| 234 | 0 | $self->tor_socket->recv($answer, 1024); | |||||||||||||||||||||||||||
| 235 | 0 | ▶ | die "Could not change ip: failed to authenticate: $answer" unless $answer =~ /^250 OK/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | 0 | $self->tor_socket->send("SIGNAL NEWNYM\n"); | |||||||||||||||||||||||||||
| 238 | 0 | $self->tor_socket->recv($answer, 1024); | |||||||||||||||||||||||||||
| 239 | 0 | ▶ | die "Could not change ip: SIGNAL NEWNYM failed: $answer" unless $answer =~ /^250 OK/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | 0 | $self->set_status("changed ip"); | |||||||||||||||||||||||||||
| 242 | 0 | $logger->debug("Changed IP"); | |||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | 1 | ▶ | } catch { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=4.6
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | 0 | $err = $_; | |||||||||||||||||||||||||||
| 247 | # confess "Change IP failed: ".$_; | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | 0 | }; | |||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 0 | $counter++; | |||||||||||||||||||||||||||
| 252 | } while ( $err && $counter < 4 ); | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | 0 | ▶ | confess $err if $err; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | sub new_password{ | ||||||||||||||||||||||||||||
| 261 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
new_password: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 262 | 0 | my $logger = Log::Log4perl->get_logger; | |||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | 0 | $self->password( md5_hex( (time) * (rand) ) ); | |||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | =head1 NAME | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | TaskPipe::TorManager - manage TOR processes for TaskPipe | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | It is not recommended you use this package directly. See the general manpages for TaskPipe. | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | Tom Gracey <tomgracey@gmail.com> | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | Copyright (c) Tom Gracey 2018 | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | TaskPipe is free software, licensed under | ||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | The GNU Public License Version 3 | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | =cut | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | 1 | 1; | |||||||||||||||||||||||||||