Changeset 96

Show
Ignore:
Timestamp:
12/11/06 02:11:44 (2 years ago)
Author:
kindlund
Message:

Completed registry parser documentation and unit tests; corrected minor mispellings; updated POD documentation to reflect public website.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/branches/bug/42/etc/honeyclient.xml

    r70 r96  
    162162                ../t/testintegrity 
    163163            </test_dir> 
     164            <Registry> 
     165                <Parser> 
     166                    <!-- HoneyClient::Agent::Integrity::Registry::Parser::Test Options --> 
     167                    <Test> 
     168                        <!-- 
     169                            Note: you should *never* need to change *any* values 
     170                            within this section of the configuration.  All contents 
     171                            are *only* used for unit testing. 
     172                        --> 
     173                        <registry_file description="The relative path to a sample registry dump, that's used during unit testing." default="t/test_registry/dump.reg"> 
     174                            t/test_registry/dump.reg 
     175                        </registry_file> 
     176                    </Test> 
     177                </Parser> 
     178            </Registry> 
    164179        </Integrity> 
    165180    </Agent> 
     
    321336                    are *only* used for unit testing. 
    322337                --> 
    323                 <!-- TODO: Update this. --> 
    324338                <test_vm_config description="The relative path to the (empty) test VM, that's used during unit testing." default="t/testVM/winXPPro.vmx"> 
    325339                    t/testVM/winXPPro.vmx 
  • honeyclient/branches/bug/42/lib/HoneyClient/Agent.pm

    r70 r96  
    11171117=head1 SEE ALSO 
    11181118 
    1119 XXX: Fill this in. 
    1120  
    1121 XXX: If you have a mailing list, mention it here. 
    1122  
    1123 XXX: If you have a web site set up for your module, mention it here. 
     1119L<http://www.honeyclient.org/trac> 
    11241120 
    11251121=head1 REPORTING BUGS 
    11261122 
    1127 XXX: Mention website/mailing list to use, when reporting bugs. 
     1123L<http://www.honeyclient.org/trac/newticket> 
    11281124 
    11291125=head1 ACKNOWLEDGEMENTS 
  • honeyclient/branches/bug/42/lib/HoneyClient/Agent/Driver.pm

    r70 r96  
    160160# Make sure Log::Log4perl loads 
    161161BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) 
    162         or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly linsted within the path."); 
     162        or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly listed within the path."); 
    163163        
    164164        # Suppress all logging messages, since we need clean output for unit testing. 
     
    697697L<perltoot/"Autoloaded Data Methods"> 
    698698 
    699 XXX: If you have a mailing list, mention it here. 
    700  
    701 XXX: If you have a web site set up for your module, mention it here. 
     699L<http://www.honeyclient.org/trac> 
    702700 
    703701=head1 REPORTING BUGS 
    704702 
    705 XXX: Mention website/mailing list to use, when reporting bugs. 
     703L<http://www.honeyclient.org/trac/newticket> 
    706704 
    707705=head1 AUTHORS 
  • honeyclient/branches/bug/42/lib/HoneyClient/Agent/Driver/Browser.pm

    r73 r96  
    14541454=head1 SEE ALSO 
    14551455 
    1456 XXX: If you have a mailing list, mention it here. 
    1457  
    1458 XXX: If you have a web site set up for your module, mention it here. 
     1456L<http://www.honeyclient.org/trac> 
    14591457 
    14601458=head1 REPORTING BUGS 
    14611459 
    1462 XXX: Mention website/mailing list to use, when reporting bugs. 
     1460L<http://www.honeyclient.org/trac/newticket> 
    14631461 
    14641462=head1 AUTHORS 
  • honeyclient/branches/bug/42/lib/HoneyClient/Agent/Driver/Browser/FF.pm

    r70 r96  
    13011301=head1 SEE ALSO 
    13021302 
     1303L<http://www.honeyclient.org/trac> 
     1304 
    13031305LWP::UserAgent 
    13041306 
     
    13111313HoneyClient::Agent::Driver::IE 
    13121314 
    1313  
    1314 XXX: If you have a mailing list, mention it here. 
    1315  
    1316 XXX: If you have a web site set up for your module, mention it here. 
    1317  
    13181315=head1 REPORTING BUGS 
    13191316 
    1320 XXX: Mention website/mailing list to use, when reporting bugs. 
     1317L<http://www.honeyclient.org/trac/newticket> 
    13211318 
    13221319=head1 AUTHORS 
  • honeyclient/branches/bug/42/lib/HoneyClient/Agent/Integrity.pm

    r71 r96  
    18941894=head1 SEE ALSO 
    18951895 
     1896L<http://www.honeyclient.org/trac> 
     1897 
     1898=head1 REPORTING BUGS 
     1899 
     1900L<http://www.honeyclient.org/trac/newticket> 
     1901 
     1902=head1 ACKNOWLEDGEMENTS 
     1903 
    18961904XXX: Fill this in. 
    1897  
    1898 XXX: If you have a mailing list, mention it here. 
    1899  
    1900 XXX: If you have a web site set up for your module, mention it here. 
    1901  
    1902 =head1 REPORTING BUGS 
    1903  
    1904 XXX: Mention website/mailing list to use, when reporting bugs. 
    1905  
    1906 =head1 ACKNOWLEDGEMENTS 
    1907  
    19081905 
    19091906=head1 AUTHORS 
  • honeyclient/branches/bug/42/lib/HoneyClient/Agent/Integrity/Registry.pm

    r84 r96  
    8484  #     }, ], 
    8585  # }, ] 
    86   # 
    8786 
    8887=head1 DESCRIPTION 
     
    172171# Make sure Log::Log4perl loads 
    173172BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) 
    174         or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly linsted within the path."); 
     173        or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly listed within the path."); 
    175174        
    176175        # Suppress all logging messages, since we need clean output for unit testing. 
     
    206205# Make sure Data::Dumper loads 
    207206BEGIN { use_ok('Data::Dumper') 
    208         or diag("Can't load Data::Dumper package. Check to make sure the package library is correctly linsted within the path."); } 
     207        or diag("Can't load Data::Dumper package. Check to make sure the package library is correctly listed within the path."); } 
    209208require_ok('Data::Dumper'); 
    210209use Data::Dumper; 
     
    212211# Make sure Storable loads 
    213212BEGIN { use_ok('Storable', qw(dclone)) 
    214         or diag("Can't load Storable package. Check to make sure the package library is correctly linsted within the path."); } 
     213        or diag("Can't load Storable package. Check to make sure the package library is correctly listed within the path."); } 
    215214require_ok('Storable'); 
    216215can_ok('Storable', 'dclone'); 
     
    219218# Make sure IO::Handle loads 
    220219BEGIN { use_ok('IO::Handle') 
    221         or diag("Can't load IO::Handle package. Check to make sure the package library is correctly linsted within the path."); } 
     220        or diag("Can't load IO::Handle package. Check to make sure the package library is correctly listed within the path."); } 
    222221require_ok('IO::Handle'); 
    223222use IO::Handle; 
     
    225224# Make sure IO::File loads 
    226225BEGIN { use_ok('IO::File') 
    227         or diag("Can't load IO::File package. Check to make sure the package library is correctly linsted within the path."); } 
     226        or diag("Can't load IO::File package. Check to make sure the package library is correctly listed within the path."); } 
    228227require_ok('IO::File'); 
    229228use IO::File; 
     
    231230# Make sure Fcntl loads 
    232231BEGIN { use_ok('Fcntl') 
    233         or diag("Can't load Fcntl package. Check to make sure the package library is correctly linsted within the path."); } 
     232        or diag("Can't load Fcntl package. Check to make sure the package library is correctly listed within the path."); } 
    234233require_ok('Fcntl'); 
    235234use Fcntl qw(:seek); 
     
    237236# Make sure File::Temp loads 
    238237BEGIN { use_ok('File::Temp') 
    239         or diag("Can't load File::Temp package. Check to make sure the package library is correctly linsted within the path."); } 
     238        or diag("Can't load File::Temp package. Check to make sure the package library is correctly listed within the path."); } 
    240239require_ok('File::Temp'); 
    241240can_ok('File::Temp', 'tmpnam'); 
     
    245244# Make sure Filesys::CygwinPaths loads 
    246245BEGIN { use_ok('Filesys::CygwinPaths') 
    247         or diag("Can't load Filesys::CygwinPaths package. Check to make sure the package library is correctly linsted within the path."); } 
     246        or diag("Can't load Filesys::CygwinPaths package. Check to make sure the package library is correctly listed within the path."); } 
    248247require_ok('Filesys::CygwinPaths'); 
    249248use Filesys::CygwinPaths qw(:all); 
     
    10761075L<http://www.cs.mun.ca/~michael/regutils/> 
    10771076 
    1078 XXX: If you have a mailing list, mention it here. 
    1079  
    1080 XXX: If you have a web site set up for your module, mention it here. 
     1077L<http://www.honeyclient.org/trac> 
    10811078 
    10821079=head1 REPORTING BUGS 
    10831080 
    1084 XXX: Mention website/mailing list to use, when reporting bugs. 
     1081L<http://www.honeyclient.org/trac/newticket> 
    10851082 
    10861083=head1 ACKNOWLEDGEMENTS 
  • honeyclient/branches/bug/42/lib/HoneyClient/Agent/Integrity/Registry/Parser.pm

    r95 r96  
    155155# Make sure Log::Log4perl loads 
    156156BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) 
    157         or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly linsted within the path."); 
     157        or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly listed within the path."); 
    158158        
    159159        # Suppress all logging messages, since we need clean output for unit testing. 
     
    189189# Make sure Data::Dumper loads 
    190190BEGIN { use_ok('Data::Dumper') 
    191         or diag("Can't load Data::Dumper package. Check to make sure the package library is correctly linsted within the path."); } 
     191        or diag("Can't load Data::Dumper package. Check to make sure the package library is correctly listed within the path."); } 
    192192require_ok('Data::Dumper'); 
    193193use Data::Dumper; 
     
    195195# Make sure IO::File loads 
    196196BEGIN { use_ok('IO::File') 
    197         or diag("Can't load IO::File package. Check to make sure the package library is correctly linsted within the path."); } 
     197        or diag("Can't load IO::File package. Check to make sure the package library is correctly listed within the path."); } 
    198198require_ok('IO::File'); 
    199199use IO::File; 
     200 
     201# Make sure HoneyClient::Agent::Integrity::Registry::Parser loads 
     202BEGIN { use_ok('HoneyClient::Agent::Integrity::Registry::Parser') 
     203        or diag("Can't load HoneyClient::Agent::Integrity::Registry::Parser package. Check to make sure the package library is correctly listed within the path."); } 
     204require_ok('HoneyClient::Agent::Integrity::Registry::Parser'); 
     205use HoneyClient::Agent::Integrity::Registry::Parser; 
    200206 
    201207=end testing 
     
    338344         'registry', 0, 
    339345sub 
    340 #line 212 "Parser.yp" 
     346#line 218 "Parser.yp" 
    341347{ 
    342348            $LOG->debug("Reached end of input stream."); 
     
    348354         'registry', 1, 
    349355sub 
    350 #line 217 "Parser.yp" 
     356#line 223 "Parser.yp" 
    351357{ 
    352358            $LOG->debug("Reached end of input stream."); 
     
    358364         'registry', 2, 
    359365sub 
    360 #line 222 "Parser.yp" 
     366#line 228 "Parser.yp" 
    361367{ 
    362368            $LOG->debug("Reached end of input stream."); 
     
    380386         'group', 2, 
    381387sub 
    382 #line 239 "Parser.yp" 
     388#line 245 "Parser.yp" 
    383389{ 
    384390            my $ret = { }; 
     
    399405         'group', 1, 
    400406sub 
    401 #line 253 "Parser.yp" 
     407#line 259 "Parser.yp" 
    402408{ 
    403409            my $ret = { }; 
     
    424430         'entry', 2, 
    425431sub 
    426 #line 277 "Parser.yp" 
     432#line 283 "Parser.yp" 
    427433{ 
    428434            my $entry = { 
     
    439445} 
    440446 
    441 #line 287 "Parser.yp" 
     447#line 293 "Parser.yp" 
    442448 
    443449 
     
    561567=begin testing 
    562568 
     569my $test_registry_file = $ENV{PWD} . "/" . getVar(name      => "registry_file", 
     570                                                  namespace => "HoneyClient::Agent::Integrity::Registry::Parser::Test"); 
     571 
    563572# Create a generic Parser object, with test state data. 
    564 #my $registry = HoneyClient::Agent::Integrity::Registry->new(test => 1); 
    565 #is($registry->{test}, 1, "new(test => 1)") or diag("The new() call failed."); 
    566 is(1,1); 
     573my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); 
     574isa_ok($parser, 'HoneyClient::Agent::Integrity::Registry::Parser', "init(input_file => $test_registry_file)") or diag("The init() call failed."); 
    567575 
    568576=end testing 
     
    628636} 
    629637 
    630 # TODO: Comment this. 
     638=pod 
     639 
     640=head2 $object->nextGroup() 
     641 
     642=over 4 
     643 
     644Provides the next registry group, in the form of a hashtable reference. 
     645This hashtable has the following format: 
     646 
     647  { 
     648      # The registry directory name. 
     649      'key' => 'HKEY_LOCAL_MACHINE\Software...', 
     650   
     651      # An array containing the list of entries within the 
     652      # registry directory. 
     653      'entries'  => [ { 
     654          'name' => "\"string\"",  # A (potentially) quoted string;  
     655                                   # "@" for default 
     656          'value' => "data", 
     657      }, ], 
     658  }; 
     659 
     660I<Output>: A hashtable reference if the next group was parsed successfully; 
     661returns undef, if the Parser B<$object> has reached the end of the input stream. 
     662 
     663=back 
     664 
     665=begin testing 
     666 
     667my ($nextGroup, $expectedGroup); 
     668my $test_registry_file = $ENV{PWD} . "/" . getVar(name      => "registry_file", 
     669                                                  namespace => "HoneyClient::Agent::Integrity::Registry::Parser::Test"); 
     670 
     671# Create a generic Parser object, with test state data. 
     672my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); 
     673 
     674# Verify Test Group #1 
     675$nextGroup = $parser->nextGroup(); 
     676$expectedGroup = { 
     677    key     => 'HKEY_CURRENT_USER\]Testing Group 1[', 
     678    entries => [ { 
     679        name  => '@', 
     680        value => 'Default', 
     681    }, { 
     682        name  => 'Foo', 
     683        value => 'Bar', 
     684    }, ], 
     685}; 
     686is_deeply($nextGroup, $expectedGroup, "nextGroup() - 1") or diag("The nextGroup() call failed."); 
     687 
     688# Verify Test Group #2 
     689$nextGroup = $parser->nextGroup(); 
     690$expectedGroup = { 
     691    key     => 'HKEY_CURRENT_USER\Testing Group 2', 
     692    entries => [ { 
     693        name  => '@', 
     694        value => '\\"Annoying=Value\\"', 
     695    }, { 
     696        name  => '\\"Annoying=Key\\"', 
     697        value => 'Bar', 
     698    }, { 
     699        name  => 'Multiline', 
     700        value => 'This 
     701value spans 
     702multiple lines 
     703', 
     704    }, { 
     705        name  => 'Sane_Key', 
     706        value => '\\"Wierd=\\"Value', 
     707    }, ], 
     708}; 
     709is_deeply($nextGroup, $expectedGroup, "nextGroup() - 2") or diag("The nextGroup() call failed."); 
     710 
     711# Verify Test Group #3 
     712$nextGroup = $parser->nextGroup(); 
     713$expectedGroup = { 
     714    key     => 'HKEY_CURRENT_USER\Testing Group 3', 
     715    entries => [ { 
     716        name  => 'Test_Bin_1', 
     717        value => 'hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,bc,02,00,00,00,\ 
     718  00,00,00,00,00,00,00,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,f0,77,3f,00,\ 
     719  3f,00,3f,00,3f,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,78,00,1c,10,fc,\ 
     720  7f,22,14,fc,7f,b0,fe,12,00,00,00,00,00,00,00,00,00,98,23,eb,77' 
     721    }, { 
     722        name  => 'Test_Bin_2', 
     723        value => 'hex:f5,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,\ 
     724  00,00,00,00,00,00,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,\ 
     725  20,00,53,00,61,00,6e,00,73,00,20,00,53,00,65,00,72,00,69,00,66,00,00,00,f0,\ 
     726  77,00,20,14,00,00,00,00,10,80,05,14,00,f0,1f,14,00,00,00,14,00' 
     727    }, ], 
     728}; 
     729is_deeply($nextGroup, $expectedGroup, "nextGroup() - 3") or diag("The nextGroup() call failed."); 
     730 
     731# Verify Test Group #4 
     732$nextGroup = $parser->nextGroup(); 
     733$expectedGroup = { 
     734    key     => 'HKEY_CURRENT_USER\Testing Group 4', 
     735    entries => [], 
     736}; 
     737is_deeply($nextGroup, $expectedGroup, "nextGroup() - 4") or diag("The nextGroup() call failed."); 
     738 
     739# Verify Test Group #5 
     740$nextGroup = $parser->nextGroup(); 
     741$expectedGroup = { 
     742    key     => 'HKEY_CURRENT_USER\Testing Group 5', 
     743    entries => [ { 
     744        name  => '@', 
     745        value => '', 
     746    }, ], 
     747}; 
     748is_deeply($nextGroup, $expectedGroup, "nextGroup() - 5") or diag("The nextGroup() call failed."); 
     749 
     750# Verify Test Group #6 
     751$nextGroup = $parser->nextGroup(); 
     752$expectedGroup = { 
     753    key     => 'HKEY_CURRENT_USER\Testing Group 6\With\Really\Deep\Nested\Directory\Structure', 
     754    entries => [ { 
     755        name  => 'InstallerLocation', 
     756        value => 'C:\\\\WINDOWS\\\\system32\\\\', 
     757    }, ], 
     758}; 
     759is_deeply($nextGroup, $expectedGroup, "nextGroup() - 6") or diag("The nextGroup() call failed."); 
     760 
     761# Verify Test Group #7 
     762$nextGroup = $parser->nextGroup(); 
     763$expectedGroup = { 
     764    key     => 'HKEY_CURRENT_USER\Testing Group 7', 
     765    entries => [ { 
     766        name  => 'C:\\\\Program Files\\\\Common Files\\\\Microsoft Shared\\\\Web Folders\\\\', 
     767        value => '', 
     768    }, { 
     769        name  => 'C:\\\\WINDOWS\\\\Installer\\\\{350C97B0-3D7C-4EE8-BAA9-00BCB3D54227}\\\\', 
     770        value => '', 
     771    }, { 
     772        name  => 'C:\\\\Program Files\\\\Support Tools\\\\', 
     773        value => '', 
     774    }, { 
     775        name  => 'C:\\\\Documents and Settings\\\\All Users\\\\Start Menu\\\\Programs\\\\Windows Support Tools\\\\', 
     776        value => '', 
     777    }, { 
     778        name  => 'C:\\\\WINDOWS\\\\Installer\\\\{6855CCDD-BDF9-48E4-B80A-80DFB96FE36C}\\\\', 
     779        value => '', 
     780    }, { 
     781        name  => 'C:\\\\WINDOWS\\\\Installer\\\\{F251B999-08A9-4704-999C-9962F0DFD88E}\\\\', 
     782        value => '', 
     783    }, { 
     784        name  => 'C:\\\\WINDOWS\\\\Installer\\\\{1CB92574-96F2-467B-B793-5CEB35C40C29}\\\\', 
     785        value => '', 
     786    }, { 
     787        name  => 'C:\\\\WINDOWS\\\\Installer\\\\{B37C842A-B624-46B8-A727-654E72F1C91A}\\\\', 
     788        value => '', 
     789    }, ], 
     790}; 
     791is_deeply($nextGroup, $expectedGroup, "nextGroup() - 7") or diag("The nextGroup() call failed."); 
     792 
     793# Verify Test Group #8 
     794$nextGroup = $parser->nextGroup(); 
     795$expectedGroup = { 
     796    key     => 'HKEY_CURRENT_USER\Testing Group 8\{00021492-0000-0000-C000-000000000046}', 
     797    entries => [ { 
     798        name  => '000', 
     799        value => 'String Value', 
     800    }, ], 
     801}; 
     802is_deeply($nextGroup, $expectedGroup, "nextGroup() - 8") or diag("The nextGroup() call failed."); 
     803 
     804# Verify Test Group #9 
     805$nextGroup = $parser->nextGroup(); 
     806is_deeply($nextGroup, undef, "nextGroup() - 9") or diag("The nextGroup() call failed."); 
     807 
     808=end testing 
     809 
     810=cut 
     811 
    631812sub nextGroup { 
    632813    # Extract arguments. 
     
    648829} 
    649830 
    650 # TODO: Comment this. 
     831=pod 
     832 
     833=head2 $object->dirsParsed() 
     834 
     835=over 4 
     836 
     837Indicates how many registry directories the Parser B<$object> has 
     838parsed within the specified file, so far. 
     839 
     840I<Output>: Returns the number of directory groups parsed so far; 
     841returns 0, if none parsed yet. 
     842 
     843=back 
     844 
     845=begin testing 
     846 
     847my ($nextGroup); 
     848my $test_registry_file = $ENV{PWD} . "/" . getVar(name      => "registry_file", 
     849                                                  namespace => "HoneyClient::Agent::Integrity::Registry::Parser::Test"); 
     850 
     851# Create a generic Parser object, with test state data. 
     852my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); 
     853 
     854while(defined($nextGroup = $parser->nextGroup)) { 
     855
     856 
     857is($parser->dirsParsed(), 8, "dirsParsed()") or diag("The dirsParsed() call failed."); 
     858 
     859=end testing 
     860 
     861=cut 
     862 
    651863sub dirsParsed { 
    652864    # Extract arguments. 
     
    662874} 
    663875 
    664 # TODO: Comment this. 
     876=pod 
     877 
     878=head2 $object->entriesParsed() 
     879 
     880=over 4 
     881 
     882Indicates how many registry key/value pairs the Parser B<$object> has 
     883parsed within the specified file, so far. 
     884 
     885I<Output>: Returns the number of key/value pairs parsed so far; 
     886returns 0, if none parsed yet. 
     887 
     888=back 
     889 
     890=begin testing 
     891 
     892my ($nextGroup); 
     893my $test_registry_file = $ENV{PWD} . "/" . getVar(name      => "registry_file", 
     894                                                  namespace => "HoneyClient::Agent::Integrity::Registry::Parser::Test"); 
     895 
     896# Create a generic Parser object, with test state data. 
     897my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); 
     898 
     899while(defined($nextGroup = $parser->nextGroup)) { 
     900
     901 
     902is($parser->entriesParsed(), 19, "entriesParsed()") or diag("The entriesParsed() call failed."); 
     903 
     904=end testing 
     905 
     906=cut 
     907 
    665908sub entriesParsed { 
    666909    # Extract arguments. 
     
    682925=head1 BUGS & ASSUMPTIONS 
    683926 
    684 XXX: Fill this in. 
     927The Parser B<$object> expects to scan the specified file as an input stream. 
     928Subsequent calls to $object->nextGroup() will advance the parser through 
     929the input stream. 
     930 
     931Currently, there is no way to reset a Parser's scan through an input stream. 
     932If desired, simply create a new Parser object, to restart the scan process. 
    685933 
    686934=head1 SEE ALSO 
    687935 
    688 XXX: If you have a mailing list, mention it here. 
    689  
    690 XXX: If you have a web site set up for your module, mention it here. 
     936L<http://www.honeyclient.org/trac> 
    691937 
    692938=head1 REPORTING BUGS 
    693939 
    694 XXX: Mention website/mailing list to use, when reporting bugs. 
     940L<http://www.honeyclient.org/trac/newticket> 
    695941 
    696942=head1 ACKNOWLEDGEMENTS 
  • honeyclient/branches/bug/42/lib/HoneyClient/Agent/Integrity/Registry/Parser.yp

    r95 r96  
    138138# Make sure Log::Log4perl loads 
    139139BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) 
    140         or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly linsted within the path."); 
     140        or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly listed within the path."); 
    141141        
    142142        # Suppress all logging messages, since we need clean output for unit testing. 
     
    172172# Make sure Data::Dumper loads 
    173173BEGIN { use_ok('Data::Dumper') 
    174         or diag("Can't load Data::Dumper package. Check to make sure the package library is correctly linsted within the path."); } 
     174        or diag("Can't load Data::Dumper package. Check to make sure the package library is correctly listed within the path."); } 
    175175require_ok('Data::Dumper'); 
    176176use Data::Dumper; 
     
    178178# Make sure IO::File loads 
    179179BEGIN { use_ok('IO::File') 
    180         or diag("Can't load IO::File package. Check to make sure the package library is correctly linsted within the path."); } 
     180        or diag("Can't load IO::File package. Check to make sure the package library is correctly listed within the path."); } 
    181181require_ok('IO::File'); 
    182182use IO::File; 
     183 
     184# Make sure HoneyClient::Agent::Integrity::Registry::Parser loads 
     185BEGIN { use_ok('HoneyClient::Agent::Integrity::Registry::Parser') 
     186        or diag("Can't load HoneyClient::Agent::Integrity::Registry::Parser package. Check to make sure the package library is correctly listed within the path."); } 
     187require_ok('HoneyClient::Agent::Integrity::Registry::Parser'); 
     188use HoneyClient::Agent::Integrity::Registry::Parser; 
    183189 
    184190=end testing 
     
    406412=begin testing 
    407413 
     414my $test_registry_file = $ENV{PWD} . "/" . getVar(name      => "registry_file", 
     415                                                  namespace => "HoneyClient::Agent::Integrity::Registry::Parser::Test"); 
     416 
    408417# Create a generic Parser object, with test state data. 
    409 #my $registry = HoneyClient::Agent::Integrity::Registry->new(test => 1); 
    410 #is($registry->{test}, 1, "new(test => 1)") or diag("The new() call failed."); 
    411 is(1,1); 
     418my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); 
     419isa_ok($parser, 'HoneyClient::Agent::Integrity::Registry::Parser', "init(input_file => $test_registry_file)") or diag("The init() call failed."); 
    412420 
    413421=end testing 
     
    473481} 
    474482 
    475 # TODO: Comment this. 
     483=pod 
     484 
     485=head2 $object->nextGroup() 
     486 
     487=over 4 
     488 
     489Provides the next registry group, in the form of a hashtable reference. 
     490This hashtable has the following format: 
     491 
     492  { 
     493      # The registry directory name. 
     494      'key' => 'HKEY_LOCAL_MACHINE\Software...', 
     495   
     496      # An array containing the list of entries within the 
     497      # registry directory. 
     498      'entries'  => [ { 
     499          'name' => "\"string\"",  # A (potentially) quoted string;  
     500                                   # "@" for default 
     501          'value' => "data", 
     502      }, ], 
     503  }; 
     504 
     505I<Output>: A hashtable reference if the next group was parsed successfully; 
     506returns undef, if the Parser B<$object> has reached the end of the input stream. 
     507 
     508=back 
     509 
     510=begin testing 
     511 
     512my ($nextGroup, $expectedGroup); 
     513my $test_registry_file = $ENV{PWD} . "/" . getVar(name      => "registry_file", 
     514                                                  namespace => "HoneyClient::Agent::Integrity::Registry::Parser::Test"); 
     515 
     516# Create a generic Parser object, with test state data. 
     517my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); 
     518 
     519# Verify Test Group #1 
     520$nextGroup = $parser->nextGroup(); 
     521$expectedGroup = { 
     522    key     => 'HKEY_CURRENT_USER\]Testing Group 1[', 
     523    entries => [ { 
     524        name  => '@', 
     525        value => 'Default', 
     526    }, { 
     527        name  => 'Foo', 
     528        value => 'Bar', 
     529    }, ], 
     530}; 
     531is_deeply($nextGroup, $expectedGroup, "nextGroup() - 1") or diag("The nextGroup() call failed."); 
     532 
     533# Verify Test Group #2 
     534$nextGroup = $parser->nextGroup(); 
     535$expectedGroup = { 
     536    key     => 'HKEY_CURRENT_USER\Testing Group 2', 
     537    entries => [ { 
     538        name  => '@', 
     539        value => '\\"Annoying=Value\\"', 
     540    }, { 
     541        name  => '\\"Annoying=Key\\"', 
     542        value => 'Bar', 
     543    }, { 
     544        name  => 'Multiline', 
     545        value => 'This 
     546value spans 
     547multiple lines 
     548', 
     549    }, { 
     550        name  => 'Sane_Key', 
     551        value => '\\"Wierd=\\"Value', 
     552    }, ], 
     553}; 
     554is_deeply($nextGroup, $expectedGroup, "nextGroup() - 2") or diag("The nextGroup() call failed."); 
     555 
     556# Verify Test Group #3 
     557$nextGroup = $parser->nextGroup(); 
     558$expectedGroup = { 
     559    key     => 'HKEY_CURRENT_USER\Testing Group 3', 
     560    entries => [ { 
     561        name  => 'Test_Bin_1', 
     562        value => 'hex:f4,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,bc,02,00,00,00,\ 
     563  00,00,00,00,00,00,00,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,f0,77,3f,00,\ 
     564  3f,00,3f,00,3f,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,78,00,1c,10,fc,\ 
     565  7f,22,14,fc,7f,b0,fe,12,00,00,00,00,00,00,00,00,00,98,23,eb,77' 
     566    }, { 
     567        name  => 'Test_Bin_2', 
     568        value => 'hex:f5,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,\ 
     569  00,00,00,00,00,00,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,\ 
     570  20,00,53,00,61,00,6e,00,73,00,20,00,53,00,65,00,72,00,69,00,66,00,00,00,f0,\ 
     571  77,00,20,14,00,00,00,00,10,80,05,14,00,f0,1f,14,00,00,00,14,00' 
     572    }, ], 
     573}; 
     574is_deeply($nextGroup, $expectedGroup, "nextGroup() - 3") or diag("The nextGroup() call failed."); 
     575 
     576# Verify Test Group #4 
     577$nextGroup = $parser->nextGroup(); 
     578$expectedGroup = { 
     579    key     => 'HKEY_CURRENT_USER\Testing Group 4', 
     580    entries => [], 
     581}; 
     582is_deeply($nextGroup, $expectedGroup, "nextGroup() - 4") or diag("The nextGroup() call failed."); 
     583 
     584# Verify Test Group #5 
     585$nextGroup = $parser->nextGroup(); 
     586$expectedGroup = { 
     587    key     => 'HKEY_CURRENT_USER\Testing Group 5', 
     588    entries => [ { 
     589        name  => '@', 
     590        value => '', 
     591    }, ], 
     592}; 
     593is_deeply($nextGroup, $expectedGroup, "nextGroup() - 5") or diag("The nextGroup() call failed."); 
     594 
     595# Verify Test Group #6 
     596$nextGroup = $parser->nextGroup(); 
     597$expectedGroup = { 
     598    key     => 'HKEY_CURRENT_USER\Testing Group 6\With\Really\Deep\Nested\Directory\Structure', 
     599    entries => [ { 
     600        name  => 'InstallerLocation', 
     601        value => 'C:\\\\WINDOWS\\\\system32\\\\', 
     602    }, ], 
     603}; 
     604is_deeply($nextGroup, $expectedGroup, "nextGroup() - 6") or diag("The nextGroup() call failed."); 
     605 
     606# Verify Test Group #7 
     607$nextGroup = $parser->nextGroup(); 
     608$expectedGroup = { 
     609    key     => 'HKEY_CURRENT_USER\Testing Group 7', 
     610    entries => [ { 
     611        name  => 'C:\\\\Program Files\\\\Common Files\\\\Microsoft Shared\\\\Web Folders\\\\', 
     612        value => '', 
     613    }, { 
     614        name  => 'C:\\\\WINDOWS\\\\Installer\\\\{350C97B0-3D7C-4EE8-BAA9-00BCB3D54227}\\\\', 
     615        value => '', 
     616    }, { 
     617        name  => 'C:\\\\Program Files\\\\Support Tools\\\\', 
     618        value => '', 
     619    }, { 
     620        name  => 'C:\\\\Documents and Settings\\\\All Users\\\\Start Menu\\\\Programs\\\\Windows Support Tools\\\\', 
     621        value => '', 
     622    }, { 
     623        name  => 'C:\\\\WINDOWS\\\\Installer\\\\{6855CCDD-BDF9-48E4-B80A-80DFB96FE36C}\\\\', 
     624        value => '', 
     625    }, { 
     626        name  => 'C:\\\\WINDOWS\\\\Installer\\\\{F251B999-08A9-4704-999C-9962F0DFD88E}\\\\', 
     627        value => '', 
     628    }, { 
     629        name  => 'C:\\\\WINDOWS\\\\Installer\\\\{1CB92574-96F2-467B-B793-5CEB35C40C29}\\\\', 
     630        value => '', 
     631    }, { 
     632        name  => 'C:\\\\WINDOWS\\\\Installer\\\\{B37C842A-B624-46B8-A727-654E72F1C91A}\\\\', 
     633        value => '', 
     634    }, ], 
     635}; 
     636is_deeply($nextGroup, $expectedGroup, "nextGroup() - 7") or diag("The nextGroup() call failed."); 
     637 
     638# Verify Test Group #8 
     639$nextGroup = $parser->nextGroup(); 
     640$expectedGroup = { 
     641    key     => 'HKEY_CURRENT_USER\Testing Group 8\{00021492-0000-0000-C000-000000000046}', 
     642    entries => [ { 
     643        name  => '000', 
     644        value => 'String Value', 
     645    }, ], 
     646}; 
     647is_deeply($nextGroup, $expectedGroup, "nextGroup() - 8") or diag("The nextGroup() call failed."); 
     648 
     649# Verify Test Group #9 
     650$nextGroup = $parser->nextGroup(); 
     651is_deeply($nextGroup, undef, "nextGroup() - 9") or diag("The nextGroup() call failed."); 
     652 
     653=end testing 
     654 
     655=cut 
     656 
    476657sub nextGroup { 
    477658    # Extract arguments. 
     
    493674} 
    494675 
    495 # TODO: Comment this. 
     676=pod 
     677 
     678=head2 $object->dirsParsed() 
     679 
     680=over 4 
     681 
     682Indicates how many registry directories the Parser B<$object> has 
     683parsed within the specified file, so far. 
     684 
     685I<Output>: Returns the number of directory groups parsed so far; 
     686returns 0, if none parsed yet. 
     687 
     688=back 
     689 
     690=begin testing 
     691 
     692my ($nextGroup); 
     693my $test_registry_file = $ENV{PWD} . "/" . getVar(name      => "registry_file", 
     694                                                  namespace => "HoneyClient::Agent::Integrity::Registry::Parser::Test"); 
     695 
     696# Create a generic Parser object, with test state data. 
     697my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); 
     698 
     699while(defined($nextGroup = $parser->nextGroup)) { 
     700
     701 
     702is($parser->dirsParsed(), 8, "dirsParsed()") or diag("The dirsParsed() call failed."); 
     703 
     704=end testing 
     705 
     706=cut 
     707 
    496708sub dirsParsed { 
    497709    # Extract arguments. 
     
    507719} 
    508720 
    509 # TODO: Comment this. 
     721=pod 
     722 
     723=head2 $object->entriesParsed() 
     724 
     725=over 4 
     726 
     727Indicates how many registry key/value pairs the Parser B<$object> has 
     728parsed within the specified file, so far. 
     729 
     730I<Output>: Returns the number of key/value pairs parsed so far; 
     731returns 0, if none parsed yet. 
     732 
     733=back 
     734 
     735=begin testing 
     736 
     737my ($nextGroup); 
     738my $test_registry_file = $ENV{PWD} . "/" . getVar(name      => "registry_file", 
     739                                                  namespace => "HoneyClient::Agent::Integrity::Registry::Parser::Test"); 
     740 
     741# Create a generic Parser object, with test state data. 
     742my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); 
     743 
     744while(defined($nextGroup = $parser->nextGroup)) { 
     745
     746 
     747is($parser->entriesParsed(), 19, "entriesParsed()") or diag("The entriesParsed() call failed."); 
     748 
     749=end testing 
     750 
     751=cut 
     752 
    510753sub entriesParsed { 
    511754    # Extract arguments. 
     
    527770=head1 BUGS & ASSUMPTIONS 
    528771 
    529 XXX: Fill this in. 
     772The Parser B<$object> expects to scan the specified file as an input stream. 
     773Subsequent calls to $object->nextGroup() will advance the parser through 
     774the input stream. 
     775 
     776Currently, there is no way to reset a Parser's scan through an input stream. 
     777If desired, simply create a new Parser object, to restart the scan process. 
    530778 
    531779=head1 SEE ALSO 
    532780 
    533 XXX: If you have a mailing list, mention it here. 
    534  
    535 XXX: If you have a web site set up for your module, mention it here. 
     781L<http://www.honeyclient.org/trac> 
    536782 
    537783=head1 REPORTING BUGS 
    538784 
    539 XXX: Mention website/mailing list to use, when reporting bugs. 
     785L<http://www.honeyclient.org/trac/newticket> 
    540786 
    541787=head1 ACKNOWLEDGEMENTS 
  • honeyclient/branches/bug/42/lib/HoneyClient/Manager.pm

    r70 r96  
    724724=head1 SEE ALSO 
    725725 
    726 XXX: Fill this in. 
    727  
    728 XXX: If you have a mailing list, mention it here. 
    729  
    730 XXX: If you have a web site set up for your module, mention it here. 
     726L<http://www.honeyclient.org/trac> 
    731727 
    732728=head1 REPORTING BUGS 
    733729 
    734 XXX: Mention website/mailing list to use, when reporting bugs. 
     730L<http://www.honeyclient.org/trac/newticket> 
    735731 
    736732=head1 ACKNOWLEDGEMENTS 
  • honeyclient/branches/bug/42/lib/HoneyClient/Manager/FW.pm

    r70 r96  
    33033303=head1 SEE ALSO 
    33043304 
     3305L<http://www.honeyclient.org/trac> 
     3306 
    33053307SOAP::Lite, SOAP::Transport::HTTP 
    33063308 
     
    33173319 
    33183320Data::Dumper, English, Proc::ProcessTable, FileHandle 
     3321 
     3322L<http://www.honeyclient.org/trac> 
     3323 
     3324=head1 REPORTING BUGS 
     3325 
     3326L<http://www.honeyclient.org/trac/newticket> 
    33193327 
    33203328=head1 ACKNOWLEDGEMENTS 
  • honeyclient/branches/bug/42/lib/HoneyClient/Manager/VM.pm

    r70 r96  
    360360# Make sure Log::Log4perl loads 
    361361BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) 
    362         or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly linsted within the path."); 
     362        or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly listed within the path."); 
    363363        
    364364        # Suppress all logging messages, since we need clean output for unit testing. 
     
    47714771=head1 SEE ALSO 
    47724772 
     4773L<http://www.honeyclient.org/trac> 
     4774 
    47734775SOAP::Lite 
    47744776 
     
    47864788Apache::SessionX::General::MD5 
    47874789 
    4788 XXX: If you have a mailing list set up for your module, mention it here. 
    4789  
    4790 XXX: If you have a web site set up for your module, mention it here. 
    4791  
    47924790=head1 REPORTING BUGS 
    47934791 
    4794 XXX: Mention website/mailing list to use, when reporting bugs. 
     4792