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
|
|
14
|
use v5.12.5; |
|
1
|
|
|
|
|
4
|
|
30
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
our $VERSION = '1.14.2.2'; # TRIAL VERSION |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
1
|
|
6
|
use Rex::Inventory; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
require Rex::Exporter; |
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
1
|
|
44
|
use vars qw(@EXPORT); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
39
|
1
|
|
|
1
|
|
5
|
use base qw(Rex::Exporter); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
177
|
|
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; |