Changeset 1450
- Timestamp:
- 04/03/08 17:07:10 (3 months ago)
- Files:
-
- honeyclient/branches/exp/kindlund-simpler_agent/etc/honeyclient.xml (modified) (1 diff)
- honeyclient/branches/exp/kindlund-simpler_agent/lib/HoneyClient/Agent.pm (modified) (1 diff)
- honeyclient/branches/exp/kindlund-simpler_agent/lib/HoneyClient/Manager/Database.pm (modified) (1 diff)
- honeyclient/branches/exp/kindlund-simpler_agent/lib/HoneyClient/Manager/VM/Clone.pm (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
honeyclient/branches/exp/kindlund-simpler_agent/etc/honeyclient.xml
r1448 r1450 302 302 <VM> 303 303 <master_vm_config description="The full absolute path to the VM configuration file on the host system that will be used by all subsequent cloned VMs."> 304 /vm/masters/Agent.Master-3 6/winXPPro.cfg304 /vm/masters/Agent.Master-37/winXPPro.cfg 305 305 </master_vm_config> 306 306 <port description="The TCP port number that the SOAP server of the VM daemon will listen on for requests. Note: This port should be unique and not already be used by other modules, services, or daemons running on the host system." default="8089"> honeyclient/branches/exp/kindlund-simpler_agent/lib/HoneyClient/Agent.pm
r1443 r1450 38 38 =head1 VERSION 39 39 40 1.02 40 This documentation refers to HoneyClient::Agent version 1.02. 41 41 42 42 =head1 SYNOPSIS honeyclient/branches/exp/kindlund-simpler_agent/lib/HoneyClient/Manager/Database.pm
r1353 r1450 344 344 =head1 COPYRIGHT & LICENSE 345 345 346 Copyright (C) 200 8 The MITRE Corporation. All rights reserved.346 Copyright (C) 2007-2008 The MITRE Corporation. All rights reserved. 347 347 348 348 This program is free software; you can redistribute it and/or honeyclient/branches/exp/kindlund-simpler_agent/lib/HoneyClient/Manager/VM/Clone.pm
r1419 r1450 238 238 use HoneyClient::Manager::VM; 239 239 240 # Make sure HoneyClient::Manager::Database loads. 241 BEGIN { use_ok('HoneyClient::Manager::Database') or diag("Can't load HoneyClient::Manager::Database package. Check to make sure the package library is correctly listed within the path."); } 242 require_ok('HoneyClient::Manager::Database'); 243 use HoneyClient::Manager::Database; 244 240 245 # Make sure VMware::VmPerl loads. 241 246 BEGIN { use_ok('VMware::VmPerl', qw(VM_EXECUTION_STATE_ON VM_EXECUTION_STATE_OFF VM_EXECUTION_STATE_STUCK VM_EXECUTION_STATE_SUSPENDED)) or diag("Can't load VMware::VmPerl package. Check to make sure the package library is correctly listed within the path."); } … … 287 292 use File::Basename qw(dirname basename); 288 293 294 # Make sure Sys::Hostname loads. 295 BEGIN { use_ok('Sys::Hostname') or diag("Can't load Sys::Hostname package. Check to make sure the package library is correctly listed within the path."); } 296 require_ok('Sys::Hostname'); 297 use Sys::Hostname; 298 299 # Make sure Sys::HostIP loads. 300 BEGIN { use_ok('Sys::HostIP') or diag("Can't load Sys::HostIP package. Check to make sure the package library is correctly listed within the path."); } 301 require_ok('Sys::HostIP'); 302 use Sys::HostIP; 303 304 # Make sure DateTime::HiRes loads. 305 BEGIN { use_ok('DateTime::HiRes') or diag("Can't load Sys::HostIP package. Check to make sure the package library is correctly listed within the path."); } 306 require_ok('DateTime::HiRes'); 307 use DateTime::HiRes; 308 289 309 =end testing 290 310 … … 325 345 our $LOG = get_logger(); 326 346 347 # Use Hostname Libraries 348 use Sys::Hostname::Long; 349 350 # Use HostIP Libraries 351 use Sys::HostIP; 352 353 # Use DateTime::HiRes Libraries 354 use DateTime::HiRes; 355 327 356 # The global variable, used to count the number of 328 357 # Clone objects that have been created. 329 358 our $OBJECT_COUNT : shared = -1; 359 360 # Include Database Libraries 361 use HoneyClient::Manager::Database; 330 362 331 363 =pod … … 390 422 391 423 The ID of the VM instance, if it is stored within the Drone database. 424 425 =back 426 427 =head2 status 428 429 =over 4 430 431 The status of the cloned VM. 432 433 =back 434 435 =head2 driver_name 436 437 =over 4 438 439 The Driver assigned to this cloned VM. 392 440 393 441 =back … … 496 544 $LOG->error("Unable to suspend VM (" . $self->{'config'} . ")."); 497 545 } 498 499 546 } 500 547 … … 593 640 } 594 641 } 642 $self->_changeStatus(status => "initialized"); 595 643 596 644 # Wait until the VM gets registered, before proceeding. … … 606 654 } 607 655 } 656 $self->_changeStatus(status => "registered"); 608 657 609 658 # Once registered, check if the VM is ON yet. … … 619 668 } 620 669 } 670 $self->_changeStatus(status => "running"); 621 671 622 672 # Now, get the VM's MAC address. … … 655 705 656 706 eval { 657 $som = $stubAgent->get Status();707 $som = $stubAgent->getProperties(driver_name => $self->{'driver_name'}); 658 708 $ret = $som->result(); 659 709 }; … … 666 716 if (!defined($ret)) { 667 717 sleep ($self->{'_retry_period'}); 718 } elsif (getVar(name => "enable", 719 namespace => "HoneyClient::Manager::Database")) { 720 # Register the cloned VM with the Drone database. 721 my $dt = DateTime::HiRes->now(time_zone => "local"); 722 723 # Construct the 'Client' object. 724 my $client = { 725 cid => $self->{'name'}, 726 status => $self->{'status'}, 727 host => { 728 org => getVar(name => "organization"), 729 hostname => Sys::Hostname::Long::hostname_long, 730 ip => Sys::HostIP->ip, 731 }, 732 os => $ret, 733 start => $dt->ymd('-').'T'.$dt->hms(':'), 734 }; 735 $self->{'database_id'} = HoneyClient::Manager::Database::insert_client($client); 668 736 } 737 } 738 739 return $self; 740 } 741 742 # TODO: Comment this. 743 # XXX: Should this be made public? 744 sub _changeStatus { 745 746 # Extract arguments. 747 my ($self, %args) = @_; 748 749 # Sanity check: Make sure we've been fed an object. 750 unless (ref($self)) { 751 $LOG->error("Error: Function must be called in reference to a " . 752 __PACKAGE__ . "->new() object!"); 753 Carp::croak "Error: Function must be called in reference to a " . 754 __PACKAGE__ . "->new() object!"; 755 } 756 757 # Sanity check. Make sure we get a valid argument. 758 my $argsExist = scalar(%args); 759 if (!$argsExist || 760 !exists($args{'status'}) || 761 !defined($args{'status'})) { 762 763 # Croak if no valid argument is supplied. 764 $LOG->error("Error: No status argument supplied."); 765 Carp::croak "Error: No status argument supplied."; 766 } 767 768 # Don't change the status field for any VM that has been marked 769 # as suspicious or compromised. 770 if (($self->{'status'} ne "suspicious") && 771 ($self->{'status'} ne "compromised")) { 772 $self->{'status'} = $args{'status'}; 669 773 } 670 774 … … 847 951 # A variable containing the database identifier, if any is specified. 848 952 database_id => undef, 849 953 954 # A variable reflecting the current status of the cloned VM. 955 status => "uninitialized", 956 957 # A variable reflected the driver assigned to this cloned VM. 958 driver_name => getVar(name => "default_driver", 959 namespace => "HoneyClient::Agent"); 960 850 961 # A SOAP handle to the VM manager daemon. (This internal variable 851 962 # should never be modified externally.)
