Do not rely on the exit status of ping.exe for module_ping.

When an ICMP destination unreachable message is received, the exit
status of ping.exe is 0, which breaks module_ping modules. Pipe the
output of ping.exe to find.exe instead. Ref. pandora_enterprise#7942.
This commit is contained in:
Ramon Novoa 2021-09-28 15:13:04 +02:00
parent 08fe77ddaa
commit 433d4b5001
1 changed files with 1 additions and 1 deletions

View File

@ -30,7 +30,7 @@ using namespace Pandora_Modules;
* @param host Host to be pinged.
*/
Pandora_Module_Ping::Pandora_Module_Ping (string name, string host, string count, string timeout, string advanced_options)
: Pandora_Module_Exec (name, "ping -n " + count + " -w " + timeout + " " + advanced_options + " " + host) {
: Pandora_Module_Exec (name, "ping -n " + count + " -w " + timeout + " " + advanced_options + " " + host + " | find \"TTL=\"") {
this->proc = 1;
this->setKind (module_ping_str);
}