| 1 | package Parse::Win32Registry::Entry; | ||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||
| 3 | 13 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 4 | 13 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||
| 6 | 13 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 7 | 13 | ▶ | use Parse::Win32Registry::Base qw(:all); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||
| 9 | 0 | ▶ | sub get_regfile { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
get_regfile: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 10 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||
| 12 | 0 | return $self->{_regfile}; | |||||||||||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||
| 15 | 751 | ▶ | sub get_offset { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
get_offset: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 16 | 751 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||
| 18 | 751 | return $self->{_offset}; | |||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||
| 21 | 6956 | ▶ | sub get_length { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
get_length: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 22 | 6956 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||
| 24 | 6956 | return $self->{_length}; | |||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||
| 27 | 88 | ▶ | sub is_allocated { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
is_allocated: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 28 | 88 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||
| 30 | 88 | return $self->{_allocated}; | |||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||
| 33 | 88 | ▶ | sub get_tag { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
get_tag: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 34 | 88 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||
| 36 | 88 | return $self->{_tag}; | |||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||
| 39 | 4 | ▶ | sub as_string { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 40 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||
| 42 | 4 | my $tag = $self->{_tag}; | |||||||||||||||||||||||||||||||||||||
| 43 | 4 | ▶ | $tag = 'unidentified entry' if !defined $tag; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 44 | 4 | return "($tag)"; | |||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub parse_info { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_info: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 48 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||
| 50 | my $info = sprintf '0x%x %s len=0x%x', | ||||||||||||||||||||||||||||||||||||||
| 51 | $self->{_offset}, | ||||||||||||||||||||||||||||||||||||||
| 52 | $self->{_tag}, | ||||||||||||||||||||||||||||||||||||||
| 53 | 0 | $self->{_length}; | |||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||
| 55 | 0 | return $info; | |||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | sub unparsed { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
unparsed: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||
| 61 | 0 | return hexdump($self->get_raw_bytes, $self->get_offset); | |||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub get_raw_bytes { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
get_raw_bytes: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my $regfile = $self->{_regfile}; | |||||||||||||||||||||||||||||||||||||
| 68 | 0 | my $fh = $regfile->get_filehandle; | |||||||||||||||||||||||||||||||||||||
| 69 | 0 | my $offset = $self->{_offset}; | |||||||||||||||||||||||||||||||||||||
| 70 | 0 | my $length = $self->{_length}; | |||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if (defined $self->{_header_length}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 73 | 0 | $length = $self->{_header_length}; | |||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||
| 76 | 0 | sysseek($fh, $offset, 0); | |||||||||||||||||||||||||||||||||||||
| 77 | 0 | my $bytes_read = sysread($fh, my $buffer, $length); | |||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | if ($bytes_read == $length) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 79 | 0 | return $buffer; | |||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||
| 81 | else { | ||||||||||||||||||||||||||||||||||||||
| 82 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub looks_like_key { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
looks_like_key: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 87 | 0 | return UNIVERSAL::isa($_[0], "Parse::Win32Registry::Key"); | |||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | sub looks_like_value { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
looks_like_value: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 91 | 0 | return UNIVERSAL::isa($_[0], "Parse::Win32Registry::Value"); | |||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub looks_like_security { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
looks_like_security: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 95 | 0 | return UNIVERSAL::isa($_[0], "Parse::Win32Registry::WinNT::Security"); | |||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | sub _dumpvar { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_dumpvar: not called CC=17 SCAR=57.2
| |||||||||||||||||||||||||||||||||||||||
| 99 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | my $depth = shift || 1; | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 1
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my $dumpvar = ''; | |||||||||||||||||||||||||||||||||||||
| 103 | 0 | foreach (sort keys %$self) { | |||||||||||||||||||||||||||||||||||||
| 104 | 0 | $dumpvar .= ' ' x ($depth*2); | |||||||||||||||||||||||||||||||||||||
| 105 | 0 | $dumpvar .= "$_ => "; | |||||||||||||||||||||||||||||||||||||
| 106 | 0 | my $var = $self->{$_}; | |||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | if (!defined $var) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $dumpvar .= "undef\n"; | |||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||
| 110 | ▶ | elsif (/offset/ || /_id$/ || /^_unk/) { | |||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
/offset/ or /_id$/ or /^_unk/
/offset/ or /_id$/
MC/DC0%0/3
/offset/ or /_id$/ or /^_unk/
/offset/
/_id$/
/^_unk/
Truth table0%0/4
A or B or C
A= /offset/B= /_id$/C= /^_unk/
| |||||||||||||||||||||||||||||||||||||||
| 111 | 0 | $dumpvar .= sprintf "0x%x\n", $var; | |||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||
| 113 | elsif (/_flags$/) { | ||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $dumpvar .= sprintf "0x%x (0b%b)\n", $var, $var; | |||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||
| 116 | ▶ | elsif (/length/ || /bytes_used/) { | |||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
/length/ or /bytes_used/
MC/DC0%0/2
/length/ or /bytes_used/
/length/
/bytes_used/
Truth table0%0/3
A or B
A= /length/B= /bytes_used/
| |||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $dumpvar .= sprintf "0x%x (%d)\n", $var, $var; | |||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||
| 119 | elsif (/_data$/) { | ||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | if (length($var) == 0) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $dumpvar .= '(no data)'; | |||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||
| 123 | else { | ||||||||||||||||||||||||||||||||||||||
| 124 | 0 | $dumpvar .= join(' ', unpack('(H2)20', $var)); | |||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | if (length($var) > 20) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 126 | 0 | $dumpvar .= '...'; | |||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $dumpvar .= "\n"; | |||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||
| 131 | elsif (/timestamp$/) { | ||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $dumpvar .= $var . " (" . iso8601($var) . ")\n"; | |||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||
| 134 | elsif ($var =~ /^\d+$/) { | ||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $dumpvar .= sprintf "%d\n", $var; | |||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||
| 137 | elsif (ref($var)) { | ||||||||||||||||||||||||||||||||||||||
| 138 | 0 | $dumpvar .= "$var\n"; # stringify object ref | |||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||
| 140 | else { | ||||||||||||||||||||||||||||||||||||||
| 141 | 0 | $dumpvar .= qq{"$var"}; | |||||||||||||||||||||||||||||||||||||
| 142 | 0 | $dumpvar .= ' '; | |||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | $dumpvar .= Encode::is_utf8($var) ? "(UTF8)" : "(BYTES)"; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $dumpvar .= "\n"; | |||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||
| 148 | 0 | return $dumpvar; | |||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||
| 151 | 13 | 1; | |||||||||||||||||||||||||||||||||||||