Changeset 96
- Timestamp:
- 12/11/06 02:11:44 (2 years ago)
- Files:
-
- honeyclient/branches/bug/42/etc/honeyclient.xml (modified) (2 diffs)
- honeyclient/branches/bug/42/lib/HoneyClient/Agent.pm (modified) (1 diff)
- honeyclient/branches/bug/42/lib/HoneyClient/Agent/Driver.pm (modified) (2 diffs)
- honeyclient/branches/bug/42/lib/HoneyClient/Agent/Driver/Browser.pm (modified) (1 diff)
- honeyclient/branches/bug/42/lib/HoneyClient/Agent/Driver/Browser/FF.pm (modified) (2 diffs)
- honeyclient/branches/bug/42/lib/HoneyClient/Agent/Integrity.pm (modified) (1 diff)
- honeyclient/branches/bug/42/lib/HoneyClient/Agent/Integrity/Registry.pm (modified) (10 diffs)
- honeyclient/branches/bug/42/lib/HoneyClient/Agent/Integrity/Registry/Parser.pm (modified) (15 diffs)
- honeyclient/branches/bug/42/lib/HoneyClient/Agent/Integrity/Registry/Parser.yp (modified) (8 diffs)
- honeyclient/branches/bug/42/lib/HoneyClient/Manager.pm (modified) (1 diff)
- honeyclient/branches/bug/42/lib/HoneyClient/Manager/FW.pm (modified) (2 diffs)
- honeyclient/branches/bug/42/lib/HoneyClient/Manager/VM.pm (modified) (3 diffs)
- honeyclient/branches/bug/42/lib/HoneyClient/Util/Config.pm (modified) (4 diffs)
- honeyclient/branches/bug/42/lib/HoneyClient/Util/SOAP.pm (modified) (2 diffs)
- honeyclient/branches/bug/42/t/honeyclient_agent.t (added)
- honeyclient/branches/bug/42/t/honeyclient_agent_driver.t (modified) (1 diff)
- honeyclient/branches/bug/42/t/honeyclient_agent_driver_browser.t (added)
- honeyclient/branches/bug/42/t/honeyclient_agent_driver_browser_ie.t (added)
- honeyclient/branches/bug/42/t/honeyclient_agent_integrity.t (modified) (1 diff)
- honeyclient/branches/bug/42/t/honeyclient_agent_integrity_registry.t (added)
- honeyclient/branches/bug/42/t/honeyclient_agent_integrity_registry_parser.t (added)
- honeyclient/branches/bug/42/t/honeyclient_manager.t (added)
- honeyclient/branches/bug/42/t/honeyclient_manager_fw.t (added)
- honeyclient/branches/bug/42/t/honeyclient_manager_vm.t (modified) (2 diffs)
- honeyclient/branches/bug/42/t/honeyclient_util_config.t (modified) (3 diffs)
- honeyclient/branches/bug/42/t/honeyclient_util_soap.t (modified) (1 diff)
- honeyclient/branches/bug/42/t/test_registry (added)
- honeyclient/branches/bug/42/t/test_registry/dump.reg (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
honeyclient/branches/bug/42/etc/honeyclient.xml
r70 r96 162 162 ../t/testintegrity 163 163 </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> 164 179 </Integrity> 165 180 </Agent> … … 321 336 are *only* used for unit testing. 322 337 --> 323 <!-- TODO: Update this. -->324 338 <test_vm_config description="The relative path to the (empty) test VM, that's used during unit testing." default="t/testVM/winXPPro.vmx"> 325 339 t/testVM/winXPPro.vmx honeyclient/branches/bug/42/lib/HoneyClient/Agent.pm
r70 r96 1117 1117 =head1 SEE ALSO 1118 1118 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. 1119 L<http://www.honeyclient.org/trac> 1124 1120 1125 1121 =head1 REPORTING BUGS 1126 1122 1127 XXX: Mention website/mailing list to use, when reporting bugs. 1123 L<http://www.honeyclient.org/trac/newticket> 1128 1124 1129 1125 =head1 ACKNOWLEDGEMENTS honeyclient/branches/bug/42/lib/HoneyClient/Agent/Driver.pm
r70 r96 160 160 # Make sure Log::Log4perl loads 161 161 BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) 162 or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly li nsted 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."); 163 163 164 164 # Suppress all logging messages, since we need clean output for unit testing. … … 697 697 L<perltoot/"Autoloaded Data Methods"> 698 698 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. 699 L<http://www.honeyclient.org/trac> 702 700 703 701 =head1 REPORTING BUGS 704 702 705 XXX: Mention website/mailing list to use, when reporting bugs. 703 L<http://www.honeyclient.org/trac/newticket> 706 704 707 705 =head1 AUTHORS honeyclient/branches/bug/42/lib/HoneyClient/Agent/Driver/Browser.pm
r73 r96 1454 1454 =head1 SEE ALSO 1455 1455 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. 1456 L<http://www.honeyclient.org/trac> 1459 1457 1460 1458 =head1 REPORTING BUGS 1461 1459 1462 XXX: Mention website/mailing list to use, when reporting bugs. 1460 L<http://www.honeyclient.org/trac/newticket> 1463 1461 1464 1462 =head1 AUTHORS honeyclient/branches/bug/42/lib/HoneyClient/Agent/Driver/Browser/FF.pm
r70 r96 1301 1301 =head1 SEE ALSO 1302 1302 1303 L<http://www.honeyclient.org/trac> 1304 1303 1305 LWP::UserAgent 1304 1306 … … 1311 1313 HoneyClient::Agent::Driver::IE 1312 1314 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 1318 1315 =head1 REPORTING BUGS 1319 1316 1320 XXX: Mention website/mailing list to use, when reporting bugs. 1317 L<http://www.honeyclient.org/trac/newticket> 1321 1318 1322 1319 =head1 AUTHORS honeyclient/branches/bug/42/lib/HoneyClient/Agent/Integrity.pm
r71 r96 1894 1894 =head1 SEE ALSO 1895 1895 1896 L<http://www.honeyclient.org/trac> 1897 1898 =head1 REPORTING BUGS 1899 1900 L<http://www.honeyclient.org/trac/newticket> 1901 1902 =head1 ACKNOWLEDGEMENTS 1903 1896 1904 XXX: 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 BUGS1903 1904 XXX: Mention website/mailing list to use, when reporting bugs.1905 1906 =head1 ACKNOWLEDGEMENTS1907 1908 1905 1909 1906 =head1 AUTHORS honeyclient/branches/bug/42/lib/HoneyClient/Agent/Integrity/Registry.pm
r84 r96 84 84 # }, ], 85 85 # }, ] 86 #87 86 88 87 =head1 DESCRIPTION … … 172 171 # Make sure Log::Log4perl loads 173 172 BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) 174 or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly li nsted 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."); 175 174 176 175 # Suppress all logging messages, since we need clean output for unit testing. … … 206 205 # Make sure Data::Dumper loads 207 206 BEGIN { use_ok('Data::Dumper') 208 or diag("Can't load Data::Dumper package. Check to make sure the package library is correctly li nsted 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."); } 209 208 require_ok('Data::Dumper'); 210 209 use Data::Dumper; … … 212 211 # Make sure Storable loads 213 212 BEGIN { use_ok('Storable', qw(dclone)) 214 or diag("Can't load Storable package. Check to make sure the package library is correctly li nsted within the path."); }213 or diag("Can't load Storable package. Check to make sure the package library is correctly listed within the path."); } 215 214 require_ok('Storable'); 216 215 can_ok('Storable', 'dclone'); … … 219 218 # Make sure IO::Handle loads 220 219 BEGIN { use_ok('IO::Handle') 221 or diag("Can't load IO::Handle package. Check to make sure the package library is correctly li nsted 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."); } 222 221 require_ok('IO::Handle'); 223 222 use IO::Handle; … … 225 224 # Make sure IO::File loads 226 225 BEGIN { use_ok('IO::File') 227 or diag("Can't load IO::File package. Check to make sure the package library is correctly li nsted 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."); } 228 227 require_ok('IO::File'); 229 228 use IO::File; … … 231 230 # Make sure Fcntl loads 232 231 BEGIN { use_ok('Fcntl') 233 or diag("Can't load Fcntl package. Check to make sure the package library is correctly li nsted within the path."); }232 or diag("Can't load Fcntl package. Check to make sure the package library is correctly listed within the path."); } 234 233 require_ok('Fcntl'); 235 234 use Fcntl qw(:seek); … … 237 236 # Make sure File::Temp loads 238 237 BEGIN { use_ok('File::Temp') 239 or diag("Can't load File::Temp package. Check to make sure the package library is correctly li nsted 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."); } 240 239 require_ok('File::Temp'); 241 240 can_ok('File::Temp', 'tmpnam'); … … 245 244 # Make sure Filesys::CygwinPaths loads 246 245 BEGIN { use_ok('Filesys::CygwinPaths') 247 or diag("Can't load Filesys::CygwinPaths package. Check to make sure the package library is correctly li nsted 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."); } 248 247 require_ok('Filesys::CygwinPaths'); 249 248 use Filesys::CygwinPaths qw(:all); … … 1076 1075 L<http://www.cs.mun.ca/~michael/regutils/> 1077 1076 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. 1077 L<http://www.honeyclient.org/trac> 1081 1078 1082 1079 =head1 REPORTING BUGS 1083 1080 1084 XXX: Mention website/mailing list to use, when reporting bugs. 1081 L<http://www.honeyclient.org/trac/newticket> 1085 1082 1086 1083 =head1 ACKNOWLEDGEMENTS honeyclient/branches/bug/42/lib/HoneyClient/Agent/Integrity/Registry/Parser.pm
r95 r96 155 155 # Make sure Log::Log4perl loads 156 156 BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) 157 or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly li nsted 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."); 158 158 159 159 # Suppress all logging messages, since we need clean output for unit testing. … … 189 189 # Make sure Data::Dumper loads 190 190 BEGIN { use_ok('Data::Dumper') 191 or diag("Can't load Data::Dumper package. Check to make sure the package library is correctly li nsted 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."); } 192 192 require_ok('Data::Dumper'); 193 193 use Data::Dumper; … … 195 195 # Make sure IO::File loads 196 196 BEGIN { use_ok('IO::File') 197 or diag("Can't load IO::File package. Check to make sure the package library is correctly li nsted 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."); } 198 198 require_ok('IO::File'); 199 199 use IO::File; 200 201 # Make sure HoneyClient::Agent::Integrity::Registry::Parser loads 202 BEGIN { 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."); } 204 require_ok('HoneyClient::Agent::Integrity::Registry::Parser'); 205 use HoneyClient::Agent::Integrity::Registry::Parser; 200 206 201 207 =end testing … … 338 344 'registry', 0, 339 345 sub 340 #line 21 2"Parser.yp"346 #line 218 "Parser.yp" 341 347 { 342 348 $LOG->debug("Reached end of input stream."); … … 348 354 'registry', 1, 349 355 sub 350 #line 2 17"Parser.yp"356 #line 223 "Parser.yp" 351 357 { 352 358 $LOG->debug("Reached end of input stream."); … … 358 364 'registry', 2, 359 365 sub 360 #line 22 2"Parser.yp"366 #line 228 "Parser.yp" 361 367 { 362 368 $LOG->debug("Reached end of input stream."); … … 380 386 'group', 2, 381 387 sub 382 #line 2 39"Parser.yp"388 #line 245 "Parser.yp" 383 389 { 384 390 my $ret = { }; … … 399 405 'group', 1, 400 406 sub 401 #line 25 3"Parser.yp"407 #line 259 "Parser.yp" 402 408 { 403 409 my $ret = { }; … … 424 430 'entry', 2, 425 431 sub 426 #line 2 77"Parser.yp"432 #line 283 "Parser.yp" 427 433 { 428 434 my $entry = { … … 439 445 } 440 446 441 #line 2 87"Parser.yp"447 #line 293 "Parser.yp" 442 448 443 449 … … 561 567 =begin testing 562 568 569 my $test_registry_file = $ENV{PWD} . "/" . getVar(name => "registry_file", 570 namespace => "HoneyClient::Agent::Integrity::Registry::Parser::Test"); 571 563 572 # 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); 573 my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); 574 isa_ok($parser, 'HoneyClient::Agent::Integrity::Registry::Parser', "init(input_file => $test_registry_file)") or diag("The init() call failed."); 567 575 568 576 =end testing … … 628 636 } 629 637 630 # TODO: Comment this. 638 =pod 639 640 =head2 $object->nextGroup() 641 642 =over 4 643 644 Provides the next registry group, in the form of a hashtable reference. 645 This 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 660 I<Output>: A hashtable reference if the next group was parsed successfully; 661 returns undef, if the Parser B<$object> has reached the end of the input stream. 662 663 =back 664 665 =begin testing 666 667 my ($nextGroup, $expectedGroup); 668 my $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. 672 my $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 }; 686 is_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 701 value spans 702 multiple lines 703 ', 704 }, { 705 name => 'Sane_Key', 706 value => '\\"Wierd=\\"Value', 707 }, ], 708 }; 709 is_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 }; 729 is_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 }; 737 is_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 }; 748 is_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 }; 759 is_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 }; 791 is_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 }; 802 is_deeply($nextGroup, $expectedGroup, "nextGroup() - 8") or diag("The nextGroup() call failed."); 803 804 # Verify Test Group #9 805 $nextGroup = $parser->nextGroup(); 806 is_deeply($nextGroup, undef, "nextGroup() - 9") or diag("The nextGroup() call failed."); 807 808 =end testing 809 810 =cut 811 631 812 sub nextGroup { 632 813 # Extract arguments. … … 648 829 } 649 830 650 # TODO: Comment this. 831 =pod 832 833 =head2 $object->dirsParsed() 834 835 =over 4 836 837 Indicates how many registry directories the Parser B<$object> has 838 parsed within the specified file, so far. 839 840 I<Output>: Returns the number of directory groups parsed so far; 841 returns 0, if none parsed yet. 842 843 =back 844 845 =begin testing 846 847 my ($nextGroup); 848 my $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. 852 my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); 853 854 while(defined($nextGroup = $parser->nextGroup)) { 855 } 856 857 is($parser->dirsParsed(), 8, "dirsParsed()") or diag("The dirsParsed() call failed."); 858 859 =end testing 860 861 =cut 862 651 863 sub dirsParsed { 652 864 # Extract arguments. … … 662 874 } 663 875 664 # TODO: Comment this. 876 =pod 877 878 =head2 $object->entriesParsed() 879 880 =over 4 881 882 Indicates how many registry key/value pairs the Parser B<$object> has 883 parsed within the specified file, so far. 884 885 I<Output>: Returns the number of key/value pairs parsed so far; 886 returns 0, if none parsed yet. 887 888 =back 889 890 =begin testing 891 892 my ($nextGroup); 893 my $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. 897 my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); 898 899 while(defined($nextGroup = $parser->nextGroup)) { 900 } 901 902 is($parser->entriesParsed(), 19, "entriesParsed()") or diag("The entriesParsed() call failed."); 903 904 =end testing 905 906 =cut 907 665 908 sub entriesParsed { 666 909 # Extract arguments. … … 682 925 =head1 BUGS & ASSUMPTIONS 683 926 684 XXX: Fill this in. 927 The Parser B<$object> expects to scan the specified file as an input stream. 928 Subsequent calls to $object->nextGroup() will advance the parser through 929 the input stream. 930 931 Currently, there is no way to reset a Parser's scan through an input stream. 932 If desired, simply create a new Parser object, to restart the scan process. 685 933 686 934 =head1 SEE ALSO 687 935 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. 936 L<http://www.honeyclient.org/trac> 691 937 692 938 =head1 REPORTING BUGS 693 939 694 XXX: Mention website/mailing list to use, when reporting bugs. 940 L<http://www.honeyclient.org/trac/newticket> 695 941 696 942 =head1 ACKNOWLEDGEMENTS honeyclient/branches/bug/42/lib/HoneyClient/Agent/Integrity/Registry/Parser.yp
r95 r96 138 138 # Make sure Log::Log4perl loads 139 139 BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) 140 or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly li nsted 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."); 141 141 142 142 # Suppress all logging messages, since we need clean output for unit testing. … … 172 172 # Make sure Data::Dumper loads 173 173 BEGIN { use_ok('Data::Dumper') 174 or diag("Can't load Data::Dumper package. Check to make sure the package library is correctly li nsted 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."); } 175 175 require_ok('Data::Dumper'); 176 176 use Data::Dumper; … … 178 178 # Make sure IO::File loads 179 179 BEGIN { use_ok('IO::File') 180 or diag("Can't load IO::File package. Check to make sure the package library is correctly li nsted 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."); } 181 181 require_ok('IO::File'); 182 182 use IO::File; 183 184 # Make sure HoneyClient::Agent::Integrity::Registry::Parser loads 185 BEGIN { 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."); } 187 require_ok('HoneyClient::Agent::Integrity::Registry::Parser'); 188 use HoneyClient::Agent::Integrity::Registry::Parser; 183 189 184 190 =end testing … … 406 412 =begin testing 407 413 414 my $test_registry_file = $ENV{PWD} . "/" . getVar(name => "registry_file", 415 namespace => "HoneyClient::Agent::Integrity::Registry::Parser::Test"); 416 408 417 # 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); 418 my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); 419 isa_ok($parser, 'HoneyClient::Agent::Integrity::Registry::Parser', "init(input_file => $test_registry_file)") or diag("The init() call failed."); 412 420 413 421 =end testing … … 473 481 } 474 482 475 # TODO: Comment this. 483 =pod 484 485 =head2 $object->nextGroup() 486 487 =over 4 488 489 Provides the next registry group, in the form of a hashtable reference. 490 This 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 505 I<Output>: A hashtable reference if the next group was parsed successfully; 506 returns undef, if the Parser B<$object> has reached the end of the input stream. 507 508 =back 509 510 =begin testing 511 512 my ($nextGroup, $expectedGroup); 513 my $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. 517 my $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 }; 531 is_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 546 value spans 547 multiple lines 548 ', 549 }, { 550 name => 'Sane_Key', 551 value => '\\"Wierd=\\"Value', 552 }, ], 553 }; 554 is_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 }; 574 is_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 }; 582 is_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 }; 593 is_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 }; 604 is_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 }; 636 is_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 }; 647 is_deeply($nextGroup, $expectedGroup, "nextGroup() - 8") or diag("The nextGroup() call failed."); 648 649 # Verify Test Group #9 650 $nextGroup = $parser->nextGroup(); 651 is_deeply($nextGroup, undef, "nextGroup() - 9") or diag("The nextGroup() call failed."); 652 653 =end testing 654 655 =cut 656 476 657 sub nextGroup { 477 658 # Extract arguments. … … 493 674 } 494 675 495 # TODO: Comment this. 676 =pod 677 678 =head2 $object->dirsParsed() 679 680 =over 4 681 682 Indicates how many registry directories the Parser B<$object> has 683 parsed within the specified file, so far. 684 685 I<Output>: Returns the number of directory groups parsed so far; 686 returns 0, if none parsed yet. 687 688 =back 689 690 =begin testing 691 692 my ($nextGroup); 693 my $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. 697 my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); 698 699 while(defined($nextGroup = $parser->nextGroup)) { 700 } 701 702 is($parser->dirsParsed(), 8, "dirsParsed()") or diag("The dirsParsed() call failed."); 703 704 =end testing 705 706 =cut 707 496 708 sub dirsParsed { 497 709 # Extract arguments. … … 507 719 } 508 720 509 # TODO: Comment this. 721 =pod 722 723 =head2 $object->entriesParsed() 724 725 =over 4 726 727 Indicates how many registry key/value pairs the Parser B<$object> has 728 parsed within the specified file, so far. 729 730 I<Output>: Returns the number of key/value pairs parsed so far; 731 returns 0, if none parsed yet. 732 733 =back 734 735 =begin testing 736 737 my ($nextGroup); 738 my $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. 742 my $parser = HoneyClient::Agent::Integrity::Registry::Parser->init(input_file => $test_registry_file); 743 744 while(defined($nextGroup = $parser->nextGroup)) { 745 } 746 747 is($parser->entriesParsed(), 19, "entriesParsed()") or diag("The entriesParsed() call failed."); 748 749 =end testing 750 751 =cut 752 510 753 sub entriesParsed { 511 754 # Extract arguments. … … 527 770 =head1 BUGS & ASSUMPTIONS 528 771 529 XXX: Fill this in. 772 The Parser B<$object> expects to scan the specified file as an input stream. 773 Subsequent calls to $object->nextGroup() will advance the parser through 774 the input stream. 775 776 Currently, there is no way to reset a Parser's scan through an input stream. 777 If desired, simply create a new Parser object, to restart the scan process. 530 778 531 779 =head1 SEE ALSO 532 780 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. 781 L<http://www.honeyclient.org/trac> 536 782 537 783 =head1 REPORTING BUGS 538 784 539 XXX: Mention website/mailing list to use, when reporting bugs. 785 L<http://www.honeyclient.org/trac/newticket> 540 786 541 787 =head1 ACKNOWLEDGEMENTS honeyclient/branches/bug/42/lib/HoneyClient/Manager.pm
r70 r96 724 724 =head1 SEE ALSO 725 725 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. 726 L<http://www.honeyclient.org/trac> 731 727 732 728 =head1 REPORTING BUGS 733 729 734 XXX: Mention website/mailing list to use, when reporting bugs. 730 L<http://www.honeyclient.org/trac/newticket> 735 731 736 732 =head1 ACKNOWLEDGEMENTS honeyclient/branches/bug/42/lib/HoneyClient/Manager/FW.pm
r70 r96 3303 3303 =head1 SEE ALSO 3304 3304 3305 L<http://www.honeyclient.org/trac> 3306 3305 3307 SOAP::Lite, SOAP::Transport::HTTP 3306 3308 … … 3317 3319 3318 3320 Data::Dumper, English, Proc::ProcessTable, FileHandle 3321 3322 L<http://www.honeyclient.org/trac> 3323 3324 =head1 REPORTING BUGS 3325 3326 L<http://www.honeyclient.org/trac/newticket> 3319 3327 3320 3328 =head1 ACKNOWLEDGEMENTS honeyclient/branches/bug/42/lib/HoneyClient/Manager/VM.pm
r70 r96 360 360 # Make sure Log::Log4perl loads 361 361 BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) 362 or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly li nsted 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."); 363 363 364 364 # Suppress all logging messages, since we need clean output for unit testing. … … 4771 4771 =head1 SEE ALSO 4772 4772 4773 L<http://www.honeyclient.org/trac> 4774 4773 4775 SOAP::Lite 4774 4776 … … 4786 4788 Apache::SessionX::General::MD5 4787 4789 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 4792 4790 =head1 REPORTING BUGS 4793 4791 4794 XXX: Mention website/mailing list to use, when reporting bugs. 4792
