| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Rex::Commands::Inventory - Get an inventory of your systems |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
With this module you can get an inventory of your system. |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
All these functions will not be reported. These functions don't modify anything. |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Data::Dumper; |
|
18
|
|
|
|
|
|
|
task "inventory", "remoteserver", sub { |
|
19
|
|
|
|
|
|
|
my $inventory = inventory(); |
|
20
|
|
|
|
|
|
|
print Dumper($inventory); |
|
21
|
|
|
|
|
|
|
}; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 EXPORTED FUNCTIONS |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
package Rex::Commands::Inventory; |
|
28
|
|
|
|
|
|
|
|
|
29
|
1
|
|
|
1
|
|
18
|
use v5.12.5; |
|
|
1
|
|
|
|
|
6
|
|
|
30
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
49
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
our $VERSION = '1.14.3'; # VERSION |
|
33
|
|
|
|
|
|
|
|
|
34
|
1
|
|
|
1
|
|
21
|
use Rex::Inventory; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
21
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
require Rex::Exporter; |
|
37
|
|
|
|
|
|
|
|
|
38
|
1
|
|
|
1
|
|
40
|
use vars qw(@EXPORT); |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
51
|
|
|
39
|
1
|
|
|
1
|
|
5
|
use base qw(Rex::Exporter); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
138
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
@EXPORT = qw(inventor inventory); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 inventory |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
This function returns a hashRef of all gathered hardware. Use the Data::Dumper module to see its structure. |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
task "get_inventory", sub { |
|
48
|
|
|
|
|
|
|
my $inventory = inventory(); |
|
49
|
|
|
|
|
|
|
print Dumper($inventory); |
|
50
|
|
|
|
|
|
|
}; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub inventory { |
|
55
|
0
|
|
|
0
|
1
|
|
my $inv = Rex::Inventory->new; |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return $inv->get; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub inventor { |
|
61
|
0
|
|
|
0
|
0
|
|
return inventory(); |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |