Changeset 399

Show
Ignore:
Timestamp:
05/29/07 16:16:47 (1 year ago)
Author:
kindlund
Message:

Finished agent syslog support.

Files:

Legend:

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

    r393 r399  
    114114    # within the global configuration file.  Or, feed the initialization logic through init() as part of the arguments. 
    115115    @DRIVERS = ( 'IE' ); 
    116 # XXX: See if this is still needed. 
    117116    foreach (@DRIVERS) { 
    118117        eval "use HoneyClient::Agent::Driver::Browser::$_"; 
     
    229228use Data::Compare; 
    230229 
     230# The global logging object. 
     231our $LOG = get_logger(); 
     232 
    231233# Complete URL of SOAP server, when initialized. 
    232234our $URL_BASE       : shared = undef; 
     
    344346    # Sanity check.  Make sure the daemon isn't already running. 
    345347    if (defined($DAEMON_PID)) { 
     348        $LOG->fatal("Error: " . __PACKAGE__ . " daemon is already running (PID = " . $DAEMON_PID .")!"); 
    346349        Carp::croak "Error: " . __PACKAGE__ . " daemon is already running (PID = $DAEMON_PID)!\n"; 
    347350    } 
     
    407410        # Make sure the fork was successful. 
    408411        if (!defined($pid)) { 
     412            $LOG->fatal("Error: Unable to fork child process.\n$!"); 
    409413            Carp::croak "Error: Unable to fork child process.\n$!"; 
    410414        } 
     
    467471    # the parent process... 
    468472    if (defined($DAEMON_PID) && ($DAEMON_PID != 0)) { 
     473        $LOG->error("Killing PID = " . $DAEMON_PID); 
    469474        print STDERR "Killing PID = " . $DAEMON_PID . "\n"; 
    470475        # The Win32 version of kill() seems to only respond to SIGKILL(9). 
     
    837842            # We assume $driver->next() returns defined data. 
    838843            foreach my $resource (keys %{$driver->next()->{resources}}) { 
    839                 print "Using Resource: " . $resource . "\n"
     844                $LOG->info("Driving To Resource: " . $resource)
    840845            } 
    841846 
     
    854859            # XXX: Delete this, eventually. 
    855860            if ($driverTargetsChanged) { 
    856                 print "Driver targets have changed.\n"
     861                $LOG->info("Driver targets have changed.")
    857862                #$Data::Dumper::Terse = 0; 
    858863                #$Data::Dumper::Indent = 1; 
     
    877882            # For now, we update a scalar called 'is_compromised' within 
    878883            # the $data->{$driverName}->{'status'} sub-hashtable. 
    879             print "Performing Integrity Checks...\n"
     884            $LOG->info("Performing Integrity Checks.")
    880885            my $changes = $integrity->check(); 
    881886            if (scalar(@{$changes->{registry}}) ||  
    882887                scalar(@{$changes->{filesystem}})) { 
    883                 print "Integrity Check: FAILED\n"
     888                $LOG->warn("Integrity Check: FAILED")
    884889                $isCompromised = 1; 
    885890            } else { 
    886                 print "Integrity Check: PASSED\n"
     891                $LOG->info("Integrity Check: PASSED")
    887892            } 
    888893        } 
     
    922927 
    923928        # TODO: Do proper fault queuing. 
    924         print "FAULT: " . $@ . "\n"
     929        $LOG->error("FAULT: " . $@)
    925930    } 
    926931 
     
    11311136        if ($proc->{Name} eq $processName) { 
    11321137            # TODO: Should this statement be in here? 
     1138            $LOG->warn("Killing Process ID: " . $proc->{ProcessId}); 
    11331139            Carp::carp "Killing Process ID: " . $proc->{ProcessId} . "\n"; 
    11341140            Win32::Process::KillProcess($proc->{ProcessId}, 0);