Changeset 1088
- Timestamp:
- 12/30/07 16:30:01 (11 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
honeyclient/branches/exp/xkovah-priority_interrupt/lib/HoneyClient/Agent/Driver/Browser.pm
r1087 r1088 477 477 478 478 # 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 479 485 # getting a link from the relative hashtable. 480 486 unless (defined($link)) { honeyclient/branches/exp/xkovah-priority_interrupt/lib/HoneyClient/Manager.pm
r1087 r1088 139 139 our $globalAgentStateInWaiting = undef; 140 140 141 #our $priority_links_to_visit = 0;142 #our %priority_links = ();143 #FIXME: This should by putting the links into the agent driver state144 141 #Global error count for determining when to stop trying to contact the agent 145 142 our $G_error_count = 0; … … 377 374 378 375 print "I am the ALPHA\n"; 379 print Dumper( $args{'agent_state'});376 print Dumper(thaw(decode_base64($args{'agent_state'}))); 380 377 381 378 for (;;) { 382 379 print "Starting new session...\n"; 383 380 $agentState = $class->runSession(%args); 381 if(defined($globalAgentStateInWaiting)){ 382 383 } 384 384 $args{'agent_state'} = $agentState; 385 385 # XXX: Delete this, eventually. … … 440 440 print "Calling updateState()...\n"; 441 441 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'}))); 443 443 $som = $stubAgent->updateState($args{'agent_state'}); 444 444 … … 479 479 #At this point, the driver could still be running, but we want to interrupt as soon 480 480 #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){ 482 482 #The agent is still running, and is not compromised, but there are priority links 483 483 #to process. This means we need to save off the state of the running VM, and … … 580 580 return $args{'agent_state'}; 581 581 } 582 if(scalar(keys % priority_links) > 0){582 if(scalar(keys %{$ret->{$args{'driver'}}->{'state'}->{priority_links}}) > 0){ 583 583 %vmStateTable = ( ); 584 584 #In this case, we want to suspend the VM and we need to build a 585 585 #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 588 588 589 589 } … … 597 597 sub _updatePriorityLinks { 598 598 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>){ 605 615 my $tmp = $_; 606 616 chomp($tmp); 607 617 $tmp =~ s/\r$//; 608 $priority_links {$tmp} = 1;618 $priority_links->{$tmp} = 1; 609 619 } 610 620 close(PRIORITY); 611 621 system("rm $priority_links_file"); #FIXME: make more generic 622 } 623 $driverRef->{'status'}->{'priority_links_remaining'} = $num_keys; 612 624 } 613 my $num_keys = keys %{$priority_links};614 $driverRef->{'status'}->{'priority_links_remaining'} = $num_keys;615 625 616 626 return $num_keys;
