| | 444 | } |
|---|
| | 445 | } |
|---|
| | 446 | } |
|---|
| | 447 | |
|---|
| | 448 | # Helper function, designed to cleanup temporary files created |
|---|
| | 449 | # by specified parsers. |
|---|
| | 450 | # |
|---|
| | 451 | # Inputs: HoneyClient::Agent::Integrity::Registry object, |
|---|
| | 452 | # the hashtable collection of specified parsers |
|---|
| | 453 | # |
|---|
| | 454 | # Outputs: None. |
|---|
| | 455 | sub _cleanupParsers { |
|---|
| | 456 | # Extract arguments. |
|---|
| | 457 | my ($self, $parser_collection) = @_; |
|---|
| | 458 | |
|---|
| | 459 | # Delete any temporary files created. |
|---|
| | 460 | my $parser = undef; |
|---|
| | 461 | my $fname = undef; |
|---|
| | 462 | foreach my $hive (@{$self->{hives_to_check}}) { |
|---|
| | 463 | $parser = $parser_collection->{$hive}; |
|---|
| | 464 | if (defined($parser)) { |
|---|
| | 465 | $fname = $parser->getFilename(); |
|---|
| | 466 | if (defined($fname) && (-f $fname)) { |
|---|
| | 467 | # XXX: Change this to debug, eventually. |
|---|
| | 468 | $LOG->info("Deleting temporary '" . $hive . "' hive data in '" . |
|---|
| | 469 | $fname . "'."); |
|---|
| | 470 | if (!unlink($fname)) { |
|---|
| | 471 | $LOG->fatal("Error: Unable to unlink '" . $hive . "' hive data in '" . $fname ."'."); |
|---|
| | 472 | Carp::croak("Error: Unable to unlink '" . $hive . "' hive data in '" . $fname ."'."); |
|---|
| | 473 | } |
|---|
| | 474 | } |
|---|
| | 475 | delete($parser_collection->{$hive}); |
|---|