line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Win32::Registry; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
50637393
|
use strict; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
89
|
|
4
|
1
|
|
|
1
|
|
15
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
75
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use English qw(-no_match_vars); |
|
1
|
|
|
|
|
37
|
|
|
1
|
|
|
|
|
21
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1228
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
136
|
|
9
|
1
|
|
|
1
|
|
493
|
use FusionInventory::Agent::Tools::Win32; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
394
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my @hives = qw/ |
13
|
|
|
|
|
|
|
HKEY_CLASSES_ROOT |
14
|
|
|
|
|
|
|
HKEY_CURRENT_USER |
15
|
|
|
|
|
|
|
HKEY_LOCAL_MACHINE |
16
|
|
|
|
|
|
|
HKEY_USERS |
17
|
|
|
|
|
|
|
HKEY_CURRENT_CONFIG |
18
|
|
|
|
|
|
|
HKEY_DYN_DATA |
19
|
|
|
|
|
|
|
/; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub isEnabled { |
22
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
0
|
|
|
|
return $params{registry} && @{$params{registry}}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _getRegistryData { |
28
|
0
|
|
|
0
|
|
|
my (%params) = @_; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my @data; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my @registrys = ref($params{registry}->{PARAM}) eq 'ARRAY' ? |
33
|
0
|
0
|
|
|
|
|
@{$params{registry}->{PARAM}} : |
34
|
|
|
|
|
|
|
($params{registry}->{PARAM}); |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
foreach my $option (@registrys) { |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $name = $option->{NAME}; |
39
|
0
|
|
|
|
|
|
my $regkey = $option->{REGKEY}; |
40
|
0
|
|
|
|
|
|
my $regtree = $option->{REGTREE}; |
41
|
0
|
|
|
|
|
|
my $content = $option->{content}; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# This should never append, err wait... |
44
|
0
|
0
|
|
|
|
|
next unless $content; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
$regkey =~ s{\\}{/}g; |
47
|
0
|
|
|
|
|
|
my $value = getRegistryValue( |
48
|
|
|
|
|
|
|
path => $hives[$regtree]."/".$regkey."/".$content, |
49
|
|
|
|
|
|
|
logger => $params{logger} |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
if (ref($value) eq "HASH") { |
53
|
0
|
|
|
|
|
|
foreach ( keys %$value ) { |
54
|
0
|
|
0
|
|
|
|
my $n = encodeFromRegistry($_) || ''; |
55
|
0
|
|
0
|
|
|
|
my $v = encodeFromRegistry($value->{$_}) || ''; |
56
|
0
|
|
|
|
|
|
push @data, { section => 'REGISTRY', entry => { |
57
|
|
|
|
|
|
|
NAME => $name, |
58
|
|
|
|
|
|
|
REGVALUE => "$n=$v" |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
}; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} else { |
63
|
0
|
|
|
|
|
|
push @data, {section => 'REGISTRY', entry => { |
64
|
|
|
|
|
|
|
NAME => $name, |
65
|
|
|
|
|
|
|
REGVALUE => encodeFromRegistry($value) |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
}; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return @data; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub doInventory { |
76
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
77
|
|
|
|
|
|
|
|
78
|
0
|
0
|
|
|
|
|
return unless $params{registry}->{NAME} eq 'REGISTRY'; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
foreach my $data (_getRegistryData( |
81
|
|
|
|
|
|
|
registry => $params{registry}, |
82
|
|
|
|
|
|
|
logger => $params{logger})) |
83
|
|
|
|
|
|
|
{ |
84
|
0
|
|
|
|
|
|
$params{inventory}->addEntry(%$data); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |