Changeset 76

Show
Ignore:
Timestamp:
12/06/06 15:49:58 (2 years ago)
Author:
kindlund
Message:

Added ability to dump manager state information out to a specified file, upon termination.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/branches/exp/stephenson-link_scoring/etc/honeyclient.xml

    r74 r76  
    165165    <Manager> 
    166166        <!-- TODO: Update this. --> 
     167        <manager_state description="Upon termination, the Manager will attempt to save a complete copy of its state into this file, if specified." default=""> 
     168            Manager.dump 
     169        </manager_state> 
     170        <!-- TODO: Update this. --> 
    167171        <address description="The IP or hostname that all Manager modules should use, when accepting SOAP requests." default="localhost"> 
    168172            localhost 
  • honeyclient/branches/exp/stephenson-link_scoring/lib/HoneyClient/Manager.pm

    r75 r76  
    191191                      VM_EXECUTION_STATE_SUSPENDED); 
    192192 
     193# TODO: Include unit tests. 
     194use IO::File; 
     195 
    193196# Complete URL of SOAP server, when initialized. 
    194197our $URL_BASE       : shared = undef; 
     
    210213# eventually. 
    211214our $globalAgentState   = undef; 
     215 
     216# This static variable may contain a filename that the Manager 
     217# would use to dump its entire state information, upon termination. 
     218# XXX: May want to change this format/usage, eventually. 
     219our $STATE_FILE = getVar(name => "manager_state"); 
    212220 
    213221####################################################################### 
     
    367375    } 
    368376 
    369     # XXX: Delete this block, eventually. 
    370     $Data::Dumper::Terse = 0; 
    371     $Data::Dumper::Indent = 2; 
    372     print Dumper(thaw(decode_base64($globalAgentState))); 
     377    # XXX: May want to change this format/usage, eventually. 
     378    if (length($STATE_FILE) > 0) { 
     379        print "Saving state to '" . $STATE_FILE . "'...\n"; 
     380        my $dump_file = new IO::File($STATE_FILE, "w"); 
     381 
     382        # XXX: Delete this block, eventually. 
     383        $Data::Dumper::Terse = 0; 
     384        $Data::Dumper::Indent = 2; 
     385        print $dump_file Dumper(thaw(decode_base64($globalAgentState))); 
     386    } 
    373387 
    374388    exit;