line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Generic::SSH; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
108225403
|
use strict; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
40
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
68
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
403
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
238
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub isEnabled { |
9
|
0
|
|
|
0
|
0
|
|
return canRun('ssh-keyscan'); |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub doInventory { |
13
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $ssh_key = getFirstMatch( |
18
|
|
|
|
|
|
|
command => 'ssh-keyscan 127.0.0.1', |
19
|
|
|
|
|
|
|
pattern => qr/^[^#]\S+\s(ssh.*)/, |
20
|
|
|
|
|
|
|
@_, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
$inventory->setOperatingSystem({ |
24
|
|
|
|
|
|
|
SSH_KEY => $ssh_key |
25
|
|
|
|
|
|
|
}); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |