Pandora Agent RCMD

This commit is contained in:
fbsanchez 2019-11-13 14:21:09 +01:00
parent 5f8ec8f89c
commit c17328d39d

View File

@ -318,8 +318,7 @@ sub read_file {
my $path = shift; my $path = shift;
my $_FILE; my $_FILE;
if( !open($_FILE, "<".$path) ) { if( !open($_FILE, "<", $path) ) {
print ">> Failed to open $path ".`whoami`."\n";
# failed to open, return undef # failed to open, return undef
return undef; return undef;
} }
@ -1535,15 +1534,20 @@ sub report_command {
sub execute_command_block { sub execute_command_block {
my ($commands, $std_files) = @_; my ($commands, $std_files) = @_;
$std_files = '' unless defined ($std_files);
return 0 if ref($commands) ne "ARRAY";
my $err_level; my $err_level;
$std_files = '' unless defined ($std_files);
foreach my $comm (@{$commands}) { if (ref($commands) ne "ARRAY") {
`($comm) $std_files`; `($commands) $std_files`;
print "($commands) $std_files\n";
$err_level = $?>>8; $err_level = $?>>8;
last unless ($err_level == 0); } else {
foreach my $comm (@{$commands}) {
`($comm) $std_files`;
print $comm. '=> ' . ($?>>8)."\n";
$err_level = $?>>8;
last unless ($err_level == 0);
}
} }
return $err_level; return $err_level;