mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Added message for control return code in WMI
This commit is contained in:
parent
275fd2ed19
commit
38ecfd5b62
@ -1098,19 +1098,26 @@ class AgentWizard extends HTML
|
|||||||
// the host is Windows (and allow WMI).
|
// the host is Windows (and allow WMI).
|
||||||
$commandQuery = $this->wmiCommand;
|
$commandQuery = $this->wmiCommand;
|
||||||
$commandQuery .= ' "SELECT Caption FROM Win32_ComputerSystem"';
|
$commandQuery .= ' "SELECT Caption FROM Win32_ComputerSystem"';
|
||||||
// Execute the wmic command.
|
// Declare the vars.
|
||||||
$result = [];
|
$result = [];
|
||||||
exec($commandQuery, $result);
|
$returnVar = 0;
|
||||||
$execCorrect = true;
|
|
||||||
$tmpError = '';
|
$tmpError = '';
|
||||||
|
$execCorrect = true;
|
||||||
// Look for the response if we have ERROR messages.
|
// Execute the command.
|
||||||
foreach ($result as $info) {
|
exec($commandQuery, $result, $returnVar);
|
||||||
if (preg_match('/ERROR:/', $info) !== 0) {
|
// Only is valid if return code is 0.
|
||||||
$execCorrect = false;
|
if ($returnVar === 0) {
|
||||||
$tmpError = strrchr($info, 'ERROR:');
|
// Look for the response if we have ERROR messages.
|
||||||
break;
|
foreach ($result as $info) {
|
||||||
|
if (preg_match('/ERROR:/', $info) !== 0) {
|
||||||
|
$execCorrect = false;
|
||||||
|
$tmpError = strrchr($info, 'ERROR:');
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$tmpError = sprintf('Return Code %s', $returnVar);
|
||||||
|
$execCorrect = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FOUND ERRORS: TIMEOUT.
|
// FOUND ERRORS: TIMEOUT.
|
||||||
@ -2849,13 +2856,13 @@ class AgentWizard extends HTML
|
|||||||
|
|
||||||
// If name of the module have a macro.
|
// If name of the module have a macro.
|
||||||
$moduleBlocks[$k]['name'] = $this->macroFilter(
|
$moduleBlocks[$k]['name'] = $this->macroFilter(
|
||||||
$module['name'],
|
io_safe_output($module['name']),
|
||||||
$columnsList,
|
$columnsList,
|
||||||
$rowList
|
$rowList
|
||||||
);
|
);
|
||||||
// Description can have macros too.
|
// Description can have macros too.
|
||||||
$moduleBlocks[$k]['description'] = $this->macroFilter(
|
$moduleBlocks[$k]['description'] = $this->macroFilter(
|
||||||
$module['description'],
|
io_safe_output($module['description']),
|
||||||
$columnsList,
|
$columnsList,
|
||||||
$rowList
|
$rowList
|
||||||
);
|
);
|
||||||
@ -2867,7 +2874,7 @@ class AgentWizard extends HTML
|
|||||||
);
|
);
|
||||||
|
|
||||||
foreach ($columnsList as $columnKey => $columnValue) {
|
foreach ($columnsList as $columnKey => $columnValue) {
|
||||||
$macros['macros']['_'.$columnValue.'_'] = $rowList[$columnKey];
|
$macros['macros']['_'.trim($columnValue).'_'] = $rowList[trim($columnKey)];
|
||||||
}
|
}
|
||||||
|
|
||||||
$moduleBlocks[$k]['macros'] = json_encode($macros);
|
$moduleBlocks[$k]['macros'] = json_encode($macros);
|
||||||
@ -2946,19 +2953,19 @@ class AgentWizard extends HTML
|
|||||||
$rowList = explode('|', $rowContent);
|
$rowList = explode('|', $rowContent);
|
||||||
// If name of the module have a macro.
|
// If name of the module have a macro.
|
||||||
$newModule['name'] = $this->macroFilter(
|
$newModule['name'] = $this->macroFilter(
|
||||||
$module['name'],
|
io_safe_output($module['name']),
|
||||||
$columnsList,
|
$columnsList,
|
||||||
$rowList
|
$rowList
|
||||||
);
|
);
|
||||||
// Description can have macros too.
|
// Description can have macros too.
|
||||||
$newModule['description'] = $this->macroFilter(
|
$newModule['description'] = $this->macroFilter(
|
||||||
$module['description'],
|
io_safe_output($module['description']),
|
||||||
$columnsList,
|
$columnsList,
|
||||||
$rowList
|
$rowList
|
||||||
);
|
);
|
||||||
|
|
||||||
$newModule['query_filters'] = $this->macroFilter(
|
$newModule['query_filters'] = $this->macroFilter(
|
||||||
$module['query_filters'],
|
io_safe_output($module['query_filters']),
|
||||||
$columnsList,
|
$columnsList,
|
||||||
$rowList
|
$rowList
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user