Changeset 1088

Show
Ignore:
Timestamp:
12/30/07 16:30:01 (11 months ago)
Author:
xkovah
Message:

well, it's running at this point…now to try out putting something in the text file

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/branches/exp/xkovah-priority_interrupt/lib/HoneyClient/Agent/Driver/Browser.pm

    r1087 r1088  
    477477 
    478478        # If the next link scalar is empty, try 
     479        # getting a link from the priority_links 
     480        unless (defined($link)) { 
     481            $link = _pop($self->priority_links); 
     482        } 
     483 
     484        # If the priority_links hashtable is empty, try 
    479485        # getting a link from the relative hashtable. 
    480486        unless (defined($link)) { 
  • honeyclient/branches/exp/xkovah-priority_interrupt/lib/HoneyClient/Manager.pm

    r1087 r1088  
    139139our $globalAgentStateInWaiting   = undef; 
    140140 
    141 #our $priority_links_to_visit = 0; 
    142 #our %priority_links = (); 
    143 #FIXME: This should by putting the links into the agent driver state 
    144141#Global error count for determining when to stop trying to contact the agent 
    145142our $G_error_count = 0; 
     
    377374 
    378375    print "I am the ALPHA\n"; 
    379     print Dumper($args{'agent_state'}); 
     376    print Dumper(thaw(decode_base64($args{'agent_state'}))); 
    380377 
    381378    for (;;) { 
    382379        print "Starting new session...\n"; 
    383380        $agentState = $class->runSession(%args); 
     381        if(defined($globalAgentStateInWaiting)){ 
     382 
     383        } 
    384384        $args{'agent_state'} = $agentState; 
    385385        # XXX: Delete this, eventually. 
     
    440440    print "Calling updateState()...\n"; 
    441441    print "YOU MUST BE AT LEAST THIS COMPLETE TO RIDE THE UPDATESTATE\n"; 
    442     print Dumper($args{'agent_state'}); 
     442    print Dumper(thaw(decode_base64($args{'agent_state'}))); 
    443443    $som = $stubAgent->updateState($args{'agent_state'}); 
    444444 
     
    479479            #At this point, the driver could still be running, but we want to interrupt as soon 
    480480            #as possible even though we may lose a little state. 
    481             if(scalar(keys %priority_links) > 0 && !$priority_links_to_visit){ 
     481            if(scalar(keys %{$ret->{$args{'driver'}}->{'state'}->{priority_links}}) > 0){ 
    482482                #The agent is still running, and is not compromised, but there are priority links 
    483483                #to process. This means we need to save off the state of the running VM, and   
     
    580580            return $args{'agent_state'}; 
    581581        } 
    582         if(scalar(keys %priority_links) > 0){ 
     582        if(scalar(keys %{$ret->{$args{'driver'}}->{'state'}->{priority_links}}) > 0){ 
    583583            %vmStateTable = ( ); 
    584584            #In this case, we want to suspend the VM and we need to build a  
    585585            #new agentState which has only the links from the %priority_links 
    586             $args{agent_state}->links_to_visit = \%priority_links
    587  
     586            print "GOT HERE\n"
     587             
    588588  
    589589        } 
     
    597597sub _updatePriorityLinks { 
    598598 
    599     $driverRef = shift; 
    600     $priority_links = $driverRef->{'state'}->{'priority_links'}; 
    601  
    602     if(-f $priority_links_file && -s $priority_links_file){ 
    603         open(PRIORITY, $priority_links_file); 
    604         while(<PRIORITY>){ 
     599 
     600    my $driverRef = shift; 
     601    my $priority_links = $driverRef->{'state'}->{'priority_links'}; 
     602    my $num_keys = keys %{$priority_links}; 
     603    #TODO: For now, we do not allow multiple premptions. Therefore, if there are 
     604    #already priority links to visit, we ignore any new file with new priority links. 
     605    #In the future we should update the priority_links hash, and then do an  
     606    #agentStub->updateState() but for now, I don't want to consider the possible 
     607    #side-effects this could have. 
     608    if($num_keys == 0){  
     609     
     610 
     611        if(-f $priority_links_file && -s $priority_links_file){ 
     612 
     613            open(PRIORITY, $priority_links_file); 
     614            while(<PRIORITY>){ 
    605615            my $tmp = $_; 
    606616            chomp($tmp); 
    607617            $tmp =~ s/\r$//; 
    608             $priority_links{$tmp} = 1;  
     618            $priority_links->{$tmp} = 1;  
    609619        } 
    610620        close(PRIORITY); 
    611621        system("rm $priority_links_file"); #FIXME: make more generic 
     622        } 
     623        $driverRef->{'status'}->{'priority_links_remaining'} = $num_keys; 
    612624    } 
    613     my $num_keys = keys %{$priority_links}; 
    614     $driverRef->{'status'}->{'priority_links_remaining'} = $num_keys; 
    615625  
    616626    return $num_keys;