script/regscan.pl untested

filter: Statementstmt 0.0% 0 / 33 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 31 MC/DCmcdc 0.0% 0 / 17 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 96 CC 1 SCAR 6.9
CC
1
Cov
0%
usage
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/local/bin/perl
2 use strict;
3 use warnings;
4  
5 use File::Basename;
6 use Getopt::Long;
7 use Parse::Win32Registry 0.50;
8  
9 binmode(STDOUT, ':utf8');
10  
11 Getopt::Long::Configure('bundling');
12  
13 GetOptions('parse-info|p' => \my $show_parse_info,
14 'unparsed|u' => \my $show_unparsed,
15 'allocated|a' => \my $list_allocated,
16 'keys|k' => \my $list_keys,
17 'values|v' => \my $list_values,
18 'security|s' => \my $list_security);
19  
20 my $filename = shift or die usage();
21  
22 my $registry = Parse::Win32Registry->new($filename)
23 or die "'$filename' is not a registry file\n";
24  
25 my $entry_iter = $registry->get_entry_iterator;
26  
27 while (defined(my $entry = $entry_iter->get_next)) {
28 next if $list_allocated && !$entry->is_allocated;
29 next if !((!$list_keys && !$list_values && !$list_security) ||
30 ($list_keys && $entry->can('get_subkey')) ||
31 ($list_values && $entry->can('get_data')) ||
32 ($list_security && $entry->can('get_security_descriptor')));
33  
34 if ($show_parse_info) {
35 print $entry->parse_info, "\n";
36 }
37 else {
38 printf "0x%x ", $entry->get_offset;
39 print $entry->as_string, "\n";
40 }
41 print $entry->unparsed if $show_unparsed;
42 }
43  
44 sub usage {
45 my $script_name = basename $0;
46 return <<USAGE;
47 $script_name for Parse::Win32Registry $Parse::Win32Registry::VERSION
48  
49 Displays the component elements of a registry file, without traversing
50 the current active key structure. This will display elements that are
51 associated with but are not actually keys or values. Additionally,
52 some of the keys, values, and associated elements displayed
53 will no longer be active and may be invalid or deleted.
54  
55 $script_name <filename> [-k] [-v] [-s] [-a] [-p] [-u]
56 -k or --keys list only 'key' entries
57 -v or --values list only 'value' entries
58 -s or --security list only 'security' entries
59 -a or --allocated list only 'allocated' entries
60 -p or --parse-info show the technical information for an entry
61 instead of the string representation
62 -u or --unparsed show the unparsed on-disk entries as a hex dump
63 USAGE
64 }