$regstring = HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/NTDS/Parameters/ $value = LDAPServerIntegrity $expectedval = 2 I need to change the value of $value to $expectedval, but currently the path does not exist. The Registry path only goes this far: HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/ so, everything from NTDS on doesnt exist. if I try this: $HKEY_LOCAL_MACHINE->Open("SYSTEM", $system); $system->Create("CurrentControlSet/Services/NTDS/Parameters/LDAPServerIntegrity/TEST", $Test) || die "Create: $!"; It creates a key called "CurrentControlSet/Services/NTDS/Parameters/LDAPServerIntegrity/TEST" at the Services directory, it does not follow the / as folder path. #### use Win32::Registry; use Win32::TieRegistry(Delimiter=>"/"); use Win32::File; use strict; use warnings; sub print_decimal_hex { my $actual_val = shift; my $expected_val = shift; my $color = shift; # Print reg values in hex. print VALUES ""; if($actual_val !~ /\D/) { print VALUES "Decimal: $actual_val
"; print VALUES 'Hexadecimal: 0x', sprintf("%08x", $actual_val),"\n"; } else { print VALUES "$actual_val\n"; } print VALUES ""; if($expected_val !~ /\D/) { print VALUES "Decimal: $expected_val
"; print VALUES 'Hexadecimal: 0x', sprintf("%08x", $expected_val), "\n"; } else { print VALUES "$expected_val\n"; } } sub regvals { our $oskey; our $osval; my $Description; my $ExpectedResult; my $ActualResult; my $TestResult; my $Requirement; my $TestComments; my $TestNumber; print "Retrieving Registry Values...\n\n"; if($HKEY_LOCAL_MACHINE->Open('SOFTWARE\Microsoft\Windows NT\CurrentVersion', $oskey)) { $oskey->QueryValueEx('ProductName', REG_SZ, $osval); if($osval =~ /2003/ix) { open(KEYS, "scripts\\files\\registry_values_2003.txt") or warn "Couldn't open registry_values_2003.txt for reading\n"; } elsif($osval =~ /XP/ix) { open(KEYS, "scripts\\files\\registry_values_xp.txt") or warn "Couldn't open registry_values_xp.txt for reading\n"; } elsif($osval =~ /2000/ix) { open(KEYS, "scripts\\files\\registry_values_2000.txt") or warn "Couldn't open registry_values_2000.txt for reading\n"; } elsif($osval =~ /vista/ix) { open(KEYS, "scripts\\files\\registry_values_vista.txt") or warn "Couldn't open registry_values_vista.txt for reading\n"; } elsif($osval =~ /2008.*R2/ix) { open(KEYS, "scripts\\files\\registry_values_2008_r2.txt") or warn "Couldn't open registry_values_2008_r2.txt for reading\n"; } elsif($osval =~ /2008/ix) { open(KEYS, "scripts\\files\\registry_values_2008.txt") or warn "Couldn't open registry_values_2008.txt for reading\n"; } elsif($osval =~ /7/ix) { open(KEYS, "scripts\\files\\registry_values_7.txt") or warn "Couldn't open registry_values_7.txt for reading\n"; } else { open(KEYS, "scripts\\files\\registry_values_xp.txt") or warn "Couldn't open registry_values_xptxt for reading\n"; } } else { open(KEYS, "scripts\\files\\win2000RegVals.txt") or warn "Couldn't open win2000RegVals.txt for reading\n"; } # File which displays the registry values open(VALUES, ">C:\\Temp\\WASSP\\Files\\Regvals.html") or warn "Couldn't open Regvals.html for writing\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "Registry Values\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "

Registry Values

\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; my $regstring; my $value; my $type; my $expectedval; my $hkey; my $retval; my $val; my $description; my $comments; my $requirements; my $regkey; my $keys; my @reqs; my $risklevel; my $testnumber; my $recommendation; while() { chomp ($_); ($regstring,$value, $type, $expectedval,$description, $comments, $requirements, $risklevel, $testnumber, $recommendation) = split /;/, $_; @reqs = split /\+/ , $requirements; my $regkey; $regkey = $Registry->{$regstring}->{$value}; if(defined($regkey)) { print VALUES "\n"; if ($type =~ /REG\_BINARY/ix) { my $hexkey = bin2dec($regkey); if("$hexkey" ne "$expectedval") { print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($hexkey, $expectedval, 'red'); print FINDINGS "RegVals;$regstring
$value;$hexkey;$expectedval;$description
Type - $type;$risklevel;$testnumber;$requirements;$recommendation\n"; } else { print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($hexkey, $expectedval, 'green'); } print VALUES "\n"; print VALUES "\n"; print VALUES "\n" unless ($requirements ne ""); print VALUES "\n"; print VALUES "\n" unless ($comments eq ""); print VALUES "\n" unless ($comments ne ""); print VALUES "\n"; } else { $regkey = hex($regkey) if $regkey =~/^0/ix; if($value =~ /GreetingMessage/ix) { print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; } elsif($value =~ /Optional|os2libpath|os2|posix|defaultpassword/ix) { if(($regkey eq "") || ($regkey eq " ") || ($regkey =~ /^.$/i)) { print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; } else { #START ADDED to change the value vise just printing log #####contains dec2bin converstion##### my $nkey; my $okay; $regstring =~ s/\\/\//g; $regstring =~ s/^HKEY_USERS/Users/; $regstring =~ s/^HKEY_LOCAL_MACHINE/LMachine/; $regstring =~ s/^HKEY_CLASSES_ROOT/Classes/; $regstring =~ s/^HKEY_CURRENT_CONFIG/CConfig/; $regstring =~ s/^HKEY_CURRENT_USER/CUser/; $expectedval = dec2bin($expectedval) if ($type =~ /REG\_BINARY/ix); $expectedval = "" if $expectedval eq "Does not exist"; $nkey= new Win32::TieRegistry $regstring, { Access=>KEY_READ()|KEY_WRITE(), Delimiter=>"/" }; $okay= $nkey->SetValue( $value, $expectedval ); print "$regstring\n"; print "Actual Value: $value\n"; print "Will change to $expectedval\n\n"; $_ = ; #END ADDED print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print FINDINGS "RegVals;$regstring
$value;$regkey;$expectedval;$description
Type - $type;$risklevel;$testnumber;$requirements;$recommendation\n"; } } elsif($value =~ /WarningLevel/ix) { if($regkey <= 90 && $regkey >=1) { print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'green'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; } else { #START ADDED to change the value vise just printing log #####contains dec2bin converstion##### my $nkey; my $okay; $regstring =~ s/\\/\//g; $regstring =~ s/^HKEY_USERS/Users/; $regstring =~ s/^HKEY_LOCAL_MACHINE/LMachine/; $regstring =~ s/^HKEY_CLASSES_ROOT/Classes/; $regstring =~ s/^HKEY_CURRENT_CONFIG/CConfig/; $regstring =~ s/^HKEY_CURRENT_USER/CUser/; $expectedval = dec2bin($expectedval) if ($type =~ /REG\_BINARY/ix); $expectedval = "" if $expectedval eq "Does not exist"; $nkey= new Win32::TieRegistry $regstring, { Access=>KEY_READ()|KEY_WRITE(), Delimiter=>"/" }; $okay= $nkey->SetValue( $value, $expectedval ); print "$regstring\n"; print "Actual Value: $value\n"; print "Will change to $expectedval\n\n"; $_ = ; #END ADDED print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'red'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; print FINDINGS "RegVals;$regstring
$value;$regkey;$expectedval;$description
Type - $type;$risklevel;$testnumber;$requirements;$recommendation\n"; } } elsif($value =~ /KeepAliveTime/ix) { if($regkey =~ /300000|30\,000/ix) { print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'green'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; } else { #START ADDED to change the value vise just printing log #####contains dec2bin converstion##### my $nkey; my $okay; $regstring =~ s/\\/\//g; $regstring =~ s/^HKEY_USERS/Users/; $regstring =~ s/^HKEY_LOCAL_MACHINE/LMachine/; $regstring =~ s/^HKEY_CLASSES_ROOT/Classes/; $regstring =~ s/^HKEY_CURRENT_CONFIG/CConfig/; $regstring =~ s/^HKEY_CURRENT_USER/CUser/; $expectedval = dec2bin($expectedval) if ($type =~ /REG\_BINARY/ix); $expectedval = "" if $expectedval eq "Does not exist"; $nkey= new Win32::TieRegistry $regstring, { Access=>KEY_READ()|KEY_WRITE(), Delimiter=>"/" }; $okay= $nkey->SetValue( $value, $expectedval ); print "$regstring\n"; print "Actual Value: $value\n"; print "Will change to $expectedval\n\n"; $_ = ; #END ADDED print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'red'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; print FINDINGS "RegVals;$regstring
$value;$regkey;$expectedval;$description
Type - $type;$risklevel;$testnumber;$requirements;$recommendation\n"; } } elsif($value =~ /MaximumDynamicBacklog/ix) { if($regkey =~ /20000|20\,000/ix) { print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'green'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; } else { #START ADDED to change the value vise just printing log #####contains dec2bin converstion##### my $nkey; my $okay; $regstring =~ s/\\/\//g; $regstring =~ s/^HKEY_USERS/Users/; $regstring =~ s/^HKEY_LOCAL_MACHINE/LMachine/; $regstring =~ s/^HKEY_CLASSES_ROOT/Classes/; $regstring =~ s/^HKEY_CURRENT_CONFIG/CConfig/; $regstring =~ s/^HKEY_CURRENT_USER/CUser/; $expectedval = dec2bin($expectedval) if ($type =~ /REG\_BINARY/ix); $expectedval = "" if $expectedval eq "Does not exist"; $nkey= new Win32::TieRegistry $regstring, { Access=>KEY_READ()|KEY_WRITE(), Delimiter=>"/" }; $okay= $nkey->SetValue( $value, $expectedval ); print "$regstring\n"; print "Actual Value: $value\n"; print "Will change to $expectedval\n\n"; $_ = ; #END ADDED print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'red'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; print FINDINGS "RegVals;$regstring
$value;$regkey;$expectedval;$description
Type - $type;$risklevel;$testnumber;$requirements;$recommendation\n"; } } elsif($value =~ /MaxSize/ix) { if( ($regkey <= 4294901760) && ($regkey >=64) ) { print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'green'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; } else { #START ADDED to change the value vise just printing log #####contains dec2bin converstion##### my $nkey; my $okay; $regstring =~ s/\\/\//g; $regstring =~ s/^HKEY_USERS/Users/; $regstring =~ s/^HKEY_LOCAL_MACHINE/LMachine/; $regstring =~ s/^HKEY_CLASSES_ROOT/Classes/; $regstring =~ s/^HKEY_CURRENT_CONFIG/CConfig/; $regstring =~ s/^HKEY_CURRENT_USER/CUser/; $expectedval = dec2bin($expectedval) if ($type =~ /REG\_BINARY/ix); $expectedval = "" if $expectedval eq "Does not exist"; $nkey= new Win32::TieRegistry $regstring, { Access=>KEY_READ()|KEY_WRITE(), Delimiter=>"/" }; $okay= $nkey->SetValue( $value, $expectedval ); print "$regstring\n"; print "Actual Value: $value\n"; print "Will change to $expectedval\n\n"; $_ = ; #END ADDED print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'red'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; print FINDINGS "RegVals;$regstring
$value;$regkey;$expectedval;$description
Type - $type;$risklevel;$testnumber;$requirements;$recommendation\n"; } } elsif($value =~ /SCRNSAVE.EXE/ix) { if($regkey =~ /logon\.scr/mix) { print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'green'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; } else { #START ADDED to change the value vise just printing log #####contains dec2bin converstion##### my $nkey; my $okay; $regstring =~ s/\\/\//g; $regstring =~ s/^HKEY_USERS/Users/; $regstring =~ s/^HKEY_LOCAL_MACHINE/LMachine/; $regstring =~ s/^HKEY_CLASSES_ROOT/Classes/; $regstring =~ s/^HKEY_CURRENT_CONFIG/CConfig/; $regstring =~ s/^HKEY_CURRENT_USER/CUser/; $expectedval = dec2bin($expectedval) if ($type =~ /REG\_BINARY/ix); $expectedval = "" if $expectedval eq "Does not exist"; $nkey= new Win32::TieRegistry $regstring, { Access=>KEY_READ()|KEY_WRITE(), Delimiter=>"/" }; $okay= $nkey->SetValue( $value, $expectedval ); print "$regstring\n"; print "Actual Value: $value\n"; print "Will change to $expectedval\n\n"; $_ = ; #END ADDED print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'red'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; print FINDINGS "RegVals;$regstring
$value;$regkey;$expectedval;$description
Type - $type;$risklevel;$testnumber;$requirements;$recommendation\n"; } } elsif( ($regstring =~ /EventLog\/System|EventLog\/Application/ix) && ($value =~ /Retention/ix)) { if($regkey <= 1209600) { print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'green'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; } else { #START ADDED to change the value vise just printing log #####contains dec2bin converstion##### my $nkey; my $okay; $regstring =~ s/\\/\//g; $regstring =~ s/^HKEY_USERS/Users/; $regstring =~ s/^HKEY_LOCAL_MACHINE/LMachine/; $regstring =~ s/^HKEY_CLASSES_ROOT/Classes/; $regstring =~ s/^HKEY_CURRENT_CONFIG/CConfig/; $regstring =~ s/^HKEY_CURRENT_USER/CUser/; $expectedval = dec2bin($expectedval) if ($type =~ /REG\_BINARY/ix); $expectedval = "" if $expectedval eq "Does not exist"; $nkey= new Win32::TieRegistry $regstring, { Access=>KEY_READ()|KEY_WRITE(), Delimiter=>"/" }; $okay= $nkey->SetValue( $value, $expectedval ); print "$regstring\n"; print "Actual Value: $value\n"; print "Will change to $expectedval\n\n"; $_ = ; #END ADDED print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'red'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; print FINDINGS "RegVals;$regstring
$value;$regkey;$expectedval;$description
Type - $type;$risklevel;$testnumber;$requirements;$recommendation\n"; } } elsif($value =~ /ScreenSaveTimeOut/ix) { if($regkey <= 900) { print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'green'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; } else { #START ADDED to change the value vise just printing log #####contains dec2bin converstion##### my $nkey; my $okay; $regstring =~ s/\\/\//g; $regstring =~ s/^HKEY_USERS/Users/; $regstring =~ s/^HKEY_LOCAL_MACHINE/LMachine/; $regstring =~ s/^HKEY_CLASSES_ROOT/Classes/; $regstring =~ s/^HKEY_CURRENT_CONFIG/CConfig/; $regstring =~ s/^HKEY_CURRENT_USER/CUser/; $expectedval = dec2bin($expectedval) if ($type =~ /REG\_BINARY/ix); $expectedval = "" if $expectedval eq "Does not exist"; $nkey= new Win32::TieRegistry $regstring, { Access=>KEY_READ()|KEY_WRITE(), Delimiter=>"/" }; $okay= $nkey->SetValue( $value, $expectedval ); print "$regstring\n"; print "Actual Value: $value\n"; print "Will change to $expectedval\n\n"; $_ = ; #END ADDED print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'red'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; print FINDINGS "RegVals;$regstring
$value;$regkey;$expectedval;$description
Type - $type;$risklevel;$testnumber;$requirements;$recommendation\n"; } } elsif($value =~ /maximumpasswordage/ix) { if($regkey <= 90) { print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'green'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; } else { #START ADDED to change the value vise just printing log #####contains dec2bin converstion##### my $nkey; my $okay; $regstring =~ s/\\/\//g; $regstring =~ s/^HKEY_USERS/Users/; $regstring =~ s/^HKEY_LOCAL_MACHINE/LMachine/; $regstring =~ s/^HKEY_CLASSES_ROOT/Classes/; $regstring =~ s/^HKEY_CURRENT_CONFIG/CConfig/; $regstring =~ s/^HKEY_CURRENT_USER/CUser/; $expectedval = dec2bin($expectedval) if ($type =~ /REG\_BINARY/ix); $expectedval = "" if $expectedval eq "Does not exist"; $nkey= new Win32::TieRegistry $regstring, { Access=>KEY_READ()|KEY_WRITE(), Delimiter=>"/" }; $okay= $nkey->SetValue( $value, $expectedval ); print "$regstring\n"; print "Actual Value: $value\n"; print "Will change to $expectedval\n\n"; $_ = ; #END ADDED print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'red'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; print FINDINGS "RegVals;$regstring
$value;$regkey;$expectedval;$description
Type - $type;$risklevel;$testnumber;$requirements;$recommendation\n"; } } elsif($value =~ /SubmitControl|RefusePasswordChange|LDAPServerIntegrity/ix) { if($regkey eq "0") { print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'green'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; } else { #START ADDED to change the value vise just printing log #####contains dec2bin converstion##### my $nkey; my $okay; $regstring =~ s/\\/\//g; $regstring =~ s/^HKEY_USERS/Users/; $regstring =~ s/^HKEY_LOCAL_MACHINE/LMachine/; $regstring =~ s/^HKEY_CLASSES_ROOT/Classes/; $regstring =~ s/^HKEY_CURRENT_CONFIG/CConfig/; $regstring =~ s/^HKEY_CURRENT_USER/CUser/; $expectedval = dec2bin($expectedval) if ($type =~ /REG\_BINARY/ix); $expectedval = "" if $expectedval eq "Does not exist"; $nkey= new Win32::TieRegistry $regstring, { Access=>KEY_READ()|KEY_WRITE(), Delimiter=>"/" }; $okay= $nkey->SetValue( $value, $expectedval ); print "$regstring\n"; print "Actual Value: $value\n"; print "Will change to $expectedval\n\n"; $_ = ; #END ADDED print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'red'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; print FINDINGS "RegVals;$regstring
$value;$regkey;$expectedval;$description
Type - $type;$risklevel;$testnumber;$requirements;$recommendation\n"; } } elsif("$regkey" ne "$expectedval") { #START ADDED to change the value vise just printing log #####contains dec2bin converstion##### my $nkey; my $okay; $regstring =~ s/\\/\//g; $regstring =~ s/^HKEY_USERS/Users/; $regstring =~ s/^HKEY_LOCAL_MACHINE/LMachine/; $regstring =~ s/^HKEY_CLASSES_ROOT/Classes/; $regstring =~ s/^HKEY_CURRENT_CONFIG/CConfig/; $regstring =~ s/^HKEY_CURRENT_USER/CUser/; $expectedval = dec2bin($expectedval) if ($type =~ /REG\_BINARY/ix); $expectedval = "" if $expectedval eq "Does not exist"; $nkey= new Win32::TieRegistry $regstring, { Access=>KEY_READ()|KEY_WRITE(), Delimiter=>"/" }; $okay= $nkey->SetValue( $value, $expectedval ); print "$regstring\n"; print "Actual Value: $value\n"; print "Will change to $expectedval\n\n"; $_ = ; #END ADDED print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'red'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; print FINDINGS "RegVals;$regstring
$value;$regkey;$expectedval;$description
Type - $type;$risklevel;$testnumber;$requirements;$recommendation\n"; } else { print VALUES "\n"; print VALUES "\n"; &print_decimal_hex($regkey, $expectedval, 'green'); #DAVE E UPDATE: Print reg values in hex. #print VALUES "\n"; #print VALUES "\n"; } print VALUES "\n"; print VALUES "\n"; print VALUES "\n" unless ($requirements ne ""); print VALUES "\n"; print VALUES "\n" unless ($comments eq ""); print VALUES "\n" unless ($comments ne ""); print VALUES "\n"; } } elsif( ($value =~ /^\000\000$/) || ($value =~ /\/n/) ) { print VALUES "\n"; if($comments =~ /This.registry.value.should.not.exist|This.registry.value.should.be.null/ix) { print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; } else { print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print FINDINGS "RegVals;$regstring
$value;-;$expectedval;$description
Type - $type;$risklevel;$testnumber;$requirements;$recommendation\n"; } print VALUES "\n"; print VALUES "\n"; print VALUES "\n" unless ($requirements ne ""); print VALUES "\n"; print VALUES "\n" unless ($comments eq ""); print VALUES "\n" unless ($comments ne ""); print VALUES "\n"; } else { print VALUES "\n"; if($comments =~ /This.registry.value.should.not.exist|This.registry.value.should.be.null/ix) { print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; } else { print "\n\n$regstring\n\n$value\n\n"; print "$expectedval\n\n"; print "Registry Description:\n$description\n\n"; print "Do you want to add this registry? (y/n)"; my $answer; $answer = ; chomp $answer; if ($answer =~ /^[Yy]/) { $HKEY_LOCAL_MACHINE->Open("SYSTEM", $system); $system->Create("CurrentControlSet/Services/NTDS/Parameters/LDAPServerIntegrity/TEST", $Test) || die "Create: $!"; print "Added Successfully!\n\n\n"; } else { print "Not added.\n\n\n"; } print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; print FINDINGS "RegVals;$regstring
$value;-;$expectedval;$description
Type - $type;$risklevel;$testnumber;$requirements;$recommendation\n"; } print VALUES "\n"; print VALUES "\n"; print VALUES "\n" unless ($requirements ne ""); print VALUES "\n"; print VALUES "\n" unless ($comments eq ""); print VALUES "\n" unless ($comments ne ""); print VALUES "\n"; } } print VALUES "\n"; print VALUES "
Registry ValueTest ResultActual ValueExpected ValueVulnerability LevelDescriptionRequirementComments
$regstring
$value
Fail$regstring
$value
Pass$risklevel$description
Type - $type
-\n" unless ($requirements eq ""); my $req; foreach $req(@reqs) { print VALUES "$req
\n"; } print VALUES "
$comments-
$regstring
$value
Manual Review$regkey$expectedval$regstring
$value
Pass-$expectedval$regstring
$value
Fail$regkey$expectedval$regstring
$value
Pass"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Fail"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Pass"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Fail"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Pass"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Fail"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Pass"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Fail"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Pass"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Fail"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Pass"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Fail"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Pass"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Fail"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Pass"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Fail"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Pass"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Fail"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Fail"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$regstring
$value
Pass"; #print VALUES "$regkey
"; #print VALUES sprintf("%04x", $regkey),"
"; #print VALUES "$expectedval
"; #print VALUES sprintf("%04x", $expectedval), "
$risklevel$description
Type - $type
-\n" unless ($requirements eq ""); my $req; foreach $req(@reqs) { print VALUES "$req
\n"; } print VALUES "
$comments-
$regstring
$value
Pass-$expectedval$regstring
$value
Manual ReviewDoes not exist or not defined$expectedval$risklevel$description
Type - $type
-\n" unless ($requirements eq ""); my $req; foreach $req(@reqs) { print VALUES "$req
\n"; } print VALUES "
$comments-
$regstring
$value
Pass-$expectedval$regstring
$value
Manual ReviewDoes not exist or not defined$expectedval$risklevel$description
Type - $type
-\n" unless ($requirements eq ""); my $req; foreach $req(@reqs) { print VALUES "$req
\n"; } print VALUES "
$comments-
\n"; print VALUES "

\n"; print VALUES "\n"; print VALUES "\n"; print VALUES "\n"; close(KEYS); close(VALUES); } return 1;