root/honeyclient/branches/exp/kindlund-dynamic_updates/bin/TestRegistry.pl

Revision 521, 2.0 kB (checked in by kindlund, 2 years ago)

Merged DB branch into trunk.

  • Property svn:executable set to *
  • Property svn:keywords set to Id "$file"
Line 
1 #!perl -w -Ilib
2 # Test script to monitor changes in Windows registry.
3 # $Id$
4
5 use HoneyClient::Agent::Integrity::Registry;
6 use Data::Dumper;
7 use File::Temp qw(:POSIX);
8
9 ### USER DEFINED OPTIONS ###
10
11 # Set this flag to 1, if you want a complete list of all
12 # registry changes -- instead of just a printout of directory
13 # key names.
14 my $more_detail = 0;
15
16 ############################
17
18 print "This script will help you identify registry key directories\n" .
19       "to ignore within your Registry module.\n\n" .
20       "Notes: Edit this script, if you would like to have the output show\n" .
21       "more detail.  Also, if you CTRL-C this script, then be sure to check\n" .
22       "your /tmp directory, to delete any temporary files created.\n\n".
23       "Press return to start baseline process...\n";
24
25 my $input = <>;
26
27 # Create the registry object.  Upon creation, the object
28 # will be initialized, by collecting a baseline of the registry.
29 my $registry = HoneyClient::Agent::Integrity::Registry->new();
30
31 print "\n";
32 print "Baseline check complete.  Perform normal allowable actions\n" .
33       "on the system (i.e., browse benign web pages).\n\n" .
34       "Press CTRL-D, when ready to perform an integrity check...\n";
35
36 $input = <>;
37
38 # Check the registry, for any changes.
39 print "Checking registry hives...\n";
40 my $changes = $registry->check();
41
42 if (!scalar(@{$changes})) {
43     print "No registry changes have occurred.\n";
44 } else {
45     print "Registry has changed:\n";
46
47     if ($more_detail) {
48         $Data::Dumper::Terse = 1;
49         $Data::Dumper::Indent = 1;
50         print Dumper($changes);
51     } else {
52         foreach my $change (@{$changes}) {
53             print $change->{'key_name'} . " (" . $change->{'status'} . ")\n";
54         }
55     }
56     my ($fh, $file) = tmpnam();
57     $Data::Dumper::Terse = 1;
58     $Data::Dumper::Indent = 1;
59     print $fh Dumper($changes);
60     print "\n";
61     print "Done!\n";
62     print "Detailed registry changes were written to: " . $file . "\n";
63 }
Note: See TracBrowser for help on using the browser.