| 1 | # ABSTRACT: Rex SSH connection via Net::LibSSH (no SFTP required) | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | package Rex::Interface::Connection::LibSSH; | ||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | our $VERSION = '0.005'; | |||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Net::LibSSH; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Rex::Logger; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Rex::Config; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Rex::Helper::IP; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Rex::Interface::Connection::Base; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use base qw(Rex::Interface::Connection::Base); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | my ( $that, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | my $self = $that->SUPER::new(%args); | |||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | sub connect { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connect: not called CC=31 SCAR=69.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | my ( $self, %opt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | my $server = $opt{server}; | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | my $port = $opt{port} || Rex::Config->get_port( server => $server ) || 22; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$opt{'port'} || 'Rex::Config'->get_port('server', $server) || 22
$opt{"port"} or "Rex::Config"->get_port("server", $server)
MC/DC0%0/2
$opt{'port'} || 'Rex::Config'->get_port('server', $server) || 22
$opt{"port"}
"Rex::Config"->get_port("server", $server)
Truth table0%0/3
A or B
A= $opt{"port"}B= "Rex::Config"->get_port("server", $server)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | my $timeout = $opt{timeout} || Rex::Config->get_timeout( server => $server ) || 10; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$opt{'timeout'} || 'Rex::Config'->get_timeout('server', $server) || 10
$opt{"timeout"} or "Rex::Config"->get_timeout("server", $server)
MC/DC0%0/2
$opt{'timeout'} || 'Rex::Config'->get_timeout('server', $server) || 10
$opt{"timeout"}
"Rex::Config"->get_timeout("server", $server)
Truth table0%0/3
A or B
A= $opt{"timeout"}B= "Rex::Config"->get_timeout("server", $server)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | my $user = $opt{user}; | |||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | my $password = $opt{password}; | |||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | my $privkey = $opt{private_key}; | |||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | my $auth = $opt{auth_type} // 'key'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$opt{"auth_type"} // "key"
MC/DC0%0/1
$opt{"auth_type"} // "key"
$opt{"auth_type"}
Truth table0%0/2
A
A= $opt{"auth_type"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | $self->{server} = $server; | |||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | $self->{is_sudo} = $opt{sudo}; | |||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | $self->{__auth_info__} = \%opt; | |||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ( $server, $port ) = Rex::Helper::IP::get_server_and_port( $server, $port ); | |||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | # Host key verification: a per-connect option wins, otherwise the same | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # openssh_opt knobs the OpenSSH backend honours -- StrictHostKeyChecking | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # (what -feature => ['disable_strict_host_key_checking'] sets to "no") | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # and UserKnownHostsFile. Strict unless explicitly turned off. | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | my %openssh_opt = Rex::Config->get_openssh_opt(); | |||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my $strict = $opt{strict_hostkeycheck}; | |||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | unless ( defined $strict ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | my $shkc = $openssh_opt{StrictHostKeyChecking} // ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$openssh_opt{"StrictHostKeyChecking"} // ""
MC/DC0%0/1
$openssh_opt{"StrictHostKeyChecking"} // ""
$openssh_opt{"StrictHostKeyChecking"}
Truth table0%0/2
A
A= $openssh_opt{"StrictHostKeyChecking"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | $strict = $shkc =~ /^(?:no|off)$/i ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | my $knownhosts = $opt{knownhosts} // $openssh_opt{UserKnownHostsFile}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$opt{"knownhosts"} // $openssh_opt{"UserKnownHostsFile"}
MC/DC0%0/2
$opt{"knownhosts"} // $openssh_opt{"UserKnownHostsFile"}
$opt{"knownhosts"}
$openssh_opt{"UserKnownHostsFile"}
Truth table0%0/3
A // B
A= $opt{"knownhosts"}B= $openssh_opt{"UserKnownHostsFile"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | Rex::Logger::debug("LibSSH: connecting to $server:$port as $user"); | |||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my $ssh = Net::LibSSH->new; | |||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | $ssh->option( host => "$server" ); | |||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | $ssh->option( port => $port ); | |||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | $ssh->option( user => $user ) if defined $user; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | $ssh->option( timeout => $timeout ); | |||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | $ssh->option( strict_hostkeycheck => $strict ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | $ssh->option( knownhosts => $knownhosts ) if defined $knownhosts; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | unless ( $ssh->connect ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # The hint only for a host key refusal -- Net::LibSSH names | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # known_hosts in each of them. A refused or unreachable port (a host | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # still rebooting) has nothing to do with host key checking. | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | my $error = $ssh->error // ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ssh->error // ""
MC/DC0%0/1
$ssh->error // ""
$ssh->error
Truth table0%0/2
A
A= $ssh->error
| |||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | Rex::Logger::info( "LibSSH: can't connect to $server: " . $error | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$strict and $error =~ /known_hosts/
MC/DC0%0/2
$strict and $error =~ /known_hosts/
$strict
$error =~ /known_hosts/
Truth table0%0/3
A and B
A= $strictB= $error =~ /known_hosts/
| |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | . ( $strict && $error =~ /known_hosts/ | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | ? " -- host key checking is on: add the host to known_hosts (ssh-keyscan)" | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | . " or opt out with strict_hostkeycheck => 0 / use Rex -feature => ['disable_strict_host_key_checking']" | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | : '' ), 'warn' ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | $self->{error} = $ssh->error; | |||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $self->{connected} = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $self->{auth_ret} = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # Reset timeout to 0 (infinite) after connect — the connect timeout must | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # be short so unreachable hosts fail fast, but channel reads (e.g. apt-get | ||||||||||||||||||||||||||||||||||||||||||||||
| 78 | # with DKMS build) must not time out. libssh's timeout option affects both. | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $ssh->option( timeout => 0 ); | |||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | $self->{connected} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # Try authentication in order | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | my $authed = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | if ( $auth eq 'pass' && defined $password ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$auth eq "pass" and defined $password
MC/DC0%0/2
$auth eq "pass" and defined $password
$auth eq "pass"
defined $password
Truth table0%0/3
A and B
A= $auth eq "pass"B= defined $password
| |||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | $authed = $ssh->auth_password($password); | |||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | ▶ | elsif ( $auth eq 'key' && defined $privkey ) { | |||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$auth eq "key" and defined $privkey
MC/DC0%0/2
$auth eq "key" and defined $privkey
$auth eq "key"
defined $privkey
Truth table0%0/3
A and B
A= $auth eq "key"B= defined $privkey
| |||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $authed = $ssh->auth_publickey($privkey); | |||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | $authed ||= $ssh->auth_agent if !$authed; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$authed ||= $ssh->auth_agent
MC/DC0%0/2
$authed ||= $ssh->auth_agent
$authed
$ssh->auth_agent
Truth table0%0/3
A ||= B
A= $authedB= $ssh->auth_agent
| |||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # auto: agent first, then key file, then password | ||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | $authed = $ssh->auth_agent; | |||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | $authed ||= $ssh->auth_publickey($privkey) if !$authed && $privkey; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not $authed and $privkey
$authed ||= $ssh->auth_publickey($privkey)
MC/DC0%0/2
not $authed and $privkey
not $authed
$privkey
MC/DC0%0/2
$authed ||= $ssh->auth_publickey($privkey)
$authed
$ssh->auth_publickey($privkey)
Truth table0%0/3
not(A) and B
A= not $authedB= $privkey
Truth table0%0/3
A ||= B
A= $authedB= $ssh->auth_publickey($privkey)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | $authed ||= $ssh->auth_password($password) if !$authed && $password; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not $authed and $password
$authed ||= $ssh->auth_password($password)
MC/DC0%0/2
not $authed and $password
not $authed
$password
MC/DC0%0/2
$authed ||= $ssh->auth_password($password)
$authed
$ssh->auth_password($password)
Truth table0%0/3
not(A) and B
A= not $authedB= $password
Truth table0%0/3
A ||= B
A= $authedB= $ssh->auth_password($password)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | unless ($authed) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | Rex::Logger::info( "LibSSH: authentication failed for $user\@$server: " | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ssh->error // ""
MC/DC0%0/1
$ssh->error // ""
$ssh->error
Truth table0%0/2
A
A= $ssh->error
| |||||||||||||||||||||||||||||||||||||||||||||||
| 102 | . ( $ssh->error // '' ), 'warn' ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $self->{error} = $ssh->error; | |||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | $self->{auth_ret} = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | Rex::Logger::debug("LibSSH: authenticated $user\@$server"); | |||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | delete $self->{error}; | |||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $self->{ssh} = $ssh; | |||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | $self->{auth_ret} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | sub reconnect { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reconnect: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | Rex::Logger::debug("LibSSH: reconnecting"); | |||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $self->connect( %{ $self->{__auth_info__} } ); | |||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | sub disconnect { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disconnect: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | if ( $self->{ssh} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $self->{ssh}->disconnect; | |||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | undef $self->{ssh}; | |||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | sub error { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | return $self->{ssh} ? $self->{ssh}->error : $self->{error}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | sub get_connection_object { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_connection_object: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | return $self->{ssh}; | |||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | sub get_fs_connection_object { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_fs_connection_object: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | return $self; # exec-based Fs needs no separate SFTP object | |||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | sub is_connected { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_connected: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | return $self->{connected} // 0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"connected"} // 0
MC/DC0%0/1
$self->{"connected"} // 0
$self->{"connected"}
Truth table0%0/2
A
A= $self->{"connected"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | sub is_authenticated { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_authenticated: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | return $self->{auth_ret} // 0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"auth_ret"} // 0
MC/DC0%0/1
$self->{"auth_ret"} // 0
$self->{"auth_ret"}
Truth table0%0/2
A
A= $self->{"auth_ret"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | sub get_connection_type { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_connection_type: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | return Rex::is_sudo() ? 'Sudo' : 'LibSSH'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||
| 161 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||