Changeset 336

Show
Ignore:
Timestamp:
05/07/07 00:37:10 (2 years ago)
Author:
kindlund
Message:

Testing beta serialization code; still have to properly implement integrity and registry destroy functions (called from agent's destroy function), in order to clean up temporary files created. Also forcing integrity module to reuse temp files created for multiple snapshots/checks.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/branches/exp/kindlund-filesystem/lib/HoneyClient/Agent.pm

    r335 r336  
    243243# initialized integrity state of the VM -- ready to be checked 
    244244# against, at any time. 
    245 #our $integrity = undef; 
    246245our $integrityState : shared = undef; 
    247246 
     
    370369 
    371370    # Perform initial integrity baseline check. 
    372     #my $integrity = undef; 
    373     #if ($PERFORM_INTEGRITY_CHECKS) { 
    374     #    $integrity = HoneyClient::Agent::Integrity->new(); 
    375     #    $integrity->closeFiles(); 
    376     #    $integrityState = freeze($integrity); 
    377     #
     371    my $integrity = undef; 
     372    if ($PERFORM_INTEGRITY_CHECKS) { 
     373        $integrity = HoneyClient::Agent::Integrity->new(); 
     374        $integrity->closeFiles(); 
     375        $integrityState = freeze($integrity); 
     376   
    378377    # XXX: Check to make sure this doesn't destroy the integrity 
    379378    # object prematurely. 
    380     #$integrity = undef; 
     379    # DESTROY this reference, but don't kill any temporary files created. 
     380    $integrity = undef; 
    381381 
    382382    # Release data lock. 
     
    493493        $driverDataSemaphore  = Thread::Semaphore->new(1); 
    494494        %driverUpdateQueues   = ( ); 
    495  
     495        $integrityState       = undef; 
     496 
     497        # TODO: need to set $integrityState to undef 
     498        # and need to call $integrity->destroy, which will call 
     499        # the registry destroy, which will kill any used temporary 
     500        # files 
     501         
    496502        # Release data lock. 
    497503        _unlock(); 
     
    733739                    # As such, do NOT try to call integrity checks on multiple, simultaneous 
    734740                    # asynchronous threaded drivers. 
    735                     #$integrity = thaw($integrityState); 
     741                    $integrity = thaw($integrityState); 
    736742                    # Perform initial integrity baseline check. 
    737743                    #print "Initializing Integrity Check...\n"; 
    738744                    # TODO: Initialize Integrity Checks 
    739                     $integrity = HoneyClient::Agent::Integrity->new(); 
     745                    #$integrity = HoneyClient::Agent::Integrity->new(); 
    740746                } 
    741747 
  • honeyclient/branches/exp/kindlund-filesystem/lib/HoneyClient/Agent/Integrity/Registry.pm

    r302 r336  
    406406# we can simply leave the garbage collection up to Perl's internal 
    407407# mechanism. 
    408 sub DESTROY { 
     408# XXX: Change this to destroy() and update the integrity module's 
     409# with integrity->destroy() accordingly. 
     410sub XDESTROY { 
    409411    my $self = shift; 
    410412 
     
    417419            $fname = $parser->getFilename(); 
    418420            if (defined($fname) && (-f $fname)) { 
    419                 $LOG->debug("Deleting baseline of hive '" . $hive . "' in '" . 
     421                # XXX: Change this to debug, eventually. 
     422                $LOG->info("Deleting baseline of hive '" . $hive . "' in '" . 
    420423                            $fname . "'."); 
    421424                if (!unlink($fname)) { 
     
    430433            $fname = $parser->getFilename(); 
    431434            if (defined($fname) && (-f $fname)) { 
    432                 $LOG->debug("Deleting checkpoint of hive '" . $hive . "' in '" . 
     435                # XXX: Change this to debug, eventually. 
     436                $LOG->info("Deleting checkpoint of hive '" . $hive . "' in '" . 
    433437                            $fname . "'."); 
    434438                if (!unlink($fname)) { 
     
    457461    my $fname_tmp = undef; 
    458462    foreach my $hive (@{$self->{hives_to_check}}) { 
    459         $fname = tmpnam();  
     463        # Check to see if we can reuse temporary files from 
     464        # past checkpoint operations. 
     465        if (exists($parser_collection->{$hive}) && 
     466            defined($parser_collection->{$hive})) { 
     467            $parser = $parser_collection->{$hive}; 
     468            $fname = $parser->getFilename(); 
     469        } else { 
     470            $fname = tmpnam(); 
     471        } 
     472 
    460473        $fname_tmp = tmpnam();  
    461474        $LOG->debug("Storing snapshot of hive '" . $hive . "' into '" . $fname . "'.");